Skip to content

Multithreaded Kernel#trap -> __jtrap #226

@dekz

Description

@dekz

When trying to kick off Rack::Servers in different threads, I run into a bit of a weird race condition issue which only happens on Jruby-1.6.7. It seems that the Rack::Server#start calls a trap(:INT) which invokes Kernel#trap to call __jtrap in Jruby land. Only I get a NoMethodError when the RubyKernel#trap calls __jtrap.

I've got a test here which can reproduce (on both linux and OSX) using jdk1.6. Testing in jruby-1.7.0-preview seems to work.

Here is the offending java code RubyKernel#trap.

Simply retrying will eventually 'work' and __jtrap can be found it seems, but retrying until it works seems incorrect. A simple global lock cannot work in this situation as Rack::Server#start doesn't return to return the hold on the lock until end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions