Stockfish: stockfish crashing during playchess game

Created on 27 Feb 2020  路  29Comments  路  Source: official-stockfish/Stockfish

https://i.imgur.com/HMiMZZ3.png
https://i.imgur.com/hXuiVR6.png
Unhandled exception at 0x000000013F7B54F8 in StockFish_240220_POPCNT.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x0000000003983000). occurred

Most helpful comment

@Marat-Ka don't worry if you can't do it. The only issue is that none of the main developers actually uses MSVC, as far as I know, so they are reluctant to write guidelines for a tool they can not access.

All 29 comments

OS? windows I guess. How has the version been compiled, what's the stacksize for threads on windows? This is most likely the same problem as we had for OSX, would need the same (or windows-specific) solution.

@Vizvezdenec we need to figure out which branch we take in preprocessing near line 32 in thread_win32_osx.h.

W7 x64 SP1
compiled with MSVC 2017
https://imageup.ru/img111/3563347/dgfd.png - default value

Hello! I found this problem on my system. I can share the SF project with all its settings.

MSCV definitely needed specific flags to set the stack size for the threads. It needs to be >2Mb. I believe noob once shared detailed instructions on how to build with MSCV, but can't find them right now.

MSCV definitely needed specific flags to set the stack size for the threads. It needs to be >2Mb. I believe noob once shared detailed instructions on how to build with MSCV, but can't find them right now.

The default stack size is 1 megabyte.
If I set it to 8 megabytes - will this help solve the problem?

imageup.ru

yes, that should fix it.

If this fixes it, we should document that somewhere on our wiki..

If this fixes it, we should document that somewhere on our wiki..

To check, I will need to play many games (I think at least 100-200). The engine falls, but very rarely.

p.s. Can someone add the necessary code for MSVC to the source?
By analogy with:

if defined(__APPLE__) || defined(__MINGW32__) || defined(__MINGW64__)

include

static const size_t TH_STACK_SIZE = 8 * 1024 * 1024;

No need for many games, you need a position which reaches high depth. The log shows you crashed at depth 150. Try for example this fen:

setoption name Threads value 4
setoption name Hash value 4096
position fen k1b5/1p1p4/pP1Pp3/K2pPp2/1P1p1P2/3P1P2/5P2/8 w - -
go infinite

I will try it.

No need for many games, you need a position which reaches high depth. The log shows you crashed at depth 150. Try for example this fen:

I assembled four assemblies.
1) Stack by default (1 megabyte), without PGO
2) Stack by default (1 megabyte), with PGO
3) Stack 8 megabytes, without PGO
4) Stack 8 megabytes, with PGO

To specify a 8 megabyte stack, I used /STACK:reserve=8388608 on the linker options command line.

Result: only the second assembly crashes, the crash occurs within 1-10 minutes. The remaining assemblies worked for about an hour without an abnormal shutdown.

It seems that the default stack is sufficient if PGO is not used.

Thanks for the tip "where to look"!

p.s.
If someone wants to check the problem on their PC, you can download the assemblies:
https://yadi.sk/d/dzoCRAonBoVdFQ

@Marat-Ka the optimizer might be able to improve stack usage, but that's fragile. In my testing, 2Mb is needed at least. Most build use 8Mb, so I would recommend to stick to that, whatever the optimization options.

I do not argue, I just give statistics that I could get.

In any case, it seems that the /STACK:reserve=8388608 on the linker options command line option solves the problem, at least when analyzing a position for about an hour.

I believe that this can be written to the SF documentation in the wiki.

turns out this was already documented: https://github.com/glinscott/fishtest/wiki/Building-stockfish-on-Windows#can-i-use-microsoft-visual-studio-to-build-an-optimized-version-of-stockfish

I see that this document needs to be edited.

First of all, paragraph 1: how to do this?
I use two options for my AMD FX: /DNDEBUG /DUSE_POPCNT

In addition, if /DNDEBUG is desired, then /DUSE_POPCNT and /DUSE_PEXT are optional, and can only be used on the appropriate equipment.
I'm not sure that they can be used both at the same time.

Then, point 5: it is not convenient, and in addition, it can be changed in the next version of VC.
I use /STACK:reserve=8388608 on the linker command line.
It seems to me that this is a more universal solution.

Next, paragraph 7: this command is on a different menu in VC 2017 (maybe the instruction was copied from another written for another Visual Studio)?

褎芯褌芯褏芯褋褌懈薪谐 斜械蟹 褉械泻谢邪屑褘

feel free to update the wiki, if you feel it can be improved. Ideally whoever added the section chimes in ... (@ppigazzini)

@snicolet :)

feel free to update the wiki, if you feel it can be improved. Ideally whoever added the section chimes in

I'm new to GitHub, and for this reason it's hard for me to do this.
Maybe you can just make a link to discuss this problem from the page where the settings for MSVC are described?

In addition, I am Russian, and I write through a Google translator.

@snicolet :)

what does it mean?

@snicolet :)

what does it mean?

I mentioned the author of that wiki section, in this way he will receive also the following posts and can contribute to the discussion.

I'm new to GitHub, and for this reason it's hard for me to do this.

It was hard for everybody to start contributing to the project :)

  1. learn a bit about github markdown
  2. login in github
  3. go to the wiki page
    https://github.com/glinscott/fishtest/wiki/Building-stockfish-on-Windows
  4. push "Edit" to start the edit session (hint: drag the bottom left corner to have a bigger text windows)
  5. write your changes
  6. write the "Edit message"
  7. click on "Preview" tab to check your markdown formatting, click on "Edit" tab to make other changes
  8. push "Save Page"

Don't fear, there is a page history to compare/revert changes.

Maybe you can just make a link to discuss this problem from the page where the settings for MSVC are described?

You have fist hand experience with MSVC, so you are the best person to write that changes.

In addition, I am Russian, and I write through a Google translator.

It's fine, in case of necessity someone will improve the English :)

Guys, for almost ten years I worked as a tester in a company for the production of commercial antiviruses - Kaspersky Lab. This is a really large company with good technology.

But I don鈥檛 know how to write errors in an unfamiliar language, using an unfamiliar error-proofing system.

I apologize.

If I find another problem - I am documenting how I can.
But everything is clear with this problem, and it seems to me that the documentation for its solution can be written by people who speak native English. And that will be right.

I think than over the 90% of wiki content was written by non native English talkers.

@Marat-Ka don't worry if you can't do it. The only issue is that none of the main developers actually uses MSVC, as far as I know, so they are reluctant to write guidelines for a tool they can not access.

BTW, we do have a CI based on MSVC, but it doesn't set the stacksize ...
https://github.com/official-stockfish/Stockfish/blob/master/appveyor.yml#L38
somebody who knows please prepare a patch...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

d3vv picture d3vv  路  4Comments

d3vv picture d3vv  路  5Comments

niklasf picture niklasf  路  5Comments

ZagButNoZig picture ZagButNoZig  路  6Comments

maelic13 picture maelic13  路  3Comments