Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deadlock in bitswap sessions #4407

Merged
merged 1 commit into from
Nov 21, 2017
Merged

fix deadlock in bitswap sessions #4407

merged 1 commit into from
Nov 21, 2017

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Nov 21, 2017

This deadlock would happen when calling SessionsForBlock (holding bitswap.sessLk) while the session's main loop was trying to deregister the session (taking bitswap.sessLk).

I've also defensively added selects on contexts for two other channel writes just in case.

fixes #4394

...well, it fixes a deadlock showing up in that issue, there may be more.

@ghost ghost assigned Stebalien Nov 21, 2017
@ghost ghost added the status/in-progress In progress label Nov 21, 2017
@Stebalien
Copy link
Member Author

Stebalien commented Nov 21, 2017

Interesting error (unrelated, reported #4408):

make: *** [test/sharness/t0088-repo-stat-symlink.sh] Error 1
make: *** Waiting for unfinished jobs....
*** test/sharness/t0088-repo-stat-symlink.sh ***
# TEST_VERBOSE=1
# TEST_NO_FUSE=1
# TEST_NO_PLUGIN=
# TEST_EXPENSIVE=1
# TEST_OS=LINUX
expecting success: 
  mkdir sym_link_target &&
  ln -s sym_link_target .ipfs

ok 1 - create symbolic link for IPFS_PATH

expecting success: 
    export IPFS_PATH="$(pwd)/.ipfs" &&
    ipfs init --profile=test -b=1024 > /dev/null
  
ok 2 - ipfs init succeeds

expecting success: 
    mkdir mountdir ipfs ipns &&
    test_config_set Mounts.IPFS "$(pwd)/ipfs" &&
    test_config_set Mounts.IPNS "$(pwd)/ipns" ||
    test_fsh cat "\"$IPFS_PATH/config\""
  
ipfs config  "Mounts.IPFS" "/go/src/github.com/ipfs/go-ipfs/test/sharness/trash directory.t0088-repo-stat-symlink.sh/ipfs"
ipfs config  "Mounts.IPNS" "/go/src/github.com/ipfs/go-ipfs/test/sharness/trash directory.t0088-repo-stat-symlink.sh/ipns"
ok 3 - prepare config -- mounting

expecting success: 
  export IPFS_PATH="sym_link_target" &&
  reposize_direct=$(ipfs repo stat | grep RepoSize | awk '{ print $2 }') &&
  export IPFS_PATH=".ipfs" &&
  reposize_symlink=$(ipfs repo stat | grep RepoSize | awk '{ print $2 }') &&
  test $reposize_symlink -ge $reposize_direct

not ok 4 - 'ipfs repo stat' RepoSize is correct with sym link
#	
#	  export IPFS_PATH="sym_link_target" &&
#	  reposize_direct=$(ipfs repo stat | grep RepoSize | awk '{ print $2 }') &&
#	  export IPFS_PATH=".ipfs" &&
#	  reposize_symlink=$(ipfs repo stat | grep RepoSize | awk '{ print $2 }') &&
#	  test $reposize_symlink -ge $reposize_direct
#	

# failed 1 among 4 test(s)
1..4
test/sharness/Rules.mk:31: recipe for target 'test/sharness/t0088-repo-stat-symlink.sh' failed

This deadlock would happen when calling SessionsForBlock (holding
bitswap.sessLk) while the session's main loop was trying to deregister the
session (taking bitswap.sessLk).

I've also defensively added selects on contexts for two other channel writes
just in case.

fixes #4394

...well, it fixes *a* deadlock showing up in that issue, there may be more.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
@whyrusleeping whyrusleeping merged commit 33c8207 into master Nov 21, 2017
@whyrusleeping whyrusleeping deleted the fix/4394 branch November 21, 2017 23:21
@ghost ghost removed the status/in-progress In progress label Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPFS pin hangs despite available providers for content
3 participants