Does the Go race detector's "failed to restore the stack" warning actually indicate anything?

polaris · · 672 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>The only references I found online involved increasing <code>history_size</code> to suppress it. I&#39;m led to believe that it&#39;s not actually a problem, but it still shows up as a data race, which confuses me slightly. If it&#39;s useless, is there a way to make the race detector just ignore it?</p> <hr/>**评论:**<br/><br/>joushou: <pre><p>The race detector works by tracking the various reads and writes. Storing a stack for each of these consumes a lot of memory, so there&#39;s a limit, called the &#34;history_size&#34; (Defined by <a href="https://golang.org/doc/articles/race_detector.html" rel="nofollow">https://golang.org/doc/articles/race_detector.html</a> as &#34;history_size (default 1): The per-goroutine memory access history is 32K * 2**history_size elements.&#34;).</p> <p>&#34;Failed to restore stack&#34; is not an erroneous report, but rather a race report where the stack is not available because it hit the limit. In other words, you need to increase the history_size. Ignoring the error means that you&#39;re ignoring a race. Alternatively, you could simplify your code or test so that it won&#39;t hit the limit.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

672 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传