Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

storage: fix possible hasherstore deadlock on waitC channel #1674

Merged
merged 1 commit into from
Aug 16, 2019

Conversation

janos
Copy link
Member

@janos janos commented Aug 16, 2019

This is a propsed solution for fixing a possible deadlock on hasherstore. It is possible that multiple errors are sent to the waitC channel, but that channel is red only once. This is causing deadlocks on:

goroutine 27052665 [chan send, 93 minutes]:
github.com/ethersphere/swarm/storage.(*hasherStore).startWait(0xc0034480e0, 0x12854c0, 0xc00399e0f0)
        /swarm/build/_workspace/src/github.com/ethersphere/swarm/storage/hasherstore.go:155 +0x23b
created by github.com/ethersphere/swarm/storage.(*hasherStore).Put.func1
        /swarm/build/_workspace/src/github.com/ethersphere/swarm/storage/hasherstore.go:98 +0x50

and

goroutine 28380920 [select, 93 minutes]:
github.com/ethersphere/swarm/storage.(*hasherStore).storeChunk.func1(0xc0034480e0, 0x12854c0, 0xc00399e0f0, 0x1285a40, 0xc002f8d340)
        /swarm/build/_workspace/src/github.com/ethersphere/swarm/storage/hasherstore.go:279 +0x187
created by github.com/ethersphere/swarm/storage.(*hasherStore).storeChunk
        /swarm/build/_workspace/src/github.com/ethersphere/swarm/storage/hasherstore.go:270 +0xa5

goroutines.txt.gz

This change makes only possible to have one send to the waitC. But could it maybe create logical problems that I do not see? Please, review.

@janos janos requested review from zelig, jmozah and acud August 16, 2019 09:56
@jmozah
Copy link
Collaborator

jmozah commented Aug 16, 2019

LGTM

@zelig zelig merged commit 60d07de into master Aug 16, 2019
@skylenet skylenet added this to the 0.5.0 milestone Aug 16, 2019
@holisticode holisticode deleted the hasherstore-deadlock-fix branch September 2, 2019 15:22
chadsr added a commit to chadsr/swarm that referenced this pull request Sep 23, 2019
* 'master' of github.com:ethersphere/swarm:
  chunk, storage: chunk.Store multiple chunk Put (ethersphere#1681)
  storage: fix pyramid chunker and hasherstore possible deadlocks (ethersphere#1679)
  pss: Use distance to determine single guaranteed recipient (ethersphere#1672)
  storage: fix possible hasherstore deadlock on waitC channel (ethersphere#1674)
  network: Add adaptive capabilities message (ethersphere#1619)
  p2p/protocols, p2p/testing; conditional propagation of context (ethersphere#1648)
  api/http: remove unnecessary conversion (ethersphere#1673)
  storage: fix LazyChunkReader.join potential deadlock (ethersphere#1670)
  HTTP API support for pinning contents (ethersphere#1658)
  pot: Add Distance methods with tests (ethersphere#1621)
  README.md: Update Vendored Dependencies section (ethersphere#1667)
  network, p2p, vendor: move vendored p2p/testing under swarm (ethersphere#1647)
  build, vendor: use go modules for vendoring (ethersphere#1532)
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.

None yet

5 participants