This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Fix ancient blocks queue deadlock#8751
Merged
Merged
Conversation
This reverts commit d193436.
niklasad1
reviewed
Jun 1, 2018
| &*client.chain.read() | ||
| ).map(|_| ()).unwrap_or_else(|e| { | ||
| error!(target: "client", "Error importing ancient block: {}", e); | ||
| }); |
Collaborator
There was a problem hiding this comment.
consider to use .ok().map_or_else here instead of map().unwrap_or_else
andresilva
approved these changes
Jun 5, 2018
Contributor
andresilva
left a comment
There was a problem hiding this comment.
LGTM! Although I don't totally understand what was causing the deadlock (why would fun be recursing?).
sorpaas
approved these changes
Jun 5, 2018
5chdn
added a commit
that referenced
this pull request
Jun 5, 2018
* parity-version: bump beta to 1.11.3 * Disallow unsigned transactions in case EIP-86 is disabled (#8802) * Disallow unsigned transactions in case EIP-86 is disabled * Add tests for verification * Add disallow unsigned transactions test in machine * Fix ancient blocks queue deadlock (#8751) * Revert "Fix not downloading old blocks (#8642)" This reverts commit d193436. * Make sure only one thread actually imports old blocks. * Add some trace timers. * Bring back pending hashes set. * Separate locks so that queue can happen while we are importing. * Address grumbles.
ordian
added a commit
to ordian/parity
that referenced
this pull request
Jun 6, 2018
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: Remove UI related settings from CLI (openethereum#8783) Remove windows tray and installer (openethereum#8778) docs: add changelogs for 1.10.6 and 1.11.3 (openethereum#8810) Fix ancient blocks queue deadlock (openethereum#8751) Disallow unsigned transactions in case EIP-86 is disabled (openethereum#8802) Fix evmbin compilation (openethereum#8795) Have space between feature cfg flag (openethereum#8791) rpc: fix address formatting in TransactionRequest Display (openethereum#8786)
dvdplm
added a commit
that referenced
this pull request
Jun 7, 2018
…eric * origin/master: ethcore: fix ancient block error msg handling (#8832) CI: Fix docker tags (#8822) parity: fix indentation in sync logging (#8794) Removed obsolete IpcMode enum (#8819) Remove UI related settings from CLI (#8783) Remove windows tray and installer (#8778) docs: add changelogs for 1.10.6 and 1.11.3 (#8810) Fix ancient blocks queue deadlock (#8751) Disallow unsigned transactions in case EIP-86 is disabled (#8802) Fix evmbin compilation (#8795) Have space between feature cfg flag (#8791) rpc: fix address formatting in TransactionRequest Display (#8786) Conditionally compile ethcore public test helpers (#8743) Remove Result wrapper from AccountProvider in RPC impls (#8763) Update `license header` and `scripts` (#8666)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A more generic solution proposed by @ngotchac is replaced with a solution that handles only ancient blocks.
The problem with previous solution was that
queue.lock().pop_front()was actually holding the lock for longer then needed and iffunwas trying to use the queue recursively it would deadlock (since parking_lot mutexes are not re-entrant).Avoiding holding the lock would cause race issues and we need to be super sure that old blocks are imported in order by the same thread.
Hence I reverted to the old
IoChannelQueueimplementation and introduced a separateimport_lockfor ancient blocks. We don't lock on the queue to prevent blocking the event loop when adding new items.