Skip to content

Return false from io_wait() for timeouts - #472

Merged
samuel-williams-shopify merged 2 commits into
mainfrom
io-wait-timeout-false
Aug 28, 2026
Merged

Return false from io_wait() for timeouts#472
samuel-williams-shopify merged 2 commits into
mainfrom
io-wait-timeout-false

Conversation

@tavianator

Copy link
Copy Markdown
Contributor

Callers of rb_io_wait() expect a false return value for timeouts,
not nil. This could lead to very strange errors from code like

TCPSocket.new("192.0.2.1", 80, connect_timeout: 1)

which would raise

TypeError: no implicit conversion from nil to integer

It now raises the correct

IO::TimeoutError: user specified timeout for 192.0.2.1:80

Types of Changes

  • Bug fix.

Contribution

Callers of `rb_io_wait()` expect a `false` return value for timeouts,
not nil.  This could lead to very strange errors from code like

    TCPSocket.new("192.0.2.1", 80, connect_timeout: 1)

which would raise

    TypeError: no implicit conversion from nil to integer

It now raises the correct

    IO::TimeoutError: user specified timeout for 192.0.2.1:80
@tavianator
tavianator force-pushed the io-wait-timeout-false branch from 9c9ad0d to 83bd43e Compare August 28, 2026 18:00
Assisted-By: devx/5ab61f1c-bb1a-47a2-937a-b53ce39bb329

@samuel-williams-shopify samuel-williams-shopify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@samuel-williams-shopify
samuel-williams-shopify merged commit 24633aa into main Aug 28, 2026
77 of 81 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the io-wait-timeout-false branch August 28, 2026 22:12
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