[Catalyst] Catalys & TheSchwartz, was Catalyst modperl - child process segmentation fault

Toby Corkindale toby.corkindale at strategicdata.com.au
Fri Jan 9 05:26:26 GMT 2009


Matija Grabnar wrote:
>  > afaict, you should let dbic / cat-model handle the connection to the 
> database.
> 
> That reminds me. Does anybody have experience submitting TheSchwartz 
> jobs from a Catalyst?
 > TheSchwartz uses it's own system of allocating DB handles, and I have no
 > idea how it interacts with
 > Catalyst's.
 >
 > I *think* I'm safe because I'm not allocating any schwatz connections
 > until I'm actually serving a
 > Catalyst request, but I'd like to hear from anybody who has actual
 > experience...

*nods*

In fact, I've just finished ripping out every reference to TheSchwartz I 
could find in my codebase, as it ended up being more trouble than it was 
worth :/
(Although I'm sure it works well enough for some people. Livejournal.com 
for instance, not that they're exactly a bastion of five-nines uptime.)

One thing to watch out for is that it handles its own database 
connections, so if you're using the same database as for the rest of 
your model, then you can potentially deadlock if you're using a 
sufficiently brain-dead SQL database.

Eg:
$c->model('DB')->txn_do(sub {
   my $foo = $c->model('DB::Foo')->find(1);
   $foo->bar(999);
   $foo->update;
   $c->model('Schwartz')->insert('DoFoo', { id => $foo->id });
});
will deadlock on SQLite.
(Which is more SQLite's fault than theSchwartz's though.)


-Toby



More information about the Catalyst mailing list