[jifty-devel] jifty segfault with threads

Matt Zagrabelny mzagrabe at d.umn.edu
Thu Dec 9 16:21:41 EST 2010

On Thu, Dec 9, 2010 at 2:57 PM, Matt Zagrabelny <mzagrabe at d.umn.edu> wrote:
> On Thu, Dec 9, 2010 at 2:52 PM, Thomas Sibley <trs at bestpractical.com> wrote:
>> On 09 Dec 2010 15:48, Matt Zagrabelny wrote:
>>> The segfault seems to come from:
>>> Jifty.pm
>>> use encoding 'utf8';
>>> Which is not thread safe according to:
>>> http://perldoc.perl.org/encoding.html#KNOWN-PROBLEMS
>> AFAIK, Jifty has never attempted to be thread-safe.
> Not a lot of perl modules do. But I have a thread-necessary app that I
> would like to graft a Jifty web app on top of.
> From initial tests, the following works:
> use Jifty::Everything;
> BEGIN { Jifty->new() }
> no encoding;
> use threads;

Perhaps I spoke too soon.

As long as I do not try to do anything, things seem to work, that is,
there are no segfaults. However, as soon as I try to use what 'use
Jifty::Everything' and 'Jifty->new' are doing for me, the threading
causes issues.

So I will try to just create a Jifty::DBI::Handle and work that way.
Which leads me to my next question. :)

I've got the following code:

#!/usr/bin/env perl

use Jifty::DBI::Handle;
use lib '/home/mzagrabe/code/git/NA/lib';
use NA::Model::StagedInfrastructure;

my $handle = Jifty::DBI::Handle->new();
                   driver => 'Pg',
                   database => 'na',
                   host     => 'localhost',
                   user     => '',
                   password => ''

my $u = NA::Model::StagedInfrastructure->new( handle => $handle );

which, when ran, yields the following error:

Can't locate NA/Record.pm in @INC (@INC contains:
/home/mzagrabe/code/git/NA/lib /etc/perl /usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at
/home/mzagrabe/code/git/NA/lib/NA/Model/StagedInfrastructure.pm line
BEGIN failed--compilation aborted at
/home/mzagrabe/code/git/NA/lib/NA/Model/StagedInfrastructure.pm line
Compilation failed in require at ./na-test-jifty_dbi_handle line 5.
BEGIN failed--compilation aborted at ./na-test-jifty_dbi_handle line 5.

So, I am missing some of the automagic that I took for granted.
However, I need to keep the threads, and I would like to utilize the
Jifty ORM as much as possible. Is there a way to hand massage the
above script to get things like:





More information about the jifty-devel mailing list