php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40985 CLI version crashes while trying to shutdown, using tsrm_shutdown()
Submitted: 2007-04-03 14:00 UTC Modified: 2007-04-18 08:54 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: charlie at lemurconsulting dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.1 OS: Windows XP
Private report: No CVE-ID: None
 [2007-04-03 14:00 UTC] charlie at lemurconsulting dot com
Description:
------------
While trying to make the Xapian (www.xapian.org) PHP bindings work on Windows using Visual C++, we found that the CLI version of PHP would crash when unloading the bindings. The bindings are written using SWIG. PHP appears to be trying to unload resources when the crash occurs. The crash does not occur on earlier versions of PHP i.e. 4.4.6

Reproduce code:
---------------
The following patch fixes the problem and has been used as a workaround:
  Patch php_cli.c as follows by commenting out line 1283:
	#ifdef ZTS
	/*    tsrm_shutdown(); */
	#endif

Expected result:
----------------
No crash :)

Actual result:
--------------
n/a

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-03 15:00 UTC] daniel dot menard at bdsp dot tm dot fr
The same bug appear with the cgi version.

The only known workaround for now is to patch php_cgi.c in the same way, removing any call to tsrm_shutdown()
 [2007-04-03 18:40 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2007-04-03 22:06 UTC] fmk@php.net
This seams to me like a problem outside of PHP. The xapian extension create module globals but does not do any cleanup. Looks to me like it can be solved with code like this:

PHP_MSHUTDOWN_FUNCTION(printer)
{
#ifdef ZTS
	ts_free_id(printer_globals_id);
#else
	php_printer_shutdown(&printer_globals TSRMLS_CC);
#endif
	UNREGISTER_INI_ENTRIES();
	return SUCCESS;
}

I have not tested anything, but just remembering the same type of problem with the printer (and other) exntension in the past.
 [2007-04-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-04-18 07:27 UTC] daniel dot menard at bdsp dot tm dot fr
Charlie added the code suggested by fmk@php.net to the xapian extension, and it resolves the problems we encountered.

The PHP Xapian extension now works nicely with all the php 5.x versions without any crash.

Thanks a lot to tony2001 and fmk for the help they provided and for being so fast to answer.
 [2007-04-18 07:47 UTC] tony2001@php.net
Not PHP problem -> bogus.
 [2007-04-18 08:40 UTC] charlie at lemurconsulting dot com
Fixed as described.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC