Hello,

I am running Piwik version 0.2.32 on a Fedora Core 6 server with PHP 5.1.6. When the cron /misc/cron/archive.sh is run I get the following mail message:

Subject: Cron <apache@hostname> /var/www/html/piwik/misc/cron/archive.sh > /dev/null
Body:

glibc detected /usr/bin/php: double free or corruption (!prev): 0x0962e7f0 ***
======= Backtrace: =========
/lib/i686/nosegneg/libc.so.6[0x9a3e3d]
/lib/i686/nosegneg/libc.so.6(cfree+0x90)[0x9a74f0]
/usr/bin/php(efree+0x88)[0x81b7348]
/usr/bin/php(
zval_dtor_func+0x55)[0x81ccb25]
/usr/bin/php(zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php[0x8228664]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php[0x81e7bdc]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php(zend_call_function+0x3f3)[0x81c37b3]
/usr/bin/php(zend_call_method+0xa6)[0x81df086]
/usr/bin/php(zend_objects_destroy_object+0x10e)[0x81e38de]
/usr/bin/php(zend_objects_store_del_ref+0x6e)[0x81e622e]
/usr/bin/php(
zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php(zend_hash_destroy+0x36)[0x81d6226]
/usr/bin/php(zval_dtor_func+0x55)[0x81ccb25]
/usr/bin/php(
zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php(zend_hash_del_key_or_index+0x1ed)[0x81d803d]
/usr/bin/php[0x81e5030]
/usr/bin/php[0x81e9bc7]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php(zend_call_function+0x3f3)[0x81c37b3]
/usr/bin/php(zend_call_method+0xa6)[0x81df086]
/usr/bin/php(zend_objects_destroy_object+0x10e)[0x81e38de]
/usr/bin/php(zend_objects_store_del_ref+0x6e)[0x81e622e]
/usr/bin/php(zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php(zend_hash_destroy+0x36)[0x81d6226]
/usr/bin/php(
zval_dtor_func+0x55)[0x81ccb25]
/usr/bin/php(zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php[0x821c146]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php[0x81e7bdc]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php(zend_call_function+0x3f3)[0x81c37b3]
/usr/bin/php(zend_call_method+0xa6)[0x81df086]
/usr/bin/php(zend_objects_destroy_object+0x10e)[0x81e38de]
/usr/bin/php(zend_objects_store_del_ref+0x6e)[0x81e622e]
/usr/bin/php(
zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php(zend_hash_destroy+0x36)[0x81d6226]
/usr/bin/php(zval_dtor_func+0x55)[0x81ccb25]
/usr/bin/php(
zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php(zend_hash_del_key_or_index+0x1ed)[0x81d803d]
/usr/bin/php[0x81e5030]
/usr/bin/php[0x81e9bc7]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php(zend_call_function+0x3f3)[0x81c37b3]
/usr/bin/php(zend_call_method+0xa6)[0x81df086]
/usr/bin/php(zend_objects_destroy_object+0x10e)[0x81e38de]
/usr/bin/php(zend_objects_store_del_ref+0x6e)[0x81e622e]
/usr/bin/php(zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php(zend_hash_destroy+0x36)[0x81d6226]
/usr/bin/php(
zval_dtor_func+0x55)[0x81ccb25]
/usr/bin/php(zval_ptr_dtor+0x58)[0x81c2238]
/usr/bin/php(
zend_hash_quick_add_or_update+0xb5)[0x81d6b45]
/usr/bin/php[0x81e5a81]
/usr/bin/php[0x8221d9c]
/usr/bin/php[0x822269b]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php[0x81e7bdc]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php[0x81e7bdc]
/usr/bin/php(execute+0x149)[0x81e9349]
/usr/bin/php[0x81e7bdc]
======= Memory map: ========
00101000-00142000 r-xp 00000000 ca:02 33602 /lib/libssl.so.0.9.8b
00142000-00146000 rw-p 00040000 ca:02 33602 /lib/libssl.so.0.9.8b
00148000-00183000 r-xp 00000000 ca:02 2118220 /usr/lib/libcurl.so.3.0.0
00183000-00184000 rw-p 0003b000 ca:02 2118220 /usr/lib/libcurl.so.3.0.0
00184000-001b4000 r-xp 00000000 ca:02 2122912 /usr/lib/libidn.so.11.5.19
001b4000-001b5000 rw-p 0002f000 ca:02 2122912 /usr/lib/libidn.so.11.5.19
001b5000-001b8000 r-xp 00000000 ca:02 2183374 /usr/lib/php/modules/fileinfo.so

[... deleted section ...]

05323000-0532b000 r-xp 00000000 ca:02 2121029 /usr/lib/libSM.so.6.0.0
0532b000-0532c000 rw-p 00007000 ca:02 2121029 /usr/lib/libSM.so.6.0.0
05346000-0535d000 r-xp 00000000 ca:02 2122605 /usr/lib/libICE.so.6.3.0
0535d000-0535e000 rw-p 00016000 ca:02 2122605 /usr/lib/libICE.so.6.3.0
0535e000-05360000 rw-p 0535e000 00:00 0
0600e000-06062000 r-xp 00000000 ca:02 2123004 /usr/lib/libXt.so.6.0.0
06062000-06066000 rw-p 00054000 ca:02 2123004 /usr/lib/libXt.so.6.0.0
06a65000-06ac2000 r-xp 00000000 ca:02 2122146 /usr/lib/libsqlite3.so.0.8.6
06ac2000-06ac4000 rw-p 0005c000 ca:02 2122146 /usr/lib/libsqlite3.so.0.8.6
06b68000-06c87000 r-xp 00000000 ca:02 2298998 /usr/lib/mysql/libmysqlclient.so.15.0.0
06c87000-06cc9000 rw-p 0011e000 ca:02 2298998 /usr/lib/mysql/libmysqlclient.so.15.0.0
06cc9000-06cca000 rw-p 06cc9000 00:00 0
07a43000-07a74000 r-xp 00000000 ca:02 2122152 /usr/lib/libmcrypt.so.4.4.7
07a74000-07a77000 rw-p 00031000 ca:02 2122152 /usr/lib/libmcrypt.so.4.4.7
07a77000-07a7c000 rw-p 07a77000 00:00 0
08045000-082c5000 r-xp 00000000 ca:02 2121039 /usr/bin/php
082c5000-08316000 rw-p 00280000 ca:02 2121039 /usr/bin/php
08316000-0831d000 rw-p 08316000 00:00 0
08d04000-09675000 rw-p 08d04000 00:00 0
b7b00000-b7b21000 rw-p b7b00000 00:00 0
b7b21000-b7c00000 ---p b7b21000 00:00 0
b7cbd000-b7ebd000 r--p 00000000 ca:02 2153321 /usr/lib/locale/locale-archive
b7ebd000-b7edd000 rw-p b7ebd000 00:00 0
b7f0a000-b7f11000 rw-p b7f0a000 00:00 0
b7f19000-b7f1a000 rw-p b7f19000 00:00 0
bfae3000-bfaf8000 rw-p bfae3000 00:00 0 [stack]
/var/www/html/piwik/misc/cron/archive.sh: line 18: 11381 Aborted $CMD

That shell script makes only PHP CLI calls.

My question: can anyone please tell me where that nasty dump above can come from ? I mean.. is it a PHP bug or is it bad php programming ?

The dump starts with:
glibc detected /usr/bin/php: double free or corruption (!prev): 0x0962e7f0 ***

what does glibc has to do with everything ?

I have no idea on this one.

Thank you !

    A little Googling indicates it's some sort of memory allocation/deallocation error in PHP's underlying C code. I didn't find a clear-cut solution, but indications of things to do to stop the error-reporting, such as compiling PHP without the --enable-dmalloc option, or in your shell script try adding the following command before running anything else:

    export MALLOC_CHECK_=0
    

    Or, wait for someone who knows more about this kind of stuff than me to come along and answer this. 😉

      thank you for your reply!

      momentarily i cannot reinstall php or any piece of software from the server... I hope there is a solution to this working only with the php configuration or something.

      If anybody has any idea, please, share it!

        As NogDog pointed out, the glibc error you're getting comes from the actual C source code that drives the PHP parser. While it could potentially be something about your script/setup, PHP shouldn't be spouting off memory errors IMHO.

        Therefore, you might consider taking this backtrace along with any additional information about what causes the error (e.g. extensions installed and which ones your script uses) over to bugs.php.net and claiming it is a bug. The worst that could happen is that you're wrong and someone will suggest what the actual cause of the error is, and the best that could happen is that it actually is an error and someone will fix it. 🙂

          bradgrafelman wrote:

          Therefore, you might consider taking this backtrace along with any additional information about what causes the error (e.g. extensions installed and which ones your script uses) over to bugs.php.net and claiming it is a bug.

          But upgrade PHP first. The developers won't appreciate you reporting something if they had fixed it two years ago.

            Write a Reply...