Forum: JRuby mutex problem - deadlock

Posted by Jas Grewal (jgrewal)
on 2010-03-05 05:27
Environment: Jruby 1.4, Rails 2.3.5, Java 6, Tomcat 6


When running the application, the server gets stuck on requests and does
not respond. No errors are thrown. There seems to be some sort of
deadlock.

After looking into the issue, I found the following post:
http://groups.google.com/group/appengine-jruby-commits/browse_thread/thread/6e6a18cc3289871f

Commenting out line lock.lock in file
actionpack-2.3.4/lib/action_controller/reloader.rb, method run on line
31 fixes the problem.

Is this a known issue? Are there any downsides to commenting out this
line.

Thanks,
Jas
Posted by Maarten Mortier (maartenm)
on 2010-03-05 09:22
(Received via mailing list)
This seems to happen only in development mode.
I fixed it by updating to jruby-rack 0.9.6 (from trunk)

On Fri, Mar 5, 2010 at 5:27 AM, Jas Grewal <lists@ruby-forum.com> wrote:
> Commenting out line lock.lock in file
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Charles Nutter (headius)
on 2010-03-05 16:31
(Received via mailing list)
Seems like this might be a good enough reason to push out a jruby-rack
release very soon...

On Fri, Mar 5, 2010 at 2:22 AM, Maarten Mortier
<maarten.mortier@gmail.com> wrote:
>>
>> Thanks,
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Jas Grewal (jgrewal)
on 2010-03-05 18:30
I have rack 1.0.1 (jruby gem), but it is still happening.

Maarten Mortier wrote:
> This seems to happen only in development mode.
> I fixed it by updating to jruby-rack 0.9.6 (from trunk)
> 
Posted by Justin Coyne (justincoyne)
on 2010-03-05 18:37
(Received via mailing list)
Do you have class reloading (in rails) turned on with config.threadsafe!
enabled?

-Justin


On Fri, Mar 5, 2010 at 11:30 AM, Jas Grewal <lists@ruby-forum.com> 
wrote:
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Justin Coyne (justincoyne)
on 2010-03-05 18:38
(Received via mailing list)
By class reloading I mean:

config.cache_classes = false


-Justin

On Fri, Mar 5, 2010 at 11:36 AM, Justin Coyne <digger250@gmail.com> 
wrote:
>>> This seems to happen only in development mode.
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Maarten Mortier (maartenm)
on 2010-03-06 12:51
(Received via mailing list)
No I mean jruby-rack the jar file, not the ruby gem.

On Fri, Mar 5, 2010 at 6:30 PM, Jas Grewal <lists@ruby-forum.com> wrote:
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Jas Grewal (jgrewal)
on 2010-03-09 17:50
Where can I find the new version of jruby-rack jar file?

As for my application configurations:

If I run the application with these configurations:

config.threadsafe!
config.cache_classes = false

I get the following error:
==================================================================
11:34:10,020 ERROR [/ida2]: - Application Error
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31:in 
`lock': Mutex relocking by same thread (ThreadError)
        from 
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31:in 
`run'
        from 
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in 
`call'
        from 
file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:35:in 
`serve_rails'
        from 
file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:51:in 
`call'
        from 
file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/jruby/rack/rails.rb:148:in 
`call'
        from 
file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/handler/servlet.rb:18:in 
`call'
        from :1
        ...internal jruby stack elided...
        from 
Mutex.lock(/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31)
        from 
#<Class:01x482c7179>.run(/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108)
        from 
ActionController::Dispatcher.call(file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:35)
        from 
Rack::Adapter::Rails.serve_rails(file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:51)
        from 
Rack::Adapter::Rails.call(file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/jruby/rack/rails.rb:148)
        from 
JRuby::Rack::RailsRequestSetup.call(file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/handler/servlet.rb:18)
        from Rack::Handler::Servlet.call(:1)
        from (unknown).(unknown)(:1)
==================================================================

When I run the application with following configurations:

config.threadsafe!
config.cache_classes = true

I get NameErrors in views for the classes in lib directory. By adding a 
require statement in view fixes those. I never had to do that before in 
views.
Example error:
==================================================================
11:46:51,682 ERROR error: - uninitialized constant 
IDA::Entity::PackageStatus - On line #127 of 
app/views/admin/product/view_packages.rhtml

    124:                 %>
    125:             </td>
    126:             <td align="center">
    127:                 <%=
    128:                     IDA::Entity::PackageStatus.get_by_name(
    129:                         package.getStatus()).description
    130:                 %>

    app/views/admin/product/view_packages.rhtml:127:in 
`_run_rhtml_app47views47admin47product47view_packages46rhtml'
    file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-stdlib-1.4.0.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/builtin/java/java.util.rb:21:in 
`call'
    file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-stdlib-1.4.0.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/builtin/java/java.util.rb:21:in 
`each'
    app/views/admin/product/view_packages.rhtml:83:in 
`_run_rhtml_app47views47admin47product47view_packages46rhtml'
    app/controllers/admin/product_controller.rb:255:in `view_packages'
    file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:35:in 
`serve_rails'
    file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:51:in 
`call'
    file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/jruby/rack/rails.rb:148:in 
`call'
    file:/usr/share/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/handler/servlet.rb:18:in 
`call'
    :1

==================================================================
Posted by Jas Grewal (jgrewal)
on 2010-03-12 18:34
Hi all,

Thank you for all your help. It was much appreciated!

I was finally able to resolve the issue by using newer version of 
jruby-rack file (0.9.6).

Regards,
Jas
Posted by Kevin Tambascio (ktambascio)
on 2010-04-01 05:47
Hi,

I'm seeing this issue (Mutex lock) with the following configuration:

JRuby 1.4.0
Tomcat 6.0.26
Rails 2.3.4
Rack 1.0.1
Warbler 0.9.14

The application shows this behavior when running in development mode. 
I'm using warbler to generate my war file, and deploying into Tomcat. 
I'm not sure where to find the jruby-rack file, so far, I'm just relying 
on the installed gems.

Any tips to debug this?

Thanks,
Kevin

Jas Grewal wrote:
> Hi all,
> 
> Thank you for all your help. It was much appreciated!
> 
> I was finally able to resolve the issue by using newer version of 
> jruby-rack file (0.9.6).
> 
> Regards,
> Jas
Posted by Jas Grewal (jgrewal)
on 2010-04-01 16:51
Hi Kevin,

jruby-rack jar file is in warbler gem lib directory. When using warbler 
to create the war file, jruby-rack.jar file is placed in WEB-INF/lib 
directory.

Try upgrading jruby-rack-0.9.5.jar to jruby-rack-0.9.6.jar. Hopefully it 
will resolve the issue.

Regards,
Jas

Kevin Tambascio wrote:
> Hi,
> 
> I'm seeing this issue (Mutex lock) with the following configuration:
> 
> JRuby 1.4.0
> Tomcat 6.0.26
> Rails 2.3.4
> Rack 1.0.1
> Warbler 0.9.14
> 
> The application shows this behavior when running in development mode. 
> I'm using warbler to generate my war file, and deploying into Tomcat. 
> I'm not sure where to find the jruby-rack file, so far, I'm just relying 
> on the installed gems.
> 
> Any tips to debug this?
> 
> Thanks,
> Kevin
> 
> Jas Grewal wrote:
>> Hi all,
>> 
>> Thank you for all your help. It was much appreciated!
>> 
>> I was finally able to resolve the issue by using newer version of 
>> jruby-rack file (0.9.6).
>> 
>> Regards,
>> Jas
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.