php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38775 Segmentation Fault on CLI
Submitted: 2006-09-11 05:43 UTC Modified: 2006-09-19 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: iain at iaindooley dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.1.6 OS: FreeBSD 6.1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-09-11 05:43 UTC] iain at iaindooley dot com
Description:
------------
i have some php scripts which are run from cron. i occassionally get an email from cron telling me that there was a Segmentation Fault

Reproduce code:
---------------
This only seems to happen on the command line, and it only seems to happen _after_ the script has been executed

Expected result:
----------------
No segementation fault

Actual result:
--------------
A segmentation fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-11 06:20 UTC] mike@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2006-09-11 06:46 UTC] iain at iaindooley dot com
i followed the instructions on obtaining a backtrace, however the backtrace i received does not seem to be as helpful as the example:

---Type <return> to continue, or q <return> to quit---
#385 0x00000001 in ?? ()
#386 0x283303d8 in ?? ()
#387 0x28317cdd in ?? ()
#388 0x08066bc4 in ap_getline ()

the previous lines (of which there are many) are all similar to the three above ap_getline, ie. they all have an address and ?? ()

i checked my config, and i ran ./configure with --enable-debug. i notice on the page with instructions to obtain a backtrace it is --with-debug. is there a difference?

a different application on the same machine that also runs scripts on the command line had this backtrace:

#2464 0x0000008c in ?? ()
#2465 0x0838c950 in ?? ()
#2466 0x00000000 in ?? ()
#2467 0x28316cdd in ?? ()
#2468 0x08064280 in ap_cfg_getline ()
Previous frame inner to this frame (corrupt stack?)

once again i have ommitted many lines above that were ??()
 [2006-09-11 07:36 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

ap_getline () in CLI? Something is really broken there.
 [2006-09-11 08:03 UTC] iain at iaindooley dot com
okay, i'll put a script into cron that doesn't do much and see if it segfaults.

i'm a bit mystified by the last line of the comment:

"ap_getline () in CLI? Something is really broken there."

is this something incorrect i have done in my php script? i don't know what ap_getline is.

the scripts that are producing this problem are largish applications. based on the information available do you have any suggested content for a script to test on the command line?
 [2006-09-11 08:16 UTC] mike@php.net
Because ap_getline() really looks like an Apache httpd internal function.

Anyway, you can produce much better backtraces with a debug build.

Thanks.
 [2006-09-11 08:17 UTC] tony2001@php.net
>is this something incorrect i have done in my php script?
> i don't know what ap_getline is.
No, it's not about you or your script.
ap_getline() is a function from Apache API, so it just can't appear in CLI.
 [2006-09-11 08:25 UTC] iain at iaindooley dot com
okay, in my configure line i have --enable-debug. on the page with instructions to obtaining a backtrace, it says i need to compile --with-debug. will compiling with --with-debug instead of --enable-debug improve the backtrace?
 [2006-09-11 08:35 UTC] tony2001@php.net
No, the page says "--enable-debug", which is the correct option.
 [2006-09-11 09:13 UTC] iain at iaindooley dot com
sorry, i was using httpd for the backtrace where as i should have been using cli php. here is the backtrace:

#0  _zval_ptr_dtor (zval_ptr=0x5a5a5a5a, __zend_filename=0x8306fe4 "/usr/home/iain/dist/php-5.1.6/Zend/zend_variables.c", __zend_lineno=175)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_execute_API.c:393
#1  0x082254a8 in _zval_ptr_dtor_wrapper (zval_ptr=0x5a5a5a5a) at /usr/home/iain/dist/php-5.1.6/Zend/zend_variables.c:175
#2  0x0822f988 in zend_hash_destroy (ht=0x84f8e6c) at /usr/home/iain/dist/php-5.1.6/Zend/zend_hash.c:521
#3  0x0821d971 in destroy_zend_class (pce=0x8225490) at /usr/home/iain/dist/php-5.1.6/Zend/zend_opcode.c:178
#4  0x0822fc14 in zend_hash_apply_deleter (ht=0x83a90c0, p=0x8524f00) at /usr/home/iain/dist/php-5.1.6/Zend/zend_hash.c:576
#5  0x0822ff3f in zend_hash_reverse_apply (ht=0x83a90c0, apply_func=0x8219888 <clean_non_persistent_class>) at /usr/home/iain/dist/php-5.1.6/Zend/zend_hash.c:737
#6  0x08219fd9 in shutdown_executor () at /usr/home/iain/dist/php-5.1.6/Zend/zend_execute_API.c:273
#7  0x08226541 in zend_deactivate () at /usr/home/iain/dist/php-5.1.6/Zend/zend.c:854
#8  0x081eb845 in php_request_shutdown (dummy=0x0) at /usr/home/iain/dist/php-5.1.6/main/main.c:1292
#9  0x082acf9c in main (argc=4, argv=0xbfbfedec) at /usr/home/iain/dist/php-5.1.6/sapi/cli/php_cli.c:1246

and here is the one for the other application:

#0  0x082194e0 in zend_get_constant (name=0x9e9a2a4 "@", name_len=1515870810, result=0xaf) at /usr/home/iain/dist/php-5.1.6/Zend/zend_constants.c:246
#1  0x082251c4 in zend_stack_apply_with_argument (stack=0x0, type=136466860, apply_function=0xbfbfbf08, arg=0x9ea0ba4)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_stack.c:165
#2  0x0822f6a4 in _zend_hash_add_or_update (ht=0x9e9a2a4, arKey=0x1 <Address 0x1 out of bounds>, nKeyLength=714067076, pData=0x9e8aa40, nDataSize=136558788,
    pDest=0x9e934e4, flag=-1077952712, __zend_filename=0x823b8d4 "\017", __zend_lineno=166278372) at /usr/home/iain/dist/php-5.1.6/Zend/zend_hash.c:242
#3  0x0823b6f5 in zend_strtod (s00=0x9e934e4 "$&#65533;J\b&#65533;&#65533;&#65533;\t", se=0x10) at /usr/home/iain/dist/php-5.1.6/Zend/zend_strtod.c:1318
#4  0x0823b8d4 in zend_strtod (s00=0x9e934e4 "$&#65533;J\b&#65533;&#65533;&#65533;\t", se=0x907) at /usr/home/iain/dist/php-5.1.6/Zend/zend_strtod.c:1608
#5  0x0823e47c in zend_objects_store_init (objects=0x8210eab, init_size=183683280) at /usr/home/iain/dist/php-5.1.6/Zend/zend_objects_API.c:35
#6  0x0821953e in zend_get_constant (name=0x89b8824 "", name_len=166331952, result=0xaf) at /usr/home/iain/dist/php-5.1.6/Zend/zend_constants.c:300
#7  0x082251c4 in zend_stack_apply_with_argument (stack=0x0, type=136466860, apply_function=0x10, arg=0x9ea0624)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_stack.c:165
#8  0x0822f6a4 in _zend_hash_add_or_update (ht=0x89b8824, arKey=0x1 <Address 0x1 out of bounds>, nKeyLength=714067076, pData=0x8852000, nDataSize=142942244,
    pDest=0x30, flag=-1077952456, __zend_filename=0x8850ab0 "&#65533;&#65533;\204\b&#65533;&#65533;\204\b$ \205\b", __zend_lineno=142924196)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_hash.c:242
#9  0x08224f4e in zend_stack_init (stack=0x884efa4) at /usr/home/iain/dist/php-5.1.6/Zend/zend_stack.c:35
#10 0x0821953e in zend_get_constant (name=0x82af0c4 "l|a!s", name_len=144413988, result=0xaf) at /usr/home/iain/dist/php-5.1.6/Zend/zend_constants.c:300
#11 0x082251c4 in zend_stack_apply_with_argument (stack=0xdb, type=136466860, apply_function=0xbfec424, arg=0x8850aa4)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_stack.c:165
#12 0x0822f6a4 in _zend_hash_add_or_update (ht=0x89b9524, arKey=0xbfb9f00 "&#65533;w\202&#65533;&#65533;&#65533;*\b-", nKeyLength=8, pData=0x8210e6c, nDataSize=136558788, pDest=0x8853624,
    flag=-1077952328, __zend_filename=0x823b8d4 "\017", __zend_lineno=142947876) at /usr/home/iain/dist/php-5.1.6/Zend/zend_hash.c:242
