Seg Fault

View: New views
4 Messages — Rating Filter:   Alert me  

Seg Fault

by monk.e.boy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

  I have been trying to hunt down a seg fault all day. My script is pretty complex but has worked fine for a couple of years. Today I removed the PEAR:DB stuff and put in ZF DB.

  The models are very simple, I just specify the table name.

  As far as I can tell it seems to occur when a row object goes out of scope:

function f()
{
  $rpt = new Report();
  foreach( $rows in $row )
  {
    $row = $rpt->createRow();
    $row->text = $row['message'];
    .... etc
    $row->save();
    // $row = null;
  }
  return;
}

So the core dump happens after the return. If I uncomment the $row= null; the error happens here.

I am using mysqli. I have tried to debug it, but NuSphere just dies. When I run it in the browser I get a blank page. When I run it from the command line I get 'segmentation fault'....  I know this isn't anywhere near enough info for anyone to repeat this bug. But I can't post my server set up, or the database or any of that. Gah!

Is there anything I can do to try and track this down at my end? Maybe provide a little more info?

Ho hum....

monk.e.boy

Re: Seg Fault

by Bill Karwin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


monk.e.boy wrote:
Hi,

  I have been trying to hunt down a seg fault all day. My script is pretty complex but has worked fine for a couple of years. Today I removed the PEAR:DB stuff and put in ZF DB.

  As far as I can tell it seems to occur when a row object goes out of scope:
Sounds like a bug in PHP, the mysqli extension, or the libmysql client library.  Nothing in ZF should be able to cause a segfault.

The only suggestions I would have based on the information you can provide would be:
1. Upgrade to the latest stable (non-beta) version of PHP and MySQL client.  You might be encountering a bug in their code that has been fixed already.
2. Build PHP and the MySQL client with debugging symbols and see if you can reproduce the failure in a debugger so you can get a stack trace where the segfault is happening.
3. Create a small test application that exhibits the segfault, so you don't have to post details of your project.  You would still have to post at least the details of your platform and the versions of various software you're using.

Regards,
Bill Karwin

Re: Seg Fault

by Christer Edvartsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have had a similar problem with PDO (not using ZF at all) and storing
an object with an active PDO connection in the session. The garbage
collector or the session handler panicked because of the PDO connection
present in the session and this might result in a seg fault. It only
caused a fatal error in unknown on line 0 in my case though (great error
message btw).

If you are doing something similar with the mysqli stuff it might be the
cause of your problem. The problem is not because of ZF though.

I solved the problem by implementing the magic __sleep method in the
object I was storing in the session that removed the PDO connection from
the object.

Hope this might help you solve your problem.


monk.e.boy wrote:

> Hi,
>
>   I have been trying to hunt down a seg fault all day. My script is pretty
> complex but has worked fine for a couple of years. Today I removed the
> PEAR:DB stuff and put in ZF DB.
>
>   The models are very simple, I just specify the table name.
>
>   As far as I can tell it seems to occur when a row object goes out of
> scope:
>
> function f()
> {
>   $rpt = new Report();
>   foreach( $rows in $row )
>   {
>     $row = $rpt->createRow();
>     $row->text = $row['message'];
>     .... etc
>     $row->save();
>     // $row = null;
>   }
>   return;
> }
>
> So the core dump happens after the return. If I uncomment the $row= null;
> the error happens here.
>
> I am using mysqli. I have tried to debug it, but NuSphere just dies. When I
> run it in the browser I get a blank page. When I run it from the command
> line I get 'segmentation fault'....  I know this isn't anywhere near enough
> info for anyone to repeat this bug. But I can't post my server set up, or
> the database or any of that. Gah!
>
> Is there anything I can do to try and track this down at my end? Maybe
> provide a little more info?
>
> Ho hum....
>
> monk.e.boy

--
Christer Edvartsen
cogo@...
http://cogo.wordpress.com/

Re: Seg Fault

by monk.e.boy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Bill Karwin wrote:
monk.e.boy wrote:
  I have been trying to hunt down a seg fault all day. My script is pretty complex but has worked
Sounds like a bug in PHP, the mysqli extension, or the libmysql client library.  Nothing in ZF should be able to cause a segfault.

Regards,
Bill Karwin
Bill,

  I think you are right. When I came in this morning the seg fault was gone. Overnight my backup scripts run and the development database dropped and is rebuilt. This must have sorted out the error.

  I can't think of anything else that has changed. So it must have been a combination of MySQL + data + mysqllibs. Ugh.

monk.e.boy