10000 OrderedWalk is not thread-safe · Issue #40 · heimdalr/dag · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

OrderedWalk is not thread-safe #40

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? 7F18 Sign in to your account

Open
zioc opened this issue Mar 11, 2025 · 0 comments
Open

OrderedWalk is not thread-safe #40

zioc opened this issue Mar 11, 2025 · 0 comments

Comments

@zioc
Copy link
zioc commented Mar 11, 2025

Calling OrderedWalk alongside with other dag operations may lead to deadlock as described in this issue

OrderedWalk acquires an RLock and calls GetParents that is also acquiring an RLock.

This may lead to deadlocks if another goroutine acquires a RWLock in the meantime. The rwmutex documentation clearly explains that pitfall:

If any goroutine calls RWMutex.Lock while the lock is already held by one or more readers,
concurrent calls to RWMutex.RLock will block until the writer has acquired (and released) the lock,
to ensure that the lock eventually becomes available to the writer. Note that this prohibits
recursive read-locking. A RWMutex.RLock cannot be upgraded into a RWMutex.Lock, nor can a
RWMutex.Lock be downgraded into a RWMutex.RLock.

Rlock function doc also explicitely stands that:

It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type.
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

No branches or pull requests

1 participant
0