Work around a hang in fork(2) on FreeBSD

See bug https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271490

On FreeBSDk, it's possible for fork(2) in a multithreaded process to
hang because of a bug in the lock handling of the dynamic linker. This
is now fixed on FreeBSD master, but it would be good if we could work
around it for Ruby CI which is running 13.1.

Setting LD_BIND_NOW seems to work around the problem (probably because
the dynamic linker doesn't then need to resolve anything through the PLT
when it's first called).
This commit is contained in:
KJ Tsanaktsidis 2023-05-26 13:12:20 +10:00 committed by Jeremy Evans
parent 1ed70eb99f
commit 082962e857
Notes: git 2023-08-30 19:48:00 +00:00

View File

@ -134,6 +134,9 @@ if File.file?(libruby_so)
env[e] = [abs_archdir, ENV[e]].compact.join(File::PATH_SEPARATOR)
end
end
# Work around a bug in FreeBSD 13.2 which can cause fork(2) to hang
# See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271490
env['LD_BIND_NOW'] = 'yes' if /freebsd/ =~ RUBY_PLATFORM
ENV.update env