summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKJ Tsanaktsidis <ktsanaktsidis@zendesk.com>2023-05-26 13:12:20 +1000
committerJeremy Evans <code@jeremyevans.net>2023-08-30 20:47:39 +0100
commit082962e857833dfc16881cb4dfb44caa175590ba (patch)
tree9111c5a4da75c48e52c3d547105720b1e727892d
parent1ed70eb99f54a4221bf2e4644596922f676340cc (diff)
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).
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7867
-rwxr-xr-xtool/runruby.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/tool/runruby.rb b/tool/runruby.rb
index 1efe38fd13..c6724f53d3 100755
--- a/tool/runruby.rb
+++ b/tool/runruby.rb
@@ -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