Hello, I am using jRuby 1.4.0 and encountered a big problem. If anyone
could help you’d save my skin:
My Rails app does the following:
-
User logs in
-
A Java class is used to create a Connection from these parameters.
-
This Connection cannot be serialized and is stored in
java_servlet_store session.
-
This Connection object is called with Connection.doSomething(String,
Integer, Whatever) whenever data needs to be fetched from the backend.
This works well for one user.
Now, for two users, I have the following scenario’s:
- jruby.max.runtimes = 8, and config.threadsafe! is NOT on
A user logs in, gets the connection object. He calls one of the fetch
methods => OK.
Another user logs in and simulatenously calls the fetch method.
jruby throws:
TypeError: expected [class String, class Integer, class Whatever] but
got [String, Integer, Whatever]
Huh? Is this a known jRuby bug? What’s going on here? It only happens
when jruby.max.runtimes > 1
- jruby.max.runtimes = 1, and config.threadsafe! is called
A user logs in, gets the connection object. He calls one of the fetch
methods => OK.
Another calls the main login page.
The other user has to wait for the first user’s fetch method to be
completed before he can even see the login page!
I debugged all day and did not come up with anything. I am deploying
under Tomcat 6.0. The problems occur in development and in production
mode.
Thanks so much for any help,
Maarten
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Thu, Jan 28, 2010 at 12:41 PM, Maarten M.
[email protected] wrote:
methods => OK.
2) jruby.max.runtimes = 1, and config.threadsafe! is called
mode.
Thanks so much for any help,
I’m not sure what’s causing the odd error in your first scenario. As
far as the second scenario goes, I’d suggest re-examining how you
enable config.threadsafe! and in particular make sure that
ActionController::Base.allow_concurrency really is set to true. The
behavior sounds like you’re unwittingly hitting the dispatcher mutex.
/Nick
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Ok I will check it out.
Some more detail to the first problem:
I have a Ruby class Foo.
Foo has a static method self.make_call.
I do Foo.make_call(servlet_request.session[:connectionobject],
string, integer, whatever)
Foo internall just calls
ConnectionObject.bar(string, integer, whatever) on the actual object
given by the first parameter.
When I’m working with multiple jruby runtimes, this call randomly
raises the TypeError, saying ConnectionObject.bar expects parameters
[class String, class Integer, class Whatever] and got [String,
Integer, Whatever] instead.
On Thu, Jan 28, 2010 at 8:21 PM, Nick S. [email protected]
wrote:
java_servlet_store session.
I debugged all day and did not come up with anything. I am deploying
/Nick
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
I had to explictly set this option to true to circumvent the mutex lock?
Are these settings compatible?
config.cache_classes = true
Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
config.threadsafe!
ActionController::Base.allow_concurrency = true
puts “allows concurrency” +
ActionController::Base.allow_concurrency.to_s
Can I run with allow_concurrency in development mode?
On Thu, Jan 28, 2010 at 8:27 PM, Maarten M.
[email protected] wrote:
ConnectionObject.bar(string, integer, whatever) on the actual object
On Thu, Jan 28, 2010 at 12:41 PM, Maarten M.
A user logs in, gets the connection object. He calls one of the fetch
under Tomcat 6.0. The problems occur in development and in production
/Nick
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
That’s a different allow_concurrency flag, on ActiveRecord.
/Nick
On Fri, Jan 29, 2010 at 2:38 AM, Maarten M.
[email protected] wrote:
On Fri, Jan 29, 2010 at 9:36 AM, Maarten M.
config.threadsafe!
When I’m working with multiple jruby runtimes, this call randomly
could help you’d save my skin:
Integer, Whatever) whenever data needs to be fetched from the backend.
A user logs in, gets the connection object. He calls one of the fetch
Thanks so much for any help,
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
On Fri, Jan 29, 2010 at 2:36 AM, Maarten M.
[email protected] wrote:
I had to explictly set this option to true to circumvent the mutex lock?
Are these settings compatible?
They look ok to me.
I think you can try
config.action_controller.allow_concurrency = true
as well. I’m still surprised that the threadsafe! call isn’t setting it
for you.
Can I run with allow_concurrency in development mode?
That’s probably not a good idea. Leave these settings in
config/environments/production.rb or whatever custom deployed
environments you might have.
/Nick
string, integer, whatever)
- A Java class is used to create a Connection from these parameters.
Huh? Is this a known jRuby bug? What’s going on here? It only happens
completed before he can even see the login page!
ActionController::Base.allow_concurrency really is set to true. The
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
Btw the Rails doc says:
File
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb,
line 97
97: def allow_concurrency=(flag)
98:
ActiveSupport::Deprecation.warn(“ActiveRecord::Base.allow_concurrency=
has been deprecated and no longer has any effect. Please remove all
references to allow_concurrency=.”)
99: end
On Fri, Jan 29, 2010 at 9:36 AM, Maarten M.
[email protected] wrote:
ActionController::Base.allow_concurrency = true
I have a Ruby class Foo.
raises the TypeError, saying ConnectionObject.bar expects parameters
jruby throws:
methods => OK.
http://xircles.codehaus.org/manage_email
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email