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 NetworkLogger #312

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

kabiroberai
Copy link
Contributor

👋 This PR fixes a deadlock that could occur if logTaskCreated was called with a task that already existed.

IMO it would be best to update this code to use safer primitives like withLock (and ultimately drop the @unchecked Sendable by using Concurrency-friendly APIs like os.OSAllocatedUnfairLock, Synchronization.Mutex, or ConcurrencyExtras.LockIsolated) — but that's a larger change so I haven't endeavored to do that atm.

@kean
Copy link
Owner

kean commented Dec 18, 2024

Nice catch, thank you!

it would be best to update this code to use safer primitives like withLock

My plan is to synchronize the background work on a single global actor.

@kean kean merged commit 07cad09 into kean:main Dec 18, 2024
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.

2 participants