#13 0x0823b6f5 in zend_strtod (s00=0x8853624 "$B\233\b$\225\233\b", se=0xc0) at /usr/home/iain/dist/php-5.1.6/Zend/zend_strtod.c:1318
#14 0x0823b8d4 in zend_strtod (s00=0x8853624 "$B\233\b$\225\233\b", se=0x26) at /usr/home/iain/dist/php-5.1.6/Zend/zend_strtod.c:1608
#15 0x0823e47c in zend_objects_store_init (objects=0xbfd88e4, init_size=183628728) at /usr/home/iain/dist/php-5.1.6/Zend/zend_objects_API.c:35
#16 0x0821953e in zend_get_constant (name=0xbfe8724 "&#65533;M\235|\004", name_len=201230128, result=0xaf) at /usr/home/iain/dist/php-5.1.6/Zend/zend_constants.c:300
#17 0x082251c4 in zend_stack_apply_with_argument (stack=0x8307afc, type=136466860, apply_function=0xf3, arg=0x0)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_stack.c:165
#18 0x0822f7d8 in _zend_hash_add_or_update (ht=0x8522124, arKey=0x8309e40 "ytes!", nKeyLength=243, pData=0x87d93bc, nDataSize=36, pDest=0xbfe4de4, flag=142308644,
    __zend_filename=0xbfbfc1d4 "&#65533;&#65533;w\b0&#65533;w\b&#65533;\225\204\b&#65533;&#65533;w\b0&#65533;\204\b0&#65533;\204\b&#65533;&#65533;\204\b$%|\b\020", __zend_lineno=0) at /usr/home/iain/dist/php-5.1.6/Zend/zend_hash.c:248
#19 0x08241dda in zend_do_fcall_common_helper_SPEC (execute_data=0xbfbfc570) at zend_vm_execute.h:294
#20 0x08241661 in zend_fetch_property_address (result=0x87d40c4, container_ptr=0xbfbfc570, prop_ptr=0x87cb024, type=139130404)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_execute.c:1254
#21 0x082418b5 in execute (op_array=0x0) at zend_vm_execute.h:48
#22 0x08241661 in zend_fetch_property_address (result=0x87d40c4, container_ptr=0xbfbfcc00, prop_ptr=0x87c8c24, type=137403968)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_execute.c:1254
#23 0x082418b5 in execute (op_array=0x0) at zend_vm_execute.h:48
#24 0x08241661 in zend_fetch_property_address (result=0x84f4958, container_ptr=0xbfbfcf10, prop_ptr=0x84c1d24, type=139134500)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_execute.c:1254
#25 0x082418b5 in execute (op_array=0x0) at zend_vm_execute.h:48
#26 0x08241661 in zend_fetch_property_address (result=0x85280bc, container_ptr=0xbfbfd070, prop_ptr=0x854c924, type=137387756)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_execute.c:1254
#27 0x082418b5 in execute (op_array=0x0) at zend_vm_execute.h:48
#28 0x08241661 in zend_fetch_property_address (result=0x84bc61c, container_ptr=0xbfbfd530, prop_ptr=0x849fe24, type=2)
    at /usr/home/iain/dist/php-5.1.6/Zend/zend_execute.c:1254
#29 0x08226a2e in zend_error (type=1, format=0x0) at /usr/home/iain/dist/php-5.1.6/Zend/zend.c:917
#30 0x081ec1dc in php_module_shutdown () at /usr/home/iain/dist/php-5.1.6/main/main.c:1643
#31 0x082ad56b in main (argc=4, argv=0xbfbfede8) at /usr/home/iain/dist/php-5.1.6/sapi/cli/php_cli.c:876
 [2006-09-11 09:20 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

If you're still able to replicate it - please provide a short but complete reproduce script.
 [2006-09-19 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 13:01:46 2024 UTC