View Issue Details

IDProjectCategoryView StatusLast Update
0000748XdebugUncategorizedpublic2012-03-07 19:54
Reporterlightsgoout Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionunable to reproduce 
PlatformUnixOSFreeBSDOS Version8.2-RELEASE
Product Version2.2dev 
Summary0000748: segmentation fault while dumping variable (or printing trace)
Description

I'm using PHP 5.3.6 with Xdebug latest version (from git repo).

The problem is, when Xdebug prints trace after an error (or a notice, no matter) it crashes somewhere in the middle of the way.

Here is part of the output:

PHP Notice: Use of undefined constant FILEINFO_MIME_ENCODING - assumed 'FILEINFO_MIME_ENCODING' in /usr/local/share/pear/DocBlox/src/DocBlox/Reflection/File.php on line 181
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/docblox:0
PHP 2. DocBlox_Task_Project_Run->execute() /usr/local/bin/docblox:55
PHP 3. DocBlox_Task_Project_Parse->execute() /usr/local/share/pear/DocBlox/src/DocBlox/Task/Project/Run.php:141
PHP 4. DocBlox_Parser->parseFiles($files = class DocBlox_Parser_Files { protected $ignore_patterns = array (0 => array (...)); protected $allowed_extensions = array (0 => 'php'); protected $files = array (0 => '/var/lib/hudson/jobs/halk/workspace/html/index.php', 1 => '/var/lib/hudson/jobs/halk/workspace/html/manage.php'); protected $project_root = NULL }, $include_source = NULL) /usr/local/share/pear/DocBlox/src/DocBlox/Task/Project/Parse.php:283
PHP 5. DocBlox_Parser->parseFile($filename = '/var/lib/hudson/jobs/halk/workspace/html/index.php', $include_source = NULL) /usr/local/share/pear/DocBlox/src/DocBlox/Parser.php:488
PHP 6. DocBlox_Reflection_File->__construct($file = '/var/lib/hudson/jobs/halk/workspace/html/index.php', $validate = NULL) /usr/local/share/pear/DocBlox/src/DocBlox/Parser.php:304
PHP 7. DocBlox_Reflection_File->convertToUtf8($filename = '/var/lib/hudson/jobs/halk/workspace/html/index.php', $contents = '<?php\n/\n ?????????? ?????????? ?? ????????\n @author Kolombet Ivan i.kolombet@hoster.ru\n @version 2.0\n @package halk\n @subpackage bootstrap\n /\n\n/\n \n /\nrequire_once \'include/halk_bootstrap.php\';\n\nlist($controller_name, $controller_method, $controller_params, $tpl_name) = HalkRouter::getControllerData();\n\nif(!is_callable(array($controller_name, $controller_method))/ || !HalkRouter::templateExists($tpl_name)/) {\n\n $controller_name = HALK_CONTROLLER_DEFAULT_NAME;\n ...') /usr/local/share/pear/DocBlox/src/DocBlox/Reflection/File.php:108
Segmentation fault (core dumped)

So I got core dump.

I analyzed it with 'gdb /usr/local/bin/php php.core' and it printed:

#0 xdebug_var_export (struc=0x7fffffffbd98, str=0x7fffffffbda0, level=1, debug_zval=0, options=0x80c1f2b40) at /usr/home/i.kolombet/xdebug/xdebug_var.c:386
386 if (myht->nApplyCount < 1) {
[New Thread 80152a1c0 (LWP 100099)]

I went to file xdebug_var.c on the line 386 and updated the line: if(myht != NULL && myht->nApplyCount < 1) and it solved my problem.

It took me almost half a day to trace a bug, because I was messing with latest stable release (2.1.2) and there was also a segfault, but in another place.

Here is a story about 2.1.2 version, just in case.

I inserted '[DEBUG] printfs' here and there and finally got output like this:

[DEBUG] xdebug_str_add() with args $contents = '<?php\n/*\n ??????????
[DEBUG] xdebug_str_add() with args 'text/x-pSegmentation fault (core dumped)

Where code was

void xdebug_str_add(xdebug_str xs, char str, int f)
{
<------>printf("[DEBUG] xdebug_str_add() with args %s, %d \n", str, f);

The main point is crash when printing the argument string (char* str) in xdebug_str_add function. I think segfault is because we're trying to read beyond end of buffer, so it's like access violation, I think. I don't know, I hope it is useful information.

Additional Information

Attached php core dump.

TagsNo tags attached.
Attached Files
php.rar (1,967,144 bytes)
Operating Systemfreebsd 8.2-release
PHP Version5.3.6

Activities

lightsgoout

2011-11-17 15:25

reporter   ~0001858

PHP API => 20090626
PHP Extension => 20090626
Zend Extension => 220090626
Zend Extension Build => API220090626,NTS
PHP Extension Build => API20090626,NTS
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => enabled
IPv6 Support => disabled
Registered PHP Streams => php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert., consumed, dechunk, convert.iconv., zlib., mcrypt., mdecrypt., bzip2.

derick

2011-11-17 17:49

administrator   ~0001859

The coredump itself is not very useful (without FreeBSD), so could you please add the output of "bt full" to this report?

lightsgoout

2011-11-18 06:46

reporter   ~0001861

Sure,

(gdb) bt full
#0 xdebug_var_export (struc=0x7fffffffbd98, str=0x7fffffffbda0, level=1, debug_zval=0, options=0x80c1f2b40) at /usr/home/i.kolombet/xdebug/xdebug_var.c:386
myht = Variable "myht" is not available.

derick

2011-11-18 09:57

administrator   ~0001863

Please paste the full output, and not just one line.

lightsgoout

2011-11-18 12:43

reporter   ~0001864

Well, it WAS the full output, just that single line.
What was before that one line was loading libraries (or symbols).

Sorry, but today our php was upgraded from 5.3.6 to 5.3.8, so gdb doesn't show anything useful now.
I compiled php 5.3.6 with --enable-debug on the same server though, but it didn't help either.

And I can't reproduce same bug neither with new and old PHP, that's weird.

derick

2012-03-07 19:54

administrator   ~0001957

Let me just close the issue then. Feel free to re-open if you see it again.

Issue History

Date Modified Username Field Change
2011-11-17 15:22 lightsgoout New Issue
2011-11-17 15:22 lightsgoout File Added: php.rar
2011-11-17 15:25 lightsgoout Note Added: 0001858
2011-11-17 17:49 derick Note Added: 0001859
2011-11-17 17:49 derick Assigned To => derick
2011-11-17 17:49 derick Status new => feedback
2011-11-18 06:46 lightsgoout Note Added: 0001861
2011-11-18 06:46 lightsgoout Status feedback => assigned
2011-11-18 09:57 derick Note Added: 0001863
2011-11-18 09:57 derick Status assigned => feedback
2011-11-18 12:43 lightsgoout Note Added: 0001864
2011-11-18 12:43 lightsgoout Status feedback => assigned
2012-03-07 19:54 derick Note Added: 0001957
2012-03-07 19:54 derick Status assigned => resolved
2012-03-07 19:54 derick Resolution open => unable to reproduce
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized