Skip to content

Conversation

@osyoyu
Copy link
Contributor

@osyoyu osyoyu commented Nov 26, 2025

Resolves #179.

IO#wait, a method to obtain the number of bytes readable without blocking, has been removed from io/wait.
ruby/io-wait@1decadc

When WEBrick is combined with io.wait >= 0.4.0, the following error occurs on shutdown:

ERROR NoMethodError: undefined method 'nread' for an instance of IO
    /(snip)/webrick-1.9.1/lib/webrick/server.rb:178:in 'block in WEBrick::GenericServer#start'

WEBrick uses IO#nread to efficiently consume the entire input stream during shutdown. This patch removes the call to IO#nread, and instead repeatedly take a fixed size of 8 bytes each iteration.

IO#wait, a method to obtain the number of bytes readable without
blocking, has been removed from io/wait.
ruby/io-wait@1decadc

When WEBrick is combined with io.wait >= 0.4.0, the following error
occurs on shutdown:

    ERROR NoMethodError: undefined method 'nread' for an instance of IO
        /(snip)/webrick-1.9.1/lib/webrick/server.rb:178:in 'block in WEBrick::GenericServer#start'

WEBrick uses IO#nread to efficiently consume the entire input stream
during shutdown. This patch removes the call to IO#nread, and instead
repeatedly take a fixed size of 8 bytes each iteration.
@osyoyu osyoyu marked this pull request as draft November 26, 2025 05:43
@osyoyu
Copy link
Contributor Author

osyoyu commented Nov 26, 2025

Tests now pass on my laptop.

Finished in 3.438834 seconds.
--------------------------------------------------------------------------------------------------------------------------------------
152 tests, 816 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
--------------------------------------------------------------------------------------------------------------------------------------
44.20 tests/s, 237.29 assertions/s

@osyoyu osyoyu marked this pull request as ready for review November 26, 2025 05:44
@hsbt
Copy link
Member

hsbt commented Nov 26, 2025

👍 Good catch.

@hsbt hsbt merged commit 9a59373 into ruby:master Nov 26, 2025
21 checks passed
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.

testsuite fail with ruby 4.0.0dev (2025-11-13) with undefined method 'nread'

2 participants