Skip to content

[ProgPow] Make starting multiple threads work#834

Merged
codeofalltrades merged 1 commit intoVeil-Project:1.1.0from
CaveSpectre11:1.1-propow-hack
Aug 22, 2020
Merged

[ProgPow] Make starting multiple threads work#834
codeofalltrades merged 1 commit intoVeil-Project:1.1.0from
CaveSpectre11:1.1-propow-hack

Conversation

@CaveSpectre11
Copy link
Collaborator

Problem

Starting multiple ProgPoW threads crashes deep in the depths of the algorithm:

ethash::(anonymous namespace)::fnv1 (v=..., u=...) at crypto/ethash/lib/ethash/ethash.cpp:44
44              r.word32s[i] = fnv1(u.word32s[i], v.word32s[i]);
(gdb) bt
#0  ethash::(anonymous namespace)::fnv1 (v=..., u=...) at crypto/ethash/lib/ethash/ethash.cpp:44
#1  ethash::item_state::update (round=180, this=0xffffcfffbe00) at crypto/ethash/lib/ethash/ethash.cpp:203
#2  ethash::calculate_dataset_item_2048 (context=..., index=<optimized out>) at crypto/ethash/lib/ethash/ethash.cpp:245
#3  0x0000aaaaab16d350 in progpow::(anonymous namespace)::round (    lookup=0xaaaaab16b920 <ethash::calculate_dataset_item_2048(ethash_epoch_context const&, unsigned int)>, state=..., mix=..., r=62,  context=...) at crypto/ethash/lib/ethash/progpow.cpp:165
#4  progpow::(anonymous namespace)::hash_mix (context=..., block_number=block_number@entry=24121, seed=seed@entry=0xffffcfffcbb8, lookup=0xaaaaab16b920 <ethash::calculate_dataset_item_2048(ethash_epoch_context const&, unsigned int)>) at crypto/ethash/lib/ethash/progpow.cpp:257
#5  0x0000aaaaab16da9c in progpow::hash (context=..., block_number=24121, header_hash=..., nonce=<optimized out>) at crypto/ethash/lib/ethash/progpow.cpp:310
#6  0x0000aaaaab0f5bd0 in ProgPowHash (blockHeader=..., mix_hash=...) at /usr/include/c++/9/bits/unique_ptr.h:360

Root Cause

Unknown

Egregious hack to make it work

The problem occurs when you start multiple threads on the outset. generatecontinuous true 2 for example. The problem does not occur if you start one thread on the outset. Furthermore, if you start one thread, stop it (generatecontinuous false), then you start multiple threads, it works.

So after a ton of digging into the root cause and not being able to reveal any leads on the true issue; this hack was put in so that it will just work. The 'hack', does what was found to work; If ProgPoW, start one dummy thread for a second, then tear it down and start up the working threads.

This (obviously) is not a final solution, or a pretty solution, or even anything that's very safe. But for the time being it's all I got to clear the roadblock.

Any other ideas are more than welcome.

@CaveSpectre11 CaveSpectre11 added Tag: PoW Related to Proof of Work consensus Tag: Segfault This issue causes the application to crash. Tag: Waiting For Code Review Waiting for code review from a core developer Algo: ProgPow labels Aug 22, 2020
@CaveSpectre11 CaveSpectre11 added this to the v1.1.0 milestone Aug 22, 2020
@CaveSpectre11 CaveSpectre11 self-assigned this Aug 22, 2020
Copy link
Collaborator

@codeofalltrades codeofalltrades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 554d80b
starting and stopping the wallet is much improved.

@codeofalltrades codeofalltrades merged commit 879dff9 into Veil-Project:1.1.0 Aug 22, 2020
@CaveSpectre11 CaveSpectre11 deleted the 1.1-propow-hack branch October 4, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Algo: ProgPow Tag: PoW Related to Proof of Work consensus Tag: Segfault This issue causes the application to crash. Tag: Waiting For Code Review Waiting for code review from a core developer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants