php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63563 Coredump at mqseries_close when using --with-libdir=lib64
Submitted: 2012-11-19 20:29 UTC Modified: 2014-12-01 21:17 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: peter dot buri at netpositive dot hu Assigned: pierrick (profile)
Status: Closed Package: mqseries (PECL)
PHP Version: Irrelevant OS: Linux x86 64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: peter dot buri at netpositive dot hu
New email:
PHP Version: OS:

 

 [2012-11-19 20:29 UTC] peter dot buri at netpositive dot hu
Description:
------------
...

$obj_get = null;
$mqods = array('ObjectName'=>$getChanelName, 'ObjectQMgrName'=>$objectQMgrName);
mqseries_open($conn, $mqods, MQSERIES_MQOO_FAIL_IF_QUIESCING | 
MQSERIES_MQOO_INPUT_AS_Q_DEF, $obj_get, $comp_code, $reason);
if ($comp_code !== MQSERIES_MQCC_OK) {
    echo printf("Open CompCode:%d Reason:%d Text:%s<br>\n", $comp_code, $reason, 
mqseries_strerror($reason));
} else {
    echo "Opening '{$getChanelName}' is done!\n";
}

mqseries_close($conn, $obj_get, MQSERIES_MQCO_NONE, $comp_code, $reason);
if ($comp_code !== MQSERIES_MQCC_OK) {
    echo printf("Close CompCode:%d Reason:%d Text:%s<br>\n", $comp_code, 
$reason, mqseries_strerror($reason));
}


