Open JimScadden opened 4 years ago
nice catch. I did not check and look but I would blindly suppose it's because lxc_spawn incorrectly forks a Ruby VM. Considering invalid previous state of the timer thread meaning it was not shutdown properly before. Ruby VM Process.fork has some mechanics beyond the clone() syscall that cleans up schedulers and threads data. In 2.4 it shuts down the timer before the fork.
just by replacing fork+clone3(CLONE_PARENT)
with the simple call to rb_fork_ruby
everything suddenly starts working. however, it requires a patch to both lxc
and ruby-lxc
. The downside is that the parent process either loses child or it requires to use CHILD_REAPER flag instead of the second call to clone. Anyway. The prototype works.
Example code:
This used to work fine in ruby 2.5:
However it seems to trigger an internal ruby error (at https://github.com/ruby/ruby/blob/510df47f5f7f83918d3aa00316c8a5b959d80d7c/thread_pthread.c#L1695) in ruby 2.6 / 2.7:
I've tested in CentOS 7.7, Debian buster (and sid)