zendtech / ZendOptimizerPlus

Other
915 stars 142 forks source link

segfault after opcache_reset #96

Closed altexdim closed 11 years ago

altexdim commented 11 years ago

i'm working on a big project - 2k files and 60Mb of php code, and after ~4 000 000 hits in cache i try to do opcache_reset, then i've got several segfaults

here is the trace

Core was generated by `php-fpm: pool www '. Program terminated with signal 11, Segmentation fault.

0 __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:32

32 pcmpeqb (%rdi), %xmm1 Missing separate debuginfos, use: debuginfo-install cairo-1.8.8-3.1.el6.x86_64 fftw-3.2.1-3.1.el6.x86_64 lcms-libs-1.19-1.el6.x86_64 libc-client-2007e-11.el6.x86_64 libidn-1.18-2.el6.x86_64 libmcrypt-2.5.8-9.el6.x86_64 librabbitmq-0.2-0.1.git2059570.el6.remi.x86_64 libtool-ltdl-2.2.6-15.5.el6.x86_64 sqlite-3.6.20-1.el6.x86_64 xz-libs-4.999.9-0.3.beta.20091007git.el6.x86_64 (gdb) bt

0 __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:32

1 0x00000000008df20e in zend_error (type=2048, format=0xd9aa50 "Declaration of %s::%s() should be compatible with %s") at /usr/build/php/php-5.4.14/Zend/zend.c:1150

2 0x00000000008b7ff6 in do_inheritance_check_on_method (child=0x384c570, parent=0x2449fe0) at /usr/build/php/php-5.4.14/Zend/zend_compile.c:3275

3 0x00000000008b80b0 in do_inherit_method_check (child_function_table=0x3840148, parent=0x2449fe0, hash_key=0x7fff66808bc0, child_ce=0x3840120) at /usr/build/php/php-5.4.14/Zend/zend_compile.c:3295

4 0x00000000008f2998 in zend_hash_replace_checker_wrapper (target=0x3840148, source_data=0x2449fe0, p=0x2418d50, pParam=0x3840120, merge_checker_func=0x8b8025 )

at /usr/build/php/php-5.4.14/Zend/zend_hash.c:878

5 0x00000000008f2a26 in zend_hash_merge_ex (target=0x3840148, source=0x24446a8, pCopyConstructor=0x8b69c4 , size=240, pMergeSource=0x8b8025 , pParam=0x3840120)

at /usr/build/php/php-5.4.14/Zend/zend_hash.c:892

6 0x00000000008b9169 in zend_do_inheritance (ce=0x3840120, parent_ce=0x2444680) at /usr/build/php/php-5.4.14/Zend/zend_compile.c:3526

7 0x00000000008bbe4c in do_bind_inherited_class (op_array=0x3839d80, opline=0x3838800, class_table=0x2027c90, parent_ce=0x2444680, compile_time=0 '\000') at /usr/build/php/php-5.4.14/Zend/zend_compile.c:4413

8 0x00000000008bc51d in zend_do_delayed_early_binding (op_array=0x3839d80) at /usr/build/php/php-5.4.14/Zend/zend_compile.c:4509

9 0x00007f4b2eed5539 in zend_accel_load_script (persistent_script=0x319e870, from_shared_memory=0) at /usr/build/ZendOptimizerPlus/zend_accelerator_util_funcs.c:935

10 0x00007f4b2eec8a60 in persistent_compile_file (file_handle=0x7fff66808f60, type=2) at /usr/build/ZendOptimizerPlus/ZendAccelerator.c:1664

11 0x000000000088454d in compile_filename (type=2, filename=0x37b9ff0) at Zend/zend_language_scanner.l:626

12 0x000000000096d37a in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (execute_data=0x7f4b3d1abf90) at /usr/build/php/php-5.4.14/Zend/zend_vm_execute.h:27356

13 0x000000000091d0db in execute (op_array=0x33fccf0) at /usr/build/php/php-5.4.14/Zend/zend_vm_execute.h:410

14 0x00000000008ccad2 in zend_call_function (fci=0x7fff66809390, fci_cache=0x7fff66809320) at /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:958

15 0x00000000009000ab in zend_call_method (object_pp=0x0, obj_ce=0x33fc5f0, fn_proxy=0x3405148, function_name=0x34050d8 "autoloader::autoload", function_name_len=21, retval_ptr_ptr=0x7fff66809498, param_count=1, arg1=0x3825e68, arg2=

0x0) at /usr/build/php/php-5.4.14/Zend/zend_interfaces.c:97

16 0x00000000006ea042 in zif_spl_autoload_call (ht=1, return_value=0x381a658, return_value_ptr=0x7fff66809740, this_ptr=0x0, return_value_used=1) at /usr/build/php/php-5.4.14/ext/spl/php_spl.c:436

17 0x00000000008ccd0d in zend_call_function (fci=0x7fff668096f0, fci_cache=0x7fff668096c0) at /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:980

18 0x00000000008cd576 in zend_lookup_class_ex (name=0x240a530 "AppPlatform_SubscriberClusterMapper", name_length=35, key=0x240ceb0, use_autoload=1, ce=0x7fff66809830) at /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:1127

19 0x00000000008ce449 in zend_fetch_class_by_name (class_name=0x240a530 "AppPlatform_SubscriberClusterMapper", class_name_len=35, key=0x240ceb0, fetch_type=0) at /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:1607

20 0x000000000092490e in ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER (execute_data=0x7f4b3d1abd40) at /usr/build/php/php-5.4.14/Zend/zend_vm_execute.h:3421

21 0x000000000091d0db in execute (op_array=0x3359890) at /usr/build/php/php-5.4.14/Zend/zend_vm_execute.h:410

22 0x00000000008dff90 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/build/php/php-5.4.14/Zend/zend.c:1315

23 0x000000000084bd2b in php_execute_script (primary_file=0x7fff6680df30) at /usr/build/php/php-5.4.14/main/main.c:2492

24 0x0000000000998057 in main (argc=3, argv=0x7fff6680e158) at /usr/build/php/php-5.4.14/sapi/fpm/fpm/fpm_main.c:1924

altexdim commented 11 years ago

and sometimes instead of segfaults after reset cache i have something like this

[15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated (p���J) (source: /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:438)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated (WϬ�j��) (source: /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:438)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated (USER) (source: /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:438)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated (����K�) (source: /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:438)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated (WϬ�j��) (source: /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:438)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated () (source: /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:438)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated () (source: /usr/build/php/php-5.4.14/Zend/zend_execute_API.c:438)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated (WϬ�j��) (source: /usr/build/php/php-5.4.14/Zend/zend_constants.c:33)" [15-May-2013 16:13:28] WARNING: [pool www] child 2184 said into stderr: "Unknown(0) : Warning - String is not zero-terminated (_amount) (source: /usr/build/php/php-5.4.14/Zend/zend_constants.c:33)" [15-Ma

altexdim commented 11 years ago

actualy the same issue after restars and after deploying files =(

dstogov commented 11 years ago

Could you provide instruction how to reproduce it. e.g. start PHP, request some file, touch it, wait, request it again... I suppose it mist be some bug specific to your application, because nobody reported such issue yet.

altexdim commented 11 years ago

Yes, i think it's project related bug, because of so many files and many lines of code, thats why it's hard to reproduce it in a clean evironment.

I just start nginx and fpm then i wait for some minutes, having random 50 req/s on this server then i call opcache_reset and then i get segfautls

ocp stats shows 2k files in cache and 4M hits i use latest stable php and without opcache it works without any segfaults i case of deploy i copy all the new code into the new folder, then i change docroot in nginx to this new folder and then send HUP to nginx to reload config, so only new version of the files is been loaded to opcache from the new folder, so old files are not been changed

dstogov commented 11 years ago

This is a PHP bug https://bugs.php.net/bug.php?id=64720 It's not related to OPcache.