Actual result:
--------------
Core was generated by `php test1.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000006c82b4 in zend_fetch_resource (passed_id=0x7fff54cdb030, 
default_id=-1, resource_type_name=0x7f946adac3c4 "mqseries_conn",
    found_resource_type=0x0, num_resource_types=1) at /build/buildd/php5-
5.4.6/Zend/zend_list.c:126
126     /build/buildd/php5-5.4.6/Zend/zend_list.c: No such file or directory.
(gdb) bt
#0  0x00000000006c82b4 in zend_fetch_resource (passed_id=0x7fff54cdb030, 
default_id=-1, resource_type_name=0x7f946adac3c4 "mqseries_conn",
    found_resource_type=0x0, num_resource_types=1) at /build/buildd/php5-
5.4.6/Zend/zend_list.c:126
#1  0x00007f946ada883f in zif_mqseries_close (ht=5, return_value=0x7f946e1aad48, 
return_value_ptr=<optimized out>, this_ptr=<optimized out>,
    return_value_used=<optimized out>) at /root/install/pecl-networking-
mqseries/mqseries.c:932
#2  0x00000000007601d2 in zend_do_fcall_common_helper_SPEC 
(execute_data=0x7f946e177060) at /build/buildd/php5-
5.4.6/Zend/zend_vm_execute.h:642
#3  0x0000000000719a17 in execute (op_array=0x7f946e1aa200) at 
/build/buildd/php5-5.4.6/Zend/zend_vm_execute.h:410
#4  0x00000000006b984c in zend_execute_scripts (type=1847239128, 
retval=0x300000008, file_count=32660) at /build/buildd/php5-
5.4.6/Zend/zend.c:1289
#5  0x0000000000658c53 in php_execute_script (primary_file=0x0) at 
/build/buildd/php5-5.4.6/main/main.c:2473
#6  0x0000000000762803 in do_cli (argc=0, argv=0x7fff54cdf8b6) at 
/build/buildd/php5-5.4.6/sapi/cli/php_cli.c:988
#7  0x000000000042c420 in main (argc=32767, argv=0x22e11f0) at 
/build/buildd/php5-5.4.6/sapi/cli/php_cli.c:1364
(gdb) frame 0
#0  0x00000000006c82b4 in zend_fetch_resource (passed_id=0x7fff54cdb030, 
default_id=-1, resource_type_name=0x7f946adac3c4 "mqseries_conn",
    found_resource_type=0x0, num_resource_types=1) at /build/buildd/php5-
5.4.6/Zend/zend_list.c:126
126     in /build/buildd/php5-5.4.6/Zend/zend_list.c
(gdb) frame 1
#1  0x00007f946ada883f in zif_mqseries_close (ht=5, return_value=0x7f946e1aad48, 
return_value_ptr=<optimized out>, this_ptr=<optimized out>,
    return_value_used=<optimized out>) at /root/install/pecl-networking-
mqseries/mqseries.c:932
932             ZEND_FETCH_RESOURCE(mqdesc, mqseries_descriptor *, &z_mqdesc, 
-1, PHP_MQSERIES_DESCRIPTOR_RES_NAME, le_mqseries_conn);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-20 03:19 UTC] pierrick@php.net
-Assigned To: +Assigned To: pierrick
 [2012-11-20 03:26 UTC] pierrick@php.net
-Status: Assigned +Status: Feedback
 [2012-11-20 03:26 UTC] pierrick@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.

Could you provide me a complete script to reproduce your issue and an explanation 
of the problem ? When does it occur ? The current bug description is not explicit 
at all.

Thanks
 [2012-11-20 11:20 UTC] peter dot buri at netpositive dot hu
-Status: Feedback +Status: Assigned
 [2012-11-20 11:20 UTC] peter dot buri at netpositive dot hu
I try to give you as many information as i can.

Environment:
------------

root@mqtest64:/mnt/share/mqtest# uname -a
Linux mqtest64 3.5.0-18-generic #29-Ubuntu SMP Fri Oct 19 10:26:51 UTC 2012 
x86_64 x86_64 x86_64 GNU/Linux
root@mqtest64:/mnt/share/mqtest# php -v
PHP 5.4.6-1ubuntu1 (cli) (built: Aug 22 2012 21:13:52)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies


Script:
------------

<?php

$objectQMgrName = 'TEST_QM';
$getChanelName = 'TEST_GET';

$mqcno = array(
    'Version' => MQSERIES_MQCNO_VERSION_2,
    'Options' => MQSERIES_MQCNO_STANDARD_BINDING,
    'MQCD' => array(
        'ChannelName' => 'SYSTEM.DEF.SVRCONN',
        'ConnectionName' => '127.0.0.1(1415)',
        'TransportType' => MQSERIES_MQXPT_TCP
    ),
);

$conn = null;
$comp_code = null;
$reason = null;
mqseries_connx($objectQMgrName, $mqcno, $conn, $comp_code, $reason);
if ($comp_code !== MQSERIES_MQCC_OK) {
    echo mqseries_log("mqseries_connx", $comp_code, $reason);
    exit(1);
}

$obj_get = null;
$mqods = array('ObjectName'=>$getChanelName, 'ObjectQMgrName'=>$objectQMgrName);
mqseries_open($conn, $mqods, MQSERIES_MQOO_FAIL_IF_QUIESCING | 
MQSERIES_MQOO_INPUT_AS_Q_DEF, $obj_get, $comp_code, $reason);
if ($comp_code !== MQSERIES_MQCC_OK) {
    echo mqseries_log('mqseries_open '.$getChanelName, $comp_code, $reason);
    exit(1);
} else {
    echo "Opening '{$getChanelName}' is done!\n";
}

mqseries_close($conn, $obj_get, MQSERIES_MQCO_NONE, $comp_code, $reason);
if ($comp_code !== MQSERIES_MQCC_OK) {
    echo mqseries_log('mqseries_close '.$getChanelName, $comp_code, $reason);
    exit(1);
}

mqseries_disc($conn, $comp_code, $reason);
if ($comp_code !== MQSERIES_MQCC_OK) {
    echo mqseries_log('mqseries_disc', $comp_code, $reason);
    exit(1);
}

function mqseries_log($identity, $comp_code, $reason) {
    return sprintf("%s error with CompCode:%d Reason:%d Text:%s\n", $identity, 
$comp_code, $reason, mqseries_strerror($reason));
}
?>


Run result:
------------

user@mqtest64:~$ php -e /mnt/share/mqtest/test1.php
Opening 'TEST_QM' is done!
Segmentation fault (core dumped)

user@mqtest64:~$ gdb --directory=/usr/include/php5/ /usr/bin/php5 ~user/core
...
Core was generated by `php test1.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000006c82b4 in zend_fetch_resource (passed_id=0x7fff54cdb030, 
default_id=-1,
    resource_type_name=0x7f946adac3c4 "mqseries_conn", found_resource_type=0x0, 
num_resource_types=1)
    at /build/buildd/php5-5.4.6/Zend/zend_list.c:126
126     /build/buildd/php5-5.4.6/Zend/zend_list.c: No such file or directory.
(gdb) bt
#0  0x00000000006c82b4 in zend_fetch_resource (passed_id=0x7fff54cdb030, 
default_id=-1,
    resource_type_name=0x7f946adac3c4 "mqseries_conn", found_resource_type=0x0, 
num_resource_types=1)
    at /build/buildd/php5-5.4.6/Zend/zend_list.c:126
#1  0x00007f946ada883f in zif_mqseries_close (ht=5, return_value=0x7f946e1aad48, 
return_value_ptr=<optimized out>,
    this_ptr=<optimized out>, return_value_used=<optimized out>) at 
/root/install/pecl-networking-mqseries/mqseries.c:932
#2  0x00000000007601d2 in zend_do_fcall_common_helper_SPEC 
(execute_data=0x7f946e177060)
    at /build/buildd/php5-5.4.6/Zend/zend_vm_execute.h:642
#3  0x0000000000719a17 in execute (op_array=0x7f946e1aa200) at 
/build/buildd/php5-5.4.6/Zend/zend_vm_execute.h:410
#4  0x00000000006b984c in zend_execute_scripts (type=1847239128, 
retval=0x300000008, file_count=32660)
    at /build/buildd/php5-5.4.6/Zend/zend.c:1289
#5  0x0000000000658c53 in php_execute_script (primary_file=0x0) at 
/build/buildd/php5-5.4.6/main/main.c:2473
#6  0x0000000000762803 in do_cli (argc=0, argv=0x7fff54cdf8b6) at 
/build/buildd/php5-5.4.6/sapi/cli/php_cli.c:988
#7  0x000000000042c420 in main (argc=32767, argv=0x22e11f0) at 
/build/buildd/php5-5.4.6/sapi/cli/php_cli.c:1364
(gdb) frame 0
#0  0x00000000006c82b4 in zend_fetch_resource (passed_id=0x7fff54cdb030, 
default_id=-1,
    resource_type_name=0x7f946adac3c4 "mqseries_conn", found_resource_type=0x0, 
num_resource_types=1)
    at /build/buildd/php5-5.4.6/Zend/zend_list.c:126
126     in /build/buildd/php5-5.4.6/Zend/zend_list.c
(gdbframe 1
#1  0x00007f946ada883f in zif_mqseries_close (ht=5, return_value=0x7f946e1aad48, 
return_value_ptr=<optimized out>,
    this_ptr=<optimized out>, return_value_used=<optimized out>) at 
/root/install/pecl-networking-mqseries/mqseries.c:932
932             ZEND_FETCH_RESOURCE(mqdesc, mqseries_descriptor *, &z_mqdesc, 
-1, PHP_MQSERIES_DESCRIPTOR_RES_NAME, le_mqseries_conn);



On production server:
------------

user@production:~$ uname -a
Linux production 2.6.38-15-server #64-Ubuntu SMP Fri Jul 6 19:08:52 UTC 2012 
x86_64 x86_64 x86_64 GNU/Linux
user@production:~$ php -v
PHP 5.3.5-1ubuntu7.10 with Suhosin-Patch (cli) (built: Jun 19 2012 00:54:01)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
user@production:~$ php test1.php
mqseries_open TEST_QM error with CompCode:2 Reason:2044 Text:Object descriptor 
structure not valid.

In /opt/mqm/inc/cmqc.h

#if defined(MQ_64_BIT)
 typedef int MQLONG;
 typedef unsigned int MQULONG;
 typedef long MQINT64;
 typedef unsigned long MQUINT64;
#else
 typedef long MQLONG;
 typedef unsigned long MQULONG;
 typedef long long MQINT64;
 typedef unsigned long long MQUINT64;
#endif

I don't know if it has any bad effect with this macro:

