Skip to content

Deadlock in `block in all_done' / @threads.size.times{ @done.pop } #28

Open
@m-o-e

Description

@m-o-e

Hi,

we're seeing a deadlock, possibly related to #26.

Our resque workers invoke Open4::spawn like so:

status = Open4::spawn argv, {'quiet' => true, 'raise' => true, 'stdin' => stdin, 'stdout' => stdout, 'stderr' => stderr}

argv is a relatively long lived process (5-10 minutes) which
we see sometimes (rarely) fail with a deadlock:

deadlock detected (fatal)
1.9.3-p551/lib/ruby/1.9.1/thread.rb:189:in `sleep'
1.9.3-p551/lib/ruby/1.9.1/thread.rb:189:in `block in pop'
<internal:prelude>:10:in `synchronize'
1.9.3-p551/lib/ruby/1.9.1/thread.rb:184:in `pop'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:206:in `block in all_done'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:206:in `times'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:206:in `all_done'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:199:in `run'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:358:in `block (3 levels) in spawn'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:111:in `call'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:111:in `do_popen'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:46:in `popen4ext'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:336:in `block (2 levels) in spawn'
1.9.3-p551/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:335:in `block in spawn'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:374:in `call'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:374:in `chdir'
1.9.3-p551/lib/ruby/gems/1.9.1/gems/open4-1.3.4/lib/open4.rb:334:in `spawn'

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions