On 8/06/11 7:44 AM, Joe Kutner wrote:
Thanks Emmanuel.  that gives me something to go on.  I see what I can
find.

Here is the other error I occasionally run into:
yep, that's a result of require not being thread-safe. You need to make sure everything is required/autoloaded in the main process before spawing off any threads.

Xavier


ThreadError: Mutex is not locked
                     new at /opt/torquebox/vendor/jruby/1.8/gems/
data_objects-0.10.6/lib/data_objects/pooling.rb:172
                     new at /opt/torquebox/vendor/jruby/1.8/gems/
data_objects-0.10.6/lib/data_objects/pooling.rb:119
                     new at /opt/torquebox/vendor/jruby/1.8/gems/
data_objects-0.10.6/lib/data_objects/connection.rb:68
              initialize at /opt/torquebox/vendor/jruby/1.8/gems/
data_objects-0.10.6/lib/data_objects/transaction.rb:28
          create_for_uri at /opt/torquebox/vendor/jruby/1.8/gems/
data_objects-0.10.6/lib/data_objects/transaction.rb:21
   transaction_primitive at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions/adapters/dm-do-adapter.rb:20
         connect_adapter at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:303
                    send at org/jruby/RubyKernel.java:2063
            each_adapter at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:250
                each_key at org/jruby/RubyHash.java:1235
            each_adapter at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:249
                   begin at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:108
                  commit at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:130


On Jun 7, 1:21 pm, Emmanuel Gomez<[email protected]>  wrote:
Hi Joe,

I've had a similar-looking problem when trying to use a library that internally 
lazy-loads (aka `autoload`) some of its files in a multi-threaded context. The 
lazy-loading would be triggered by one thread, but the other threads would then 
try to use the internal constant before it was fully loaded. In my case, I was 
able to force loading of the internal constant before the threaded section of 
my code.

I don't know if you're facing the same circumstance, but maybe this is of some 
use.

-- Emmanuel

On Jun 7, 2011, at 11:14 AM, Joe Kutner wrote:







I get this error inconsistently when I have multiple threads entering
the same code that wraps a transaction around my services at about the
same time:

NameError: unitialized constant Digest::SHA256
          const_missing at org/jruby/RubyDigest.java:140
             initialize at /opt/torquebox/vendor/jruby/1.8/gems/
data_objects-0.10.6/lib/data_objects/transaction.rb:30
         create_for_uri at /opt/torquebox/vendor/jruby/1.8/gems/
data_objects-0.10.6/lib/data_objects/transaction.rb:21
  transaction_primitive at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions/adapters/dm-do-adapter.rb:20
        connect_adapter at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:303
                   send at org/jruby/RubyKernel.java:2063
           each_adapter at /opt/torquebox/vendor/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:250
               each_key at org/jruby/RubyHash.java:1235
           each_adapter at /opt/torquebox/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:249
                  begin at /opt/torquebox/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:108
                 commit at /opt/torquebox/jruby/1.8/gems/dm-
transactions-1.1.0/lib/dm-transactions.rb:130

When it happens, it only happens to one thread (out of 4 usually).
I've also seen an error "Mutex is locked" or something like that.  But
again, I can't reproduce it consistently.

Any one have some ideas?

I know this may not be datamapper related - sorry if its not.

Thanks,

Joe

--
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group 
athttp://groups.google.com/group/datamapper?hl=en.


--
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to