Commit Graph

17 Commits

Author SHA1 Message Date
SChernykh c742fa4c6e 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.
2023-03-29 08:44:20 +02:00
SChernykh f456b3f023 Demote large pages warning to `mdebug` 2023-01-17 18:16:47 +01:00
SChernykh 480b050cc3 RandomX: print VM allocation warnings only once 2023-01-11 19:18:41 +01:00
SChernykh f698f2b708 Refactored rx-slow-hash.c
- Straight-forward call interface: `void rx_slow_hash(const char *seedhash, const void *data, size_t length, char *result_hash)`
- Consensus chain seed hash is now updated by calling `rx_set_main_seedhash` whenever a block is added/removed or a reorg happens
- `rx_slow_hash` will compute correct hash no matter if `rx_set_main_seedhash` was called or not (the only difference is performance)
- New environment variable `MONERO_RANDOMX_FULL_MEM` to force use the full dataset for PoW verification (faster block verification)
- When dataset is used for PoW verification, dataset updates don't stall other threads (verification is done in light mode then)
- When mining is running, PoW checks now also use dataset for faster verification
2022-12-14 07:21:00 +01:00
mj-xmr da9aa1f7f8
Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
moneromooo-monero 06e6c8bf4a
crypto: fix constant randomx exceptions in large page allocator
If allocating large pages fails, we don't try again.
This has the obvious drawback of not being able to use large pages
if they fail once.
2022-02-19 13:15:10 +00:00
Howard Chu 86263b386c
Honor LARGE_PAGES flag in randomx umask 2021-02-11 14:42:49 +00:00
moneromooo-monero 6a0b3b1f8a
functional_tests: add randomx tests 2020-08-27 15:13:03 +00:00
SomaticFanatic 5ef0607da6 Update copyright year to 2020
Update copyright year to 2020
2020-05-06 22:36:54 -04:00
luigi1111 0253f86fde
Merge pull request #6298
fe92fa1 [randomx] Add missing randomx_vm_set_cache() (cohcho)
2020-03-31 13:36:21 -05:00
cohcho fe92fa1391 [randomx] Add missing randomx_vm_set_cache() 2020-01-17 19:25:26 +00:00
Howard Chu c361303184
Silence miner debugmsg spam
Don't try to allocate the dataset repeatedly if it has already failed.
2019-12-09 15:59:52 +00:00
tevador ea813cfb1b RandomX: update to v1.1.4
* Faster cache initialization with SSSE3/AVX2
* Automatic detection of CPU capabilities in RandomX
* Fixed a possible out-of-bounds access in superscalar program generator
* Use MONERO_RANDOMX_UMASK to manually disable RandomX flags in monerod
2019-10-13 18:43:27 +02:00
Howard Chu f54301dd75
Fix for miners on reorg
Make sure dataset gets re-init'd if a reorg changes the epoch
2019-10-07 09:50:00 +01:00
Howard Chu 2675cf4483
Update to RandomX v1.1.3, simplify
We don't need to detect if the cache has changed, just always
call to set it on the VM. The call will be a no-op if the cache
hasn't changed.
2019-10-05 18:51:20 +01:00
Howard Chu 1c600a492f
Fix randomx cache selection for RPCs
Was using the wrong cache slot, and returning invalid PoW hashes to RPC clients
2019-10-03 20:05:17 +01:00
Howard Chu 81c2ad6d5b
RandomX integration
Support RandomX PoW algorithm
2019-09-25 21:29:42 +01:00