Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

ethcore/private-tcx: fix deadlock caused by conflicting lock order #11764

Merged
merged 1 commit into from
Jun 18, 2020

Conversation

BurtonQin
Copy link
Contributor

This PR fixes a deadlock caused by conflicting lock order in ethcore/private-tcx/src/state_store.rs

add_request state_sync_completed
requests.write()
syncing_hashes.write()
mark_hash_ready()
requests.write()//deadlock!
syncing_hashes.write()//deadlock!

https://github.com/openethereum/openethereum/blob/1b0bbd50a4b75d25b52961f34dcccd5836a07c97/ethcore/private-tx/src/state_store.rs#L75-L79
https://github.com/openethereum/openethereum/blob/1b0bbd50a4b75d25b52961f34dcccd5836a07c97/ethcore/private-tx/src/state_store.rs#L93-L97

The fix is to lift the syncing_hashes.write() before requests.write() in add_request().
But I am not sure if this lock order is correct.

@vorot93 vorot93 requested a review from grbIzl June 18, 2020 02:19
Copy link
Collaborator

@grbIzl grbIzl left a comment

Choose a reason for hiding this comment

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

Thanks for the change!

@vorot93 vorot93 merged commit bedbff5 into openethereum:master Jun 18, 2020
dvdplm added a commit that referenced this pull request Jun 30, 2020
* master:
  Update parity-crypto dependency (#11791)
  ethcore/private-tcx: fix deadlock caused by conflicting lock order (#11764)
  Feature/publish draft release ci (#11786)
  Trigger custom docker build when adding ci-build-docker to the commit (#11782)
  Fix alpine docker image entry point (#11749)
  Use BigUint::modpow for ModExp precompile (#11772)
  Add YOLO-1 testnet (#11757)
  Upgrade num to 0.2, use enum-primitive-derive (#11636)
  Update Simple Subroutines to the latest spec  (#11731)
  update secret-store reference (#11761)
  Implementation of EIP 2537 (#11707)
  Add missing forks to fork ID (#11747)
  Use nightly tag for master branch (#11732)
dvdplm added a commit that referenced this pull request Jun 30, 2020
…ereum/openethereum into dp/chore/upgrade-to-rocksdb-0.14

* 'dp/chore/upgrade-to-rocksdb-0.14' of github.com:openethereum/openethereum:
  Update parity-crypto dependency (#11791)
  ethcore/private-tcx: fix deadlock caused by conflicting lock order (#11764)
  Feature/publish draft release ci (#11786)
  Trigger custom docker build when adding ci-build-docker to the commit (#11782)
  Fix alpine docker image entry point (#11749)
  Use BigUint::modpow for ModExp precompile (#11772)
  Add YOLO-1 testnet (#11757)
  Upgrade num to 0.2, use enum-primitive-derive (#11636)
  Update Simple Subroutines to the latest spec  (#11731)
  update secret-store reference (#11761)
  Implementation of EIP 2537 (#11707)
  Add missing forks to fork ID (#11747)
  Use nightly tag for master branch (#11732)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants