-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
CI: Fails "raises no error when another thread closes a socket" #4694
Comments
It seems that the stubbed method is removed is unstable in https://github.com/rr/rr/blob/master/doc/03_api_overview.md#stub
The stub is intended to replace the method.
If I add diff --git a/test/plugin/out_forward/test_ack_handler.rb b/test/plugin/out_forward/test_ack_handler.rb
index 8264e4ac..8cf3cc31 100644
--- a/test/plugin/out_forward/test_ack_handler.rb
+++ b/test/plugin/out_forward/test_ack_handler.rb
@@ -111,6 +111,7 @@ class AckHandlerTest < Test::Unit::TestCase
r, w = IO.pipe
begin
w.write(chunk_id)
+ def r.recv(*args) ; end
stub(r).recv { |_|
sleep(1) # To ensure that multiple threads select the socket before closing.
raise IOError, 'stream closed in another thread' if r.closed? The test was successful even after repeating it at least 500 times. |
I think there is no need to use stub method. diff --git a/test/plugin/out_forward/test_ack_handler.rb b/test/plugin/out_forward/test_ack_handler.rb
index 8264e4ac..9246da86 100644
--- a/test/plugin/out_forward/test_ack_handler.rb
+++ b/test/plugin/out_forward/test_ack_handler.rb
@@ -111,11 +111,11 @@ class AckHandlerTest < Test::Unit::TestCase
r, w = IO.pipe
begin
w.write(chunk_id)
- stub(r).recv { |_|
+ def r.recv(arg)
sleep(1) # To ensure that multiple threads select the socket before closing.
- raise IOError, 'stream closed in another thread' if r.closed?
+ raise IOError, 'stream closed in another thread' if self.closed?
MessagePack.pack({ 'ack' => Base64.encode64('chunk_id 111') })
- }
+ end
ack.enqueue(r)
threads = [] |
Thanks for investigating this! |
Describe the bug
Sometimes, "raises no error when another thread closes a socket" in
test_ack_handler.rb
will be failedTo Reproduce
Run tests repeatedly using rake tasks like the following.
It may be easier to reproduce with the older Ruby.
Expected behavior
No errors
Your Environment
Your Configuration
Your Error Log
See "To Reproduce" section
Additional context
No response
The text was updated successfully, but these errors were encountered: