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

Ruby 3.0 support #173

Closed
voxik opened this issue Feb 3, 2021 · 10 comments
Closed

Ruby 3.0 support #173

voxik opened this issue Feb 3, 2021 · 10 comments

Comments

@voxik
Copy link
Contributor

voxik commented Feb 3, 2021

There is test failure testing on Ruby 3.0:

  1) ChildProcess can write to stdin interactively if duplex = true
     Failure/Error: raise msg
     
     RuntimeError:
       timed out after 10 seconds:
       expected "hello\ncat: -: Resource temporarily unavailable\n" to match /\Ahello\r?\n\z/m
       Diff:
       @@ -1,2 +1,3 @@
       -/\Ahello\r?\n\z/m
       +hello
       +cat: -: Resource temporarily unavailable
       
     # ./spec/spec_helper.rb:197:in `wait_until'
     # ./spec/io_spec.rb:121:in `block (2 levels) in <top (required)>'

Any chance to get this fixed please?

@voxik
Copy link
Contributor Author

voxik commented Feb 3, 2021

It seems that the problem might be some race condition, since this works:

$ rspec ./spec/io_spec.rb
..........

Finished in 0.79139 seconds (files took 0.07509 seconds to load)
10 examples, 0 failures

@voxik
Copy link
Contributor Author

voxik commented Feb 3, 2021

Ah, forgot to include the CHILDPROCESS_POSIX_SPAWN=true, so it doesn't work indeed.

@voxik
Copy link
Contributor Author

voxik commented Feb 3, 2021

This was the last successful build:

https://travis-ci.org/github/enkessler/childprocess/jobs/687662868

and this is where the issue first appeared:

https://travis-ci.org/github/enkessler/childprocess/jobs/698756797

@voxik
Copy link
Contributor Author

voxik commented Feb 3, 2021

So the cat: -: Resource temporarily unavailable is reported from here:

ret = Lib.posix_spawnp(
pid_ptr,
@args.first, # TODO: not sure this matches exec() behaviour
actions,
attrs,
argv,
envp
)

called from here:

process.start

Checking what was changed in Ruby, this is susceptible commit:

ruby/ruby@0e3b0fc

But that might be completely false lead 😇

@voxik
Copy link
Contributor Author

voxik commented Feb 3, 2021

This seems to be the root cause, the change from RUBY_PIPE_NONBLOCK_DEFAULT, which was 0, to O_NONBLOCK. I have locally replaced the O_NONBLOCK by 0 and the test suite passes.

Unfortunately, other test case fails then:

  1) ChildProcess lets a detached child live on
     Failure/Error: expect(alive?(c_pid)).to be true
     
       expected true
            got false
     # ./spec/childprocess_spec.rb:214:in `block (2 levels) in <top (required)>'

@voxik
Copy link
Contributor Author

voxik commented Feb 3, 2021

I have reported this against Ruby:

https://bugs.ruby-lang.org/issues/17607

@eregon
Copy link
Contributor

eregon commented Feb 16, 2021

I wonder if #172 / #175 might solve this. At least CHILDPROCESS_UNSET=should-be-unset bundle exec rake passes for me on that PR with Ruby 3.0.0.

@eregon
Copy link
Contributor

eregon commented Feb 16, 2021

Confirmed that #175 (comment) actually fixes the CI on ruby-head (the only ruby-head CI failing is then due to installing FFI, which is unrelated and no longer needed with that PR).

@voxik
Copy link
Contributor Author

voxik commented Feb 18, 2021

Thx, the test suite passes with #175. Nevertheless, I'd still like to also understand the reasons why it started to fail, although it will have smaller priority 😇

@sds
Copy link
Collaborator

sds commented Jan 7, 2024

Closed by #175.

@sds sds closed this as completed Jan 7, 2024
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

No branches or pull requests

3 participants