[Backgroundrb-devel] Intermittent "can't convert Float into Hash" and results.rb
Mason Hale
masonhale at gmail.com
Fri Jan 12 12:57:37 EST 2007
Following up on this item, I found that if I remove any calls to add values
to the results_worker hash, the errors described below go away.
I also found that in some cases the call to 'BackgrouDRb::Results::stored'
was returning the symbol :backgroundrb_results instead of a hash, thus
triggering the "can't convert Symbol to Hash" TypeError.
I made a pass at synchronizing the WorkerResults []= and [] methods via
Mutex, but was unsuccessful. I suspect it may have something to do with
Mutex not being reentrant.
See:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/24470
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/172652
In any case, avoiding use of results avoids the issue. For the time being,
I'm storing any process state information in a database instead.
Mason
On 1/10/07, skaar <skaar at waste.org> wrote:
>
> It might be that we have to introduce a mutex in the results worker
> where this happens. I'll try to get this reproduced sometime this
> weekend.
>
> /skaar
>
>
> * Mason Hale (masonhale at gmail.com) [070109 14:42]:
> > I'm getting a similar error, here a partial stack trace:
> >
> > 20070108-20:17:45 (27597) can't convert Symbol into Hash -
> (TypeError)
> > 20070108-20:17:45 (27597)
>
> > /opt/lss/demo/0.4-06/vendor/plugins/backgroundrb/server/lib/backgroundrb/results.rb:40:in
> > `merge!'
> > 20070108-20:17:45 (27597)
>
> > /opt/lss/demo/0.4-06/vendor/plugins/backgroundrb/server/lib/backgroundrb/results.rb:40:in
> > `[]='
> >
> > The process will run fine for hours or days, but then will stop with
> this
> > error. When it happens it takes now the entire BackgrounDRb server.
> (I'm
> > addding some begin/rescue blocks to hopefully prevent that.)
> >
> > I've got Ruby 1.8.5p12 compiled with gcc 3.4.6 on RedHat Linux.
> >
> > This also seems to occur with more than one process (running the same
> > worker class) at the same tim
> >
> > Any ideas?
> >
> > Mason
> >
> > On 1/7/07, Robert Bjarnason <[1]robert.bjarnason at gmail.com> wrote:
> >
> > Hi Bob,
> >
> > Thanks for the pointer, I agree this is probably not a directly
> > backgroundrb related problem. I built Ruby 1.8.4 on a Debian Linux
> box
> > using gcc version 3.3.5.
> >
> > Warm regards,
> > Robert Bjarnason
> >
> > Bob Hutchison wrote:
> > > Hi,
> > >
> > > This sounds a bit like the trouble in OS X where you'd get a
> Fixednum
> > > to String error. This was caused by a bug in the gcc 4.0compiler. The
> > > solution on OS X is to re-compile Ruby with -O1 optimisation
> level or
> > > switch to the gcc 3.x compiler). As I understand it, with linux
> you
> > > have the additional option of installing a newer version of gcc
> 4.x
> > > and recompiling (I'm using 4.0.2 on one of my linux boxes and
> have
> > > never seen the problem).
> > >
> > > Cheers,
> > > Bob
> > >
> > > On 4-Jan-07, at 11:44 AM, Robert Bjarnason wrote:
> > >
> > >> Hi,
> > >>
> > >> I'm using backgroundrb 0.2.1 in a production environment and for
> most
> > >> parts I'm very happy. We are using it to do some heavy video
> editing
> > on
> > >> the server side and it works great except that under, what seems
> > heavy
> > >> load the below problem happens intermittently.
> > >>
> > >> The problem has only happened 5 times out of over 500 runs by
> our
> > >> backgroundrb worker.
> > >>
> > >> This is the code in our worker:
> > >> logger.debug("info : progress: #{progress}")
> > >> progress_percent = progress * 100
> > >> if progress_percent >= 100
> > >> results[:progress] = 99.99
> > >> else
> > >> results[:progress] = progress_percent <-- Line
> of the
> > >> crash
> > >> end
> > >>
> > >> Here is the error:
> > >> can't convert Float into Hash
> > >>
> > >> And the beginning of the stack trace:
> > >>
>
> > /.../ContentStore/vendor/plugins/backgroundrb/server/lib/backgroundrb/results.rb:40
> > >>
> > >> :in
> > >>
>
> > `merge!'/.../ContentStore/vendor/plugins/backgroundrb/server/lib/backgroundrb/results.rb:40
> > >>
> > >> :in `[]='/.../ContentStore/lib/workers/content_worker.rb:40
> > >> :in
> > `execute_mp4box'/.../ContentStore/lib/workers/content_worker.rb:22:
> > >> in
> `execute_mp4box'/.../ContentStore/lib/workers/content_worker.rb:21
> > >> :in
> > `execute_mp4box'/.../ContentStore/lib/workers/content_worker.rb:181
> > >> :in
> > >>
>
> > `do_work'/.../ContentStore/vendor/plugins/backgroundrb/server/lib/backgroundrb/worker.rb:55:
> > >>
> > >> ...
> > >>
> > >> The problem seems to happen only under heavy load where more
> than 1
> > >> worker process is active at the same time.
> > >>
> > >> Any ideas or leads?
> > >>
> > >> Thanks,
> > >> Robert Bjarnason
> > >>
> > >> _______________________________________________
> > >> Backgroundrb-devel mailing list
> > >> [2]Backgroundrb-devel at rubyforge.org
> > >> [3]http://rubyforge.org/mailman/listinfo/backgroundrb-devel
> > >
> > > ----
> > > Bob Hutchison -- blogs at
> > > <[4]http://www.recursive.ca/hutch/>
> > > Recursive Design Inc. -- <[5]http://www.recursive.ca/>
> > > Raconteur -- <[6]http://www.raconteur.info/
> >
> > > xampl for Ruby --
> > <[7]http://rubyforge.org/projects/xampl/>
> > >
> > >
> > >
> > >
> >
> > _______________________________________________
> > Backgroundrb-devel mailing list
> > [8]Backgroundrb-devel at rubyforge.org
> > [9]http://rubyforge.org/mailman/listinfo/backgroundrb-devel
> >
> > References
> >
> > Visible links
> > 1. mailto:robert.bjarnason at gmail.com
> > 2. mailto:Backgroundrb-devel at rubyforge.org
> > 3. http://rubyforge.org/mailman/listinfo/backgroundrb-devel
> > 4. http://www.recursive.ca/hutch/
> > 5. http://www.recursive.ca/
> > 6. http://www.raconteur.info/
> > 7. http://rubyforge.org/projects/xampl/
> > 8. mailto:Backgroundrb-devel at rubyforge.org
> > 9. http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
> > _______________________________________________
> > Backgroundrb-devel mailing list
> > Backgroundrb-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
> --
> ----------------------------------------------------------------------
> |\|\ where in the | s_u_b_s_t_r_u_c_t_i_o_n
> | | >=========== W.A.S.T.E. | genarratologies
> |/|/ (_) is the wisdom | skaar at waste.org
> ----------------------------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070112/12cf3de9/attachment-0001.html
More information about the Backgroundrb-devel
mailing list