tony2001 / pinba_extension

Pinba PHP extension
http://pinba.org
GNU Lesser General Public License v2.1
84 stars 22 forks source link

[PHP 5.4] Pinba libprotobuf Core crash #4

Closed ghost closed 12 years ago

ghost commented 12 years ago

php -v

PHP 5.4.3 (cli) (built: May 26 2012 01:07:26) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

gdb /usr/local/bin/php php.core

GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)... Core was generated by `php'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libcrypt.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libcrypt.so.5 Reading symbols from /usr/local/lib/libpcre.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/local/lib/libpcre.so.1 Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libm.so.5 Reading symbols from /usr/local/lib/libxml2.so.5...(no debugging symbols found)...done. Loaded symbols for /usr/local/lib/libxml2.so.5 Reading symbols from /lib/libz.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libz.so.6 Reading symbols from /usr/local/lib/libiconv.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/local/lib/libiconv.so.3 Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /usr/local/lib/php/20100525/pinba.so...done. Loaded symbols for /usr/local/lib/php/20100525/pinba.so Reading symbols from /usr/local/lib/libprotobuf.so.7...done. Loaded symbols for /usr/local/lib/libprotobuf.so.7 Reading symbols from /usr/lib/libstdc++.so.6...done. Loaded symbols for /usr/lib/libstdc++.so.6 Reading symbols from /lib/libgcc_s.so.1...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1

0 0x00000008024968c8 in std::_Rb_tree<std::string, std::pair<std::string const, std::pair<void const, int> >, std::_Select1st<std::pair<std::string const, std::pair<void const, int> > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::pair<void const*, int> > > >::_M_insert_unique () from /usr/local/lib/libprotobuf.so.7

(gdb) bt

0 0x00000008024968c8 in std::_Rb_tree<std::string, std::pair<std::string const, std::pair<void const, int> >, std::_Select1st<std::pair<std::string const, std::pair<void const, int> > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::pair<void const*, int> > > >::_M_insert_unique () from /usr/local/lib/libprotobuf.so.7

1 0x0000000802495999 in google::protobuf::InsertIfNotPresent<std::map<std::string, std::pair<void const, int>, std::lessstd::string, std::allocator<std::pair<std::string const, std::pair<void const, int> > > >, std::string, std::pair<void const*, int> > () from /usr/local/lib/libprotobuf.so.7

2 0x00000008024947bb in google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void const*, int> >::AddFile

() from /usr/local/lib/libprotobuf.so.7

3 0x0000000802493365 in google::protobuf::EncodedDescriptorDatabase::Add () from /usr/local/lib/libprotobuf.so.7

4 0x0000000802463ab6 in google::protobuf::DescriptorPool::InternalAddGeneratedFile () from /usr/local/lib/libprotobuf.so.7

5 0x000000080247c213 in google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto ()

from /usr/local/lib/libprotobuf.so.7

6 0x00000008024c3632 in __do_global_ctors_aux () from /usr/local/lib/libprotobuf.so.7

7 0x0000000802445c4e in _init () from /usr/local/lib/libprotobuf.so.7

8 0x00007fffffffc870 in ?? ()

9 0x00000008008b2497 in r_debug_state () from /libexec/ld-elf.so.1

10 0x00000008008b3a23 in dlopen () from /libexec/ld-elf.so.1

11 0x00000008008b349b in dlopen () from /libexec/ld-elf.so.1

12 0x00000000004af935 in php_load_extension ()

13 0x000000000056c037 in zend_llist_apply ()

14 0x0000000000524bd3 in php_ini_register_extensions ()

15 0x000000000051dd00 in php_module_startup ()

16 0x00000000005fdeb1 in php_cli_startup ()

17 0x00000000005fc765 in main ()

clang -v

FreeBSD clang version 3.0 (branches/release_30 142614) 20111021 Target: x86_64-unknown-freebsd9.0 Thread model: posix


с любовью ваш К.О.

tony2001 commented 12 years ago

Doesn't look lik Pinba issue to me, the backtrace clearly leads to Protobuf. Does it even work when compiled with clang? I don't know. Why don't you try GCC instead?

ghost commented 12 years ago

test gcc, but protobuf.. your extension crash

comment - ;extension=pinba.so - work fine all

ldd /usr/local/lib/php/20100525/pinba.so

/usr/local/lib/php/20100525/pinba.so: libprotobuf.so.7 => /usr/local/lib/libprotobuf.so.7 (0x801210000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x80150d000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x801802000) libc.so.7 => /lib/libc.so.7 (0x80084a000) libz.so.6 => /lib/libz.so.6 (0x801a0f000) libm.so.5 => /lib/libm.so.5 (0x801c25000)

pkg_info | grep protobuf

protobuf-2.4.1 A data interchange format library

php debug mode

12 0x000000000052c3cc in php_load_extension (filename=0x8020300b8 "pinba.so", type=1, start_now=0) at dl.c:144

handle = (void _) 0xba4830
extension_dir = 0x8f0380 "/usr/local/lib/php/20100525-debug"
libpath = 0x8020301f0 "/usr/local/lib/php/20100525-debug/pinba.so"
module_entry = (zend_module_entry *) 0x9032d4
get_module = (zend_module_entry *(_)(void)) 0x200900998
error_type = 32

checking for Google Protocol Buffers files in default path... found in /usr/local checking for Google Protobuf compiler... /usr/local/bin/protoc checking for Google Protobuf version... 2.4.1

tony2001 commented 12 years ago

Пересобирал GCC что? Экстеншен или Protobuf? Проблема явно в Protobuf + FreeBSD, у других всё прекрасно.

ghost commented 12 years ago

еще бага в порте

make install clean

===> php5-pinba-2011.08.18 cannot install: doesn't work with PHP version : 5 (Doesn't support PHP 5). *\ Error code 1

Stop in /usr/ports/devel/php5-pinba.

tony2001 commented 12 years ago

Ок, я в ближайшее время переделаю экстеншен на protobuf-c вместо либы на С++. Насчет порта - к сожалению, без понятия что там и почему оно не поддерживает php5.

ghost commented 12 years ago

на "Си" будет по феншую, спасибо!

tony2001 commented 12 years ago

Готово. В бранче protobuf_c теперь С-шная версия, без зависимости от libprotobuf.

ghost commented 12 years ago

да все отлично теперь все собираеться и работает, хотя php-клиент стал чуть дольше запускаться

tony2001 commented 12 years ago

есть какие-то детали? что значит начал дольше запускаться? он же при старте ничего не делает, только при request shutdown.

ghost commented 12 years ago

в общем protobuf_c отлично пашет, можно мэйнтейнером в порты запилить