<p>The only references I found online involved increasing <code>history_size</code> to suppress it. I'm led to believe that it's not actually a problem, but it still shows up as a data race, which confuses me slightly. If it'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's a limit, called the "history_size" (Defined by <a href="https://golang.org/doc/articles/race_detector.html" rel="nofollow">https://golang.org/doc/articles/race_detector.html</a> as "history_size (default 1): The per-goroutine memory access history is 32K * 2**history_size elements.").</p>
<p>"Failed to restore stack" 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're ignoring a race. Alternatively, you could simplify your code or test so that it won't hit the limit.</p></pre>
Does the Go race detector's "failed to restore the stack" warning actually indicate anything?
polaris · · 672 次点击这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传