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 double actualClose call #4680

Merged
merged 1 commit into from
Feb 16, 2025
Merged

Conversation

Thomas-Vos
Copy link
Contributor

@Thomas-Vos Thomas-Vos commented Feb 14, 2025

The actualClose call could be called twice due to race condition when closing. Seems highly unlikely, but this could cause a descriptor to be closed twice, causing errors.

This piece of code was moved from JVM, where a double actualClose call would not have caused an issue (because closing jvm channel twice is ok), but on Native closing a descriptor twice is a serious issue.

Was able to reproduce this issue by adding runBlocking { delay(1000) } on line 85 just before checkChannels() call

@e5l
Copy link
Member

e5l commented Feb 16, 2025

Hey @Thomas-Vos, thanks for the PR! Merged

@e5l e5l merged commit a813f5c into ktorio:main Feb 16, 2025
14 of 16 checks passed
bjhham pushed a commit that referenced this pull request Feb 19, 2025
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