-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
system
hangs if file does not exist
#351
Comments
I could not reproduce from the given example.
Can you confirm I've got the correct reproduction script? |
I tried to reproduce the original error but couldn't: #!/usr/bin/env ruby
require "minitest/autorun"
require "async"
class Test < Minitest::Test
BIG_TEXT_A = "The quick brown fox jumps over the lazy dog.\n" * 10
BIG_TEXT_B = BIG_TEXT_A.dup.sub("quick", "slow")
def test_diff
Async do |task|
assert_equal(BIG_TEXT_A, BIG_TEXT_B)
end
end
end I added some instrumentation to the scheduler # Wait for the specified process ID to exit.
# @parameter pid [Integer] The process ID to wait for.
# @parameter flags [Integer] A bit-mask of flags suitable for `Process::Status.wait`.
# @returns [Process::Status] A process status instance.
# @asynchronous May be non-blocking..
def process_wait(pid, flags)
return @selector.process_wait(Fiber.current, pid, flags).tap{|result|
Fiber.blocking{$stderr.puts "process_wait(#{pid}, #{flags}) -> #{result.inspect}"}
}
end It appears to work okay:
|
Is it possible something in your test suite is monkey patching |
Interesting, this is breaking for me:
It hangs right there. I am not doing any monkey patching. This was also hanging for me inside of a GitHub action for Ubuntu and Ruby 3.3 (but not 3.1 I don't think). I will do some more investigation, possibly including a simple repository that replicates the issue with a simple GitHub action, and get back. (may be a bit, I am traveling) |
I was also able to make it hang on that. # issue-351.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'async'
end
Async do
puts "Running on: #{RbConfig::CONFIG['host_os']}"
res = system 'echo', 'hello'
puts "Result 1: #{res}"
res = system 'does-not-exist', 'hello'
puts "Result 2: #{res}"
end My output was: note where I hit Ctrl-C and it got output, and then the first word
See Bundler inline docs. |
lol, I cannot reproduce, I tried Okay, can you please tell me:
|
For me it's:
|
In Async v2.19, I've introduced more debug output: https://socketry.github.io/async/releases/index#async::scheduler-debugging Can one of you run the hanging example with If it's not too verbose, it might also be useful to see the output generated by Thanks. |
This appears to be a problem in Ruby |
See ruby/ruby#12052 for a possible fix. |
If you run
system
insideAsync
with a non-existent executable on Linux with Ruby 3.3 it hangs. This behavior is confirmed in 2.17.0 and 2.18.0 (I didn't check any earlier than that).This synchronous code works:
And outputs:
But this code does not:
This hangs on the second
system
call. This was discovered after a deep dive of whyMinitest
assert_equal
was hanging. It turns out, Minitest usesdiff
on the system when reporting anassert_equal
failure, but first checks forgdiff
which we don't have, ref: https://github.com/minitest/minitest/blob/e4417c5b13ab917a60c218700041152136bc07c8/lib/minitest/assertions.rb#L33. So we have toMinitest::Assertions.diff = 'diff'
to getAsync
-based tests to not break here.(sorry if this is already reported, I could not find an issue)
The text was updated successfully, but these errors were encountered: