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

Stop reusing fd #1752

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Stop reusing fd #1752

merged 1 commit into from
Feb 8, 2024

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Feb 8, 2024

An error is reported in ruby CI.

Error: test_file?(FileTestSingletonTest): Errno::EBADF: Bad file descriptor
  test/stdlib/FileTest_test.rb:13:in `close'

We find there are reusing a fd in test. So, we assume the EBADF is happening by:

  1. sysopen in IO_test returns a file descriptor N
  2. N is passed to two IO.open calls during test
  3. The first IO instance is closed by GC, but the second one is still alive
  4. The sysopen in FileTest_test returns N, so another IO instance with the file descriptor is created
  5. There are two IO instances associated to N, one created in IO_test, other created in FileTest_test
  6. IO is closed by GC successfully, because N is opened in FileTest_test
  7. Calling close in FileTest_test raises an error, because N is already closed

We hope this fix solves the problem. 🤞

@soutaro soutaro added this to the RBS 3.5 milestone Feb 8, 2024
@soutaro soutaro added this pull request to the merge queue Feb 8, 2024
Merged via the queue into master with commit 3b4b710 Feb 8, 2024
15 checks passed
@soutaro soutaro deleted the fix-ebadf branch February 8, 2024 13:36
soutaro added a commit that referenced this pull request Feb 8, 2024
@soutaro soutaro mentioned this pull request Feb 8, 2024
soutaro added a commit that referenced this pull request Feb 8, 2024
@soutaro soutaro added the Released PRs already included in the released version label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

1 participant