public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* FW: C++ PHP Extension Segfaults Under Apache.
@ 2007-05-09 16:45 Bruce Bailey
  2007-05-10 21:00 ` Darryl Miles
  0 siblings, 1 reply; 2+ messages in thread
From: Bruce Bailey @ 2007-05-09 16:45 UTC (permalink / raw)
  To: gcc-help

Hi

A discovery!

It appears that if I link my top level "C" program (httpd, 'apache' in this 
case) with g++, my problem disappears.  I suspect that this MIGHT be a 
problem with the gcc compiler.  Has anyone heard of this pattern before?

To recap:

"C" program
dlopen "C" library which
dlopen's another "C" library,
which autoloads a C++ library

segfaults in the std::string library.

Thanks,

Bruce


>From: "Bruce Bailey" <bruce1828@hotmail.com>
>To: gcc-help@gcc.gnu.org
>Subject: C++ PHP Extension Segfaults Under Apache.
>Date: Thu, 26 Apr 2007 13:28:14 -0700
>
>Hi
>
>Please let me know if there's a better forum for this question . . .
>
>I have been trying mightily to resolve a rather sticky problem and would 
>really appreciate any suggestions as to how I can resolve this.
>
>There are really two problems:
>
>1.  Starting apache in normal run mode – apache dies immediately with no 
>logs or core files.  Since Apache forks, I can't get gdb to trace the 
>process that aborts.
>
>2.  Starting apache in single process mode (-X) runs OK until I try to 
>append to an std::string, at which time it aborts in 
>std::string::_Rep::_S_create (see backtrace, below).  The function  
>std::string::assign has a this pointer with an address of 0x3!
>
>Do either of these (especially the 2nd) sound like a known problem?
>Any suggestions as to how to track down what's happening?
>
>Thanks in advance,
>
>Bruce
>
>Calling structure:
>
>mainline (httpd) “C” Apache/1.3.33
>dlopen (apache module) libphp5.so “C” PHP 5.1.4
>dlopen (php extension) my PHP extension “C++”
>loads my library “C++”
>
>
>Software versions:
>
>g++ (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Copyright (C) 2002 Free Software Foundation, Inc.
>
>Linux C621177 2.4.21-40.EL.1-3 #1 SMP Thu Apr 5 13:31:00 PDT 2007 i686 i686 
>i386 GNU/Linux
>
>
>Program received signal SIGSEGV, Segmentation fault.
>std::string::_Rep::_S_create (__capacity=3, __alloc=@0xbfffa1b0)
>    at 
>/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/i386-redhat-linux/libstdc++-v3/include/bits/stl_alloc
>.h:397
>397     
>/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/i386-redhat-linux/libstdc++-v3/include/bits/stl_allo
>c.h: No such file or directory.
>        in 
>/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/i386-redhat-linux/libstdc++-v3/include/bits/stl_a
>lloc.h
>Current language:  auto; currently c++
>(gdb) bt
>#0  std::string::_Rep::_S_create (__capacity=3, __alloc=@0xbfffa1b0)
>    at 
>/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/i386-redhat-linux/libstdc++-v3/include/bits/stl_alloc
>.h:397
>#1  0xb63a2eed in std::string::_M_mutate (this=0xbfffa310, __pos=0, 
>__len1=0, __len2=3)
>    at 
>/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/i386-redhat-linux/libstdc++-v3/include/bits/basic_str
>ing.h:403
>#2  0xb6858cb2 in std::string::_M_replace_safe<char const*> 
>(this=0xbfffa310, __i1=
>      {<std::iterator<std::random_access_iterator_tag, char, int, char*, 
>char&>> = {<No data fields>}, _M_current = 0xb63e978c ""},
>__k1=0x85178e0 "1.0", __k2=0x85178e3 "") at 
>/usr/include/c++/3.2/bits/basic_string.tcc:534
>#3  0xb63a3a6f in std::string::assign (this=0x3, __n=3)
>    at 
>/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/i386-redhat-linux/libstdc++-v3/include/bits/basic_str
>ing.h:242
>#4  0xb67d1d40 in CEOAPINode::StoreAttributes (this=0x85137d0, 
>attrs=@0x85012a0) at /usr/include/c++/3.2/bits/char_traits.h:135
>#5  0xb67d40df in CEOAPIRequest::StoreAttributes (this=0x85137d0, 
>attrs=@0x85012a0) at EOAPIRequest.cpp:76
>#6  0xb67cafae in CEOAPIEventHandler::startElement (this=0xbfffc7c0, 
>uri=0x8513208, localname=0x85133c8, qname=0x8513378,
>    attrs=@0x85012a0) at EOAPIEventHandler.cpp:147
>#7  0xb65e4064 in xercesc_2_7::SAX2XMLReaderImpl::startElement () from 
>/abc/lib/libxerces-c.so.27
>#8  0xb65a8482 in xercesc_2_7::IGXMLScanner::scanStartTagNS () from 
>/abc/lib/libxerces-c.so.27
>#9  0xb65a4e7c in xercesc_2_7::IGXMLScanner::scanContent () from 
>/abc/lib/libxerces-c.so.27
>#10 0xb65a3a1d in xercesc_2_7::IGXMLScanner::scanDocument () from 
>/abc/lib/libxerces-c.so.27
>#11 0xb65e3591 in xercesc_2_7::SAX2XMLReaderImpl::parse () from 
>/abc/lib/libxerces-c.so.27
>#12 0xb67da541 in EOAPI_ProcessXML::processXML (
>    xml=0x84f8b94 "<?xml version=\"1.0\" 
>encoding=\"UTF-8\"?>\r\n<eoapi:Request 
>xmlns:eoapi=\"http://www.abc.com/eoapi\" version=\"1
>.0\" ShowUnknownElementErrors=\"Yes\" 
>ShowTiming=\"No\">\r\n\t<Session>\r\n\t\t<Connection>\r\n\t\t\t<Host>ryukyu"...,
>    returnAddress=0x8504204 "", out=@0xbfffc8a0) at 
>EOAPI_ProcessXML.cpp:238
>#13 0xb68e7ce7 in zif_eoapi_processxml () from /abc/lib/php_eoapi.so.1.1
>#14 0xb7250999 in zend_do_fcall_common_helper_SPEC 
>(execute_data=0xbfffcb40)
>    at 
>/releases/SW812/working/SW/abc/bin/php/linux/php-5.1.4/Zend/zend_vm_execute.h:200
>#15 0xb59de47b in get_module () from 
>/abc/local/Zend/lib/Optimizer-2.6.1/php-5.1.x/ZendOptimizer.so
>#16 0xbfffcb40 in ?? ()
>#17 0x085040c4 in ?? ()
>#18 0x00000011 in ?? ()
>#19 0xacbf7522 in ?? ()
>#20 0x08501a74 in ?? ()
>---Type <return> to continue, or q <return> to quit---
>
>_________________________________________________________________
>Download Messenger. Join the iÂ’m Initiative. Help make a difference today. 
>http://im.live.com/messenger/im/home/?source=TAGHM_APR07
>

_________________________________________________________________
Catch suspicious messages before you open them—with Windows Live Hotmail. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_protection_0507

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: FW: C++ PHP Extension Segfaults Under Apache.
  2007-05-09 16:45 FW: C++ PHP Extension Segfaults Under Apache Bruce Bailey
@ 2007-05-10 21:00 ` Darryl Miles
  0 siblings, 0 replies; 2+ messages in thread
From: Darryl Miles @ 2007-05-10 21:00 UTC (permalink / raw)
  To: Bruce Bailey; +Cc: gcc-help

Bruce Bailey wrote:
> It appears that if I link my top level "C" program (httpd, 'apache' in 
> this case) with g++, my problem disappears.  I suspect that this MIGHT 
> be a problem with the gcc compiler.  Has anyone heard of this pattern 
> before?

Anything to do with GCC3 and GCC4, stdc++ libraries ?


Run "ldd httpd" and "ldd all_my_dsos.so" and compare for same version of 
C++ libraries.

Darryl

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-10 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09 16:45 FW: C++ PHP Extension Segfaults Under Apache Bruce Bailey
2007-05-10 21:00 ` Darryl Miles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).