I basically have a job manager that runs with script/runner and is
independent of the webserver. It allows DRB connections, TCP
connections,
and has a scheduling loop. Inside the scheduling loop is where the
error sometimes happens which doesn't seem related to anything I did.

  I haven't worked on this code for awhile, but had not seen these
types of errors when I was running on Centos, I just moved the code to
Fedora ..


jobmgr = JobMgr.new


DRb.start_service('druby://' + jobmgr.ipaddr, jobmgr)


if jobmgr.tcp_port
  Thread.start do
    jobmgr.get_tcp_reqs
  end
end

puts 'run'

jobmgr.run_scheduler

DRb.thread.join





On Apr 23, 12:35 am, Jeff Lewis <[email protected]> wrote:
> Not sure what the purpose of your use of such a mutex lock is in your
> app, but if it's something other than restricting access to some
> resource amongst some threads handled within a given instance of your
> rails app running in some process, .... but in terms of rails, I don't
> think a mutex lock will do what you're thinking it will do if your
> rails app is running / can run in more than one process (ie via
> passenger or via a mongrel cluster or ...).
>
> Assuming you aren't talking about dealing with threads within a given
> process, and you really are trying to restrict access to some resource
> from potentially multiple process instances of your rails app, then
> you'll need to use a locking strategy that can be used in a multi
> process context (ie like via your app's db, or potentially via files,
> or ...).
>
> Note however that if you are only running one instance or rails, ie a
> single instance of webrick or mongrel, then your rails app is
> essentially single-threaded (running in a single process) in terms of
> requests handling.  In such a single-instance setup, you likely
> wouldn't need the use of mutex (unless your dealing with threads in
> that single process) since your app would only be able to handle one
> request at a time anyway.
>
> Jeff
>
> On Apr 22, 9:00 am, Jedrin <[email protected]> wrote:
>
>
>
> >  I have some code that uses and instance of Mutex and calls
> > @mutex.lock, executes some code and then does
> > unlock(). When I call lock() I get some ActiveRecord error which seems
> > unrelated.
>
> > Couldn't find ActiveJob with ID=3
> > ["/home/LGuild/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/
> > base.rb:1586:in `find_one'", "script/jobmgr.rb:107:in `lock'",
>
> >  This is on Fedora 12, I haven't a good idea on how to troubleshoot
> > this ..
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to