aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.cpp
diff options
context:
space:
mode:
authorSChernykh <sergey.v.chernykh@gmail.com>2023-03-29 08:43:47 +0200
committerSChernykh <sergey.v.chernykh@gmail.com>2023-03-29 08:44:20 +0200
commitc742fa4c6ef83eb7f2495128a23d7cc250dc7db2 (patch)
tree2f674a5dbd1aa073e9e0b9b463e360c2c808f615 /src/p2p/net_node.cpp
parentMerge pull request #8801 (diff)
downloadmonero-c742fa4c6ef83eb7f2495128a23d7cc250dc7db2.tar.xz
Fixed deadlock and crash when syncing with full dataset on Windows
It's not allowed to use WaitForSingleObject with _beginthread, because the thread closes its own handle before exiting. So the wait function will either wait on an invalid handle, or on a different handle used by something else. Or, if it starts waiting before the thread exits, the behavior is undefined according to MS: "If this handle is closed while the wait is still pending, the function's behavior is undefined." In my test sync I observed threads getting stuck infinitely on WaitForSingleObject, and then rx_set_main_seedhash spamming new threads when RandomX seed changes again. Eventually the system ran out of resources, and monerod aborted with "Couldn't start RandomX seed thread" message. This PR fixes it by using `_beginthreadex` instead and explicitly closing the handle when it's safe.
Diffstat (limited to 'src/p2p/net_node.cpp')
0 files changed, 0 insertions, 0 deletions