kubo/core
Jorropo bb020ea1ef fix: deadlock while racing ipfs dag import and ipfs repo gc
This fixes a deadlock introduced in 1457b4fd4a.

We can't use the coreapi here because it will try to take the PinLock (RLock) again, so revert this small part of 1457b4fd4a.

This used cause a deadlock when concurrently running `ipfs dag import` concurrently with the GC.

The bug is that `ipfs dag import` takes an RLock with the PinLock.
*the cars are imported, leaving a wide window of time*
Then GC Takes a Lock on that same RWMutex while taking the GC Lock (it  blocks because it waits for the RLock to be released).
Then the car imports are finished and `ipfs dag import` tries to aqcuire the PinLock (doing an RLock) again in `Api().Pin`.

However at this point the RWMutex is starved, the runtime put a fence in front of RLocks if a Lock has been waiting for too lock (else you could have an endless stream of RLock / RUnlock forever delaying a Lock to ever go through).

The issue is that `ipfs dag import`'s original RLock which is blocking everyone will be released once it returns, which only happens when `Api().Pin` completes.

So we have a deadlock (ABA kind ?), because `ipfs dag import` waits on the GC Lock, which waits on `ipfs dag import`.

Calling the Pinner directly does not acquire the PinLock again, and thus does not have this issue.
2023-03-26 05:40:18 +02:00
..
bootstrap chore: bump go-libp2p v0.22.0 & go1.18&go1.19 2022-09-09 17:09:38 +02:00
commands fix: deadlock while racing ipfs dag import and ipfs repo gc 2023-03-26 05:40:18 +02:00
coreapi feat(pinning): connect some missing go context (#9557) 2023-02-22 16:56:59 +01:00
corehttp fix: canonicalize user defined headers 2023-03-17 23:40:35 +01:00
corerepo refactor: rename to kubo 2022-07-06 18:40:37 +02:00
coreunix feat(pinning): connect some missing go context (#9557) 2023-02-22 16:56:59 +01:00
mock chore: bump go-libp2p v0.22.0 & go1.18&go1.19 2022-09-09 17:09:38 +02:00
node fix: future proof with > rcmgr.DefaultLimit for new enum rcmgr values 2023-03-16 13:41:24 +01:00
.gitignore ignore testdb 2014-07-05 15:04:04 -07:00
builder.go fix: silence staticcheck warning for fx.Extract usage 2022-12-12 03:47:17 +01:00
core_test.go feat: Routing.Type=auto (DHT+IPNI) (#9475) 2022-12-08 23:20:24 +01:00
core.go feat: Delegated routing with custom configuration. (#9274) 2022-09-22 15:47:45 +02:00