Bug #53626 [Ana->Wfx]: SQLite3 - Segmentation Fault on shutdown

From: Date: Mon, 21 Jan 2019 13:50:35 +0000
Subject: Bug #53626 [Ana->Wfx]: SQLite3 - Segmentation Fault on shutdown
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219110@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53626&edit=1

 ID:                 53626
 Updated by:         cmb@php.net
 Reported by:        bion at drewcrawfordapps dot com
 Summary:            SQLite3 - Segmentation Fault on shutdown
-Status:             Analyzed
+Status:             Wont fix
 Type:               Bug
 Package:            SQLite related
 Operating System:   Mac OS X 10.7.1
 PHP Version:        5.5.0RC2
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Since this issue does not affect PHP 7, and even extended support
for PHP 5 has ended, I'm closing the ticket.


Previous Comments:
------------------------------------------------------------------------
[2019-01-21 13:49:30] cmb@php.net

Related To: Bug #69971

------------------------------------------------------------------------
[2018-10-15 22:36:25] cmb@php.net

Related To: Bug #69971

------------------------------------------------------------------------
[2016-08-29 09:58:22] cmb@php.net

The issue is that ext/sqlite3 has circular references between
SQLite3 and SQLite3Stmt objects, and in case of "unclean shutdown"
(as caused by a catchable fatal error, in this case) the free
handlers are called in order of object construction in PHP 5.
Therefore the SQLite3 object is destroyed, but shortly thereafter
the SQLite3Stmt object tries to access it, which can result in a
segfault (and would be an invalid access, anyway).

As of PHP 7.0.0 the free handlers are invoked in opposite order
of construction, so at least with the given test script there are
no issues.

Anyhow, it seems to me that ext/sqlite3 should better separate
concerns by using dtors and free handlers (currently only free
handlers are used).

------------------------------------------------------------------------
[2013-05-23 19:20:44] bion at drewcrawfordapps dot com

This continues to haunt me

------------------------------------------------------------------------
[2012-04-23 17:11:55] bugman at mailinator dot com

I was having the same problem.  Apparently it is due to the sqlite3 extension 
being threaded, but php not being compiled with the pthread library.  I was able 
to fix it in FreeBSD by recompiling php with the following option:

LINKTHR    Link thread lib (for threaded extensions)

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=53626


--
Edit this bug report at https://bugs.php.net/bug.php?id=53626&edit=1


Thread (13 messages)

« previous php.bugs (#219110) next »