From: "drbrain (Eric Hodel)" Date: 2012-08-03T05:36:03+09:00 Subject: [ruby-core:46948] [ruby-trunk - Bug #6825] forking and pthread_cond_timedwait: Invalid argument (EINVAL) on OS X / 1.9.3-p194 Issue #6825 has been updated by drbrain (Eric Hodel). =begin I can't reproduce on OS X 10.8 ruby 2.0.0dev (2012-08-03 trunk 36602) [x86_64-darwin12.0.0] I modified your script to remove require 'active_record' and altered the main thread to sleep forever. This ensures that mysql and other C extensions are not loaded. It ran for over two minutes without problems. Can you reproduce this with require 'mysql' and not active_record? Can you show the console output with your modified active_record.rb (the loaded features section is of particular interest). Here is what I used: require 'net/http' Thread.abort_on_exception = true class Worker def initialize @tasks = [] work end def work Thread.new do loop do task = nil task = @tasks.shift if @tasks.length > 0 task.call if task sleep(0.25) end end end def schedule(&block) @tasks << block end end pid = fork do class TestLoop def initialize @worker = Worker.new (1..10).map { Thread.new { loop { sleep(0.5) } } } end def run loop do @worker.schedule { puts Net::HTTP.get("github.com", "/").length } sleep(0.25) end end end TestLoop.new.run end sleep (I don't have mysql installed to check.) =end ---------------------------------------- Bug #6825: forking and pthread_cond_timedwait: Invalid argument (EINVAL) on OS X / 1.9.3-p194 https://bugs.ruby-lang.org/issues/6825#change-28611 Author: xentronium (Mark A) Status: Feedback Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0] https://gist.github.com/47e48301aea114e7b1d3 here is the gist with required setup to reproduce bug. Also crash log and stdout. It seems that forking is essential for this setup to crash. Also, if you use database connection in some way prior to forking, it might not crash (however, with more complex code it still does). ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0] OS X 10.6.8 hostinfo output: Mach kernel version: Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 Kernel configured for up to 4 processors. 2 processors are physically available. 4 processors are logically available. Processor type: i486 (Intel 80486) Processors active: 0 1 2 3 Primary memory available: 8.00 gigabytes Default processor set: 88 tasks, 627 threads, 4 processors Load average: 0.55, Mach factor: 3.43 compiled with gcc version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) -- http://bugs.ruby-lang.org/