[Nitro] re-using a db and threading headaches

Fang Sun nusgnaf at gmail.com
Sat Aug 26 08:32:45 EDT 2006


 instance var @store defined in Og::Manager looks very suspecious.from
the comment in the code:
-------8<-----------
  # The store used for persistence. This is a virtual field
  # when running in thread_safe mode.

  attr_accessor :store
-------8<------------
and in close_store it gets called:
@store.close

I add simple p @store in the og/manager.rb, it seems that it is always
nil, that can explain the error you saw. But how does @store get used?
I still don't know Og enought, hope George may give better explanation
on Og intervals.

On 8/26/06, Alex Pooley <alex at msgpad.com> wrote:
> Yo!
>
> I've been working around two issues. One I have a solution for, and the
> other issue I have a test case courtesy of manveru.
>
> 1. When I try to re-use an existing database Og dies on an exception
> that the table already exists. I'm using sqlite. The easy fix is to
> catch the exception in sql.rb at line 139. So instead of
>
> klass.allocate.og_create_schema(self)
>
> You end up with something more like
>
> begin
>   klass.allocate.og_create_schema(self)
> rescue Exception
> end
>
>
> 2. I'm running two threads. The first thread is running tests, and the
> second thread is a mongrel server. Each thread is accessing the Og
> store. Og will die trying to close the store in manager.rb (line 101),
> because @store is nil. manveru came up with this test case while
> discussing the problem on IRC: http://pastie.caboo.se/10334 . This
> occurs in both the repo.nitroproject.org repository, and manveru's
> latest.
>
>
> --
> Alex Pooley (msgpad founder)
> w: http://msgpad.com
> e: alex at msgpad.com
> b: http://alexpooley.com
>
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>


More information about the Nitro-general mailing list