#define MQSERIES_SETOPT_LONG(s,m) \
    if (zend_hash_find(ht, #m, sizeof(#m), (void**)&tmp) == SUCCESS) {\
        convert_to_long(*tmp); \
        s->m = Z_LVAL_PP(tmp); \
    }
 [2012-12-16 03:05 UTC] pierrick@php.net
-Status: Assigned +Status: Feedback
 [2012-12-16 03:05 UTC] pierrick@php.net
I tried to reproduce your bug on my local but was not able to. What version of 
MQseries are you using ? Did you tried to use the latest version from git ? Or 
tried to update your PHP ? If you have any clue on how I can make this bug appear 
on my side I'll be glad to help you.
 [2013-02-18 00:36 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 [2013-02-18 18:26 UTC] mnichols at ix dot netcom dot com
I too have the same segfault problem at mqseries_close.  Here's my environment:

[root@fatbird mqseries]# uname -a
Linux fatbird 3.7.3-101.fc17.x86_64 #1 SMP Fri Jan 18 17:40:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@fatbird mqseries]# php -v
PHP 5.4.11 (cli) (built: Jan 16 2013 17:29:30) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@fatbird mqseries]# rpm -qa|grep MQ
MQSeriesClient-7.0.1-4.x86_64
MQSeriesSDK-7.0.1-4.x86_64
MQSeriesRuntime-7.0.1-4.x86_64
 [2014-11-24 20:42 UTC] Derrik dot Nyomo at briteskies dot com
I am getting the same error on my dev environment using --with-libdir=lib64 with the default put code included in the example directory.

Here is my server info...
OS:
Linux ubuntu 3.13.0-33-generic #58-Ubuntu SMP Tue Jul 29 16:45:05 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

PHP:
PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

Apanche:
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 22 2014 14:36:38

MQ:
MQSeriesClient-7.5.0-4.x86_64
MQSeriesRuntime-7.5.0-4.x86_64
MQSeriesSDK-7.5.0-4.x86_64

MQSeries PECL Package:
0.14.0

Code:
    mqseries_close($conn, $obj, MQSERIES_MQCO_NONE, $comp_code, $reason);
    if ($comp_code !== MQSERIES_MQCC_OK) {
        printf("CLOSE CompCode:%d Reason:%d Text:%s<br>\n", $comp_code, $reason, mqseries_strerror($reason));
    }

Error:
[Mon Nov 24 15:30:57.082340 2014] [core:notice] [pid 2937] AH00051: child pid 2972 exit signal Segmentation fault (11), possible coredump in /etc/apache
 [2014-11-24 21:12 UTC] Derrik dot Nyomo at briteskies dot com
Here is the cordump
Starting program: /usr/bin/php mqput.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffcbdc2700 (LWP 4039)]
[Thread 0x7fffcbdc2700 (LWP 4039) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00000000006fd9fc in zend_fetch_resource ()
 [2014-11-25 15:57 UTC] Derrik dot Nyomo at briteskies dot com
More Debug information:

(gdb) run mqput.php

Starting program: /usr/bin/php mqput.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffcbff3700 (LWP 1993)]
[Thread 0x7fffcbff3700 (LWP 1993) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00000000006fd9fc in zend_fetch_resource ()

(gdb) bt
#0  0x00000000006fd9fc in zend_fetch_resource ()
#1  0x00007fffee029eb8 in zif_mqseries_close (ht=5, return_value=0x7ffff7fdbc60, return_value_ptr=<optimized out>, this_ptr=<optimized out>,
    return_value_used=<optimized out>) at /var/www/mq/mqseries-0.14.0/mqseries.c:868
#2  0x00000000006dd9cb in dtrace_execute_internal ()
#3  0x000000000079da25 in ?? ()
#4  0x0000000000717758 in execute_ex ()
#5  0x00000000006dd8c9 in dtrace_execute_ex ()
#6  0x00000000006ef350 in zend_execute_scripts ()
#7  0x000000000068f235 in php_execute_script ()
#8  0x000000000079f9fe in ?? ()
#9  0x0000000000461de0 in main ()

(gdb) Quit
 [2014-12-01 21:17 UTC] pierrick@php.net
-Status: No Feedback +Status: Re-Opened
 [2014-12-05 18:48 UTC] pierrick@php.net
Automatic comment on behalf of pierrick@webstart.fr
Revision: http://git.php.net/?p=pecl/networking/mqseries.git;a=commit;h=d7e9ef04bcada67ce9c6cb7ceb9a5f9ec47ea623
Log: Fixed bug #63563. (Segfault when using lib64)
 [2014-12-05 18:48 UTC] pierrick@php.net
-Status: Re-Opened +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 01:01:31 2024 UTC