Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception causes memory corruption on shutdown #2829

Closed
sjinks opened this issue Sep 21, 2014 · 1 comment
Closed

Uncaught exception causes memory corruption on shutdown #2829

sjinks opened this issue Sep 21, 2014 · 1 comment

Comments

@sjinks
Copy link
Contributor

sjinks commented Sep 21, 2014

Test case:

<?php
throw new \Exception("Hi!");
?>

Valgrind:

==9758== Invalid write of size 8
==9758==    at 0x82695C9: zm_post_zend_deactivate_phalcon (phalcon.c:653)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d360 is 0 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281557: phalcon_deinitialize_memory (memory.c:149)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 8
==9758==    at 0x82695D0: zm_post_zend_deactivate_phalcon (phalcon.c:653)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d368 is 8 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281557: phalcon_deinitialize_memory (memory.c:149)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 8
==9758==    at 0x82695D8: zm_post_zend_deactivate_phalcon (phalcon.c:653)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d370 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281557: phalcon_deinitialize_memory (memory.c:149)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid read of size 4
==9758==    at 0x82695E0: zm_post_zend_deactivate_phalcon (zend.h:381)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d370 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281557: phalcon_deinitialize_memory (memory.c:149)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x82695E8: zm_post_zend_deactivate_phalcon (phalcon.c:656)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d3d5 is 21 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828155F: phalcon_deinitialize_memory (memory.c:150)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 4
==9758==    at 0x82695EC: zm_post_zend_deactivate_phalcon (phalcon.c:656)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d3d0 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828155F: phalcon_deinitialize_memory (memory.c:150)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x82695F7: zm_post_zend_deactivate_phalcon (phalcon.c:658)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d3d4 is 20 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828155F: phalcon_deinitialize_memory (memory.c:150)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid read of size 4
==9758==    at 0x82695FB: zm_post_zend_deactivate_phalcon (zend.h:381)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d3d0 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828155F: phalcon_deinitialize_memory (memory.c:150)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 8
==9758==    at 0x8269603: zm_post_zend_deactivate_phalcon (phalcon.c:658)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d3c0 is 0 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828155F: phalcon_deinitialize_memory (memory.c:150)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x826960E: zm_post_zend_deactivate_phalcon (phalcon.c:660)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d435 is 21 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281567: phalcon_deinitialize_memory (memory.c:151)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 4
==9758==    at 0x8269612: zm_post_zend_deactivate_phalcon (phalcon.c:660)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d430 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281567: phalcon_deinitialize_memory (memory.c:151)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x826961D: zm_post_zend_deactivate_phalcon (phalcon.c:662)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d434 is 20 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281567: phalcon_deinitialize_memory (memory.c:151)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid read of size 4
==9758==    at 0x8269621: zm_post_zend_deactivate_phalcon (zend.h:381)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d430 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281567: phalcon_deinitialize_memory (memory.c:151)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 8
==9758==    at 0x8269629: zm_post_zend_deactivate_phalcon (phalcon.c:662)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d420 is 0 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281567: phalcon_deinitialize_memory (memory.c:151)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 4
==9758==    at 0x8269634: zm_post_zend_deactivate_phalcon (phalcon.c:664)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d490 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828156F: phalcon_deinitialize_memory (memory.c:152)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x826963B: zm_post_zend_deactivate_phalcon (phalcon.c:664)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d495 is 21 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828156F: phalcon_deinitialize_memory (memory.c:152)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x8269643: zm_post_zend_deactivate_phalcon (phalcon.c:666)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d494 is 20 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828156F: phalcon_deinitialize_memory (memory.c:152)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid read of size 4
==9758==    at 0x8269647: zm_post_zend_deactivate_phalcon (zend.h:381)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d490 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828156F: phalcon_deinitialize_memory (memory.c:152)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 8
==9758==    at 0x826964F: zm_post_zend_deactivate_phalcon (phalcon.c:666)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d480 is 0 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x828156F: phalcon_deinitialize_memory (memory.c:152)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 4
==9758==    at 0x826965A: zm_post_zend_deactivate_phalcon (phalcon.c:668)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d4f0 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281577: phalcon_deinitialize_memory (memory.c:153)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x8269661: zm_post_zend_deactivate_phalcon (phalcon.c:668)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d4f5 is 21 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281577: phalcon_deinitialize_memory (memory.c:153)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 1
==9758==    at 0x8269669: zm_post_zend_deactivate_phalcon (phalcon.c:670)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d4f4 is 20 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281577: phalcon_deinitialize_memory (memory.c:153)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid read of size 4
==9758==    at 0x8269671: zm_post_zend_deactivate_phalcon (zend.h:381)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d4f0 is 16 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281577: phalcon_deinitialize_memory (memory.c:153)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== Invalid write of size 8
==9758==    at 0x8269675: zm_post_zend_deactivate_phalcon (phalcon.c:670)
==9758==    by 0x72F361: exec_done_cb (zend.c:927)
==9758==    by 0x73D927: zend_hash_apply (zend_hash.c:673)
==9758==    by 0x7309E5: zend_post_deactivate_modules (zend.c:935)
==9758==    by 0x6D61E8: php_request_shutdown (main.c:1637)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758==  Address 0x8f0d4e0 is 0 bytes inside a block of size 32 free'd
==9758==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9758==    by 0x8281577: phalcon_deinitialize_memory (memory.c:153)
==9758==    by 0x82696AB: zm_deactivate_phalcon (phalcon.c:616)
==9758==    by 0x73717E: module_registry_cleanup (zend_API.c:2150)
==9758==    by 0x73DBD6: zend_hash_reverse_apply (zend_hash.c:755)
==9758==    by 0x730764: zend_deactivate_modules (zend.c:866)
==9758==    by 0x6D61FA: php_request_shutdown (main.c:1607)
==9758==    by 0x4296CF: main (php_cli.c:1373)
==9758== 
==9758== 
==9758== HEAP SUMMARY:
==9758==     in use at exit: 1,625 bytes in 11 blocks
==9758==   total heap usage: 50,781 allocs, 50,770 frees, 6,977,615 bytes allocated
==9758== 
==9758== LEAK SUMMARY:
==9758==    definitely lost: 264 bytes in 2 blocks
==9758==    indirectly lost: 1,329 bytes in 8 blocks
==9758==      possibly lost: 0 bytes in 0 blocks
==9758==    still reachable: 32 bytes in 1 blocks
==9758==         suppressed: 0 bytes in 0 blocks
==9758== Rerun with --leak-check=full to see details of leaked memory
==9758== 
==9758== For counts of detected and suppressed errors, rerun with: -v
==9758== ERROR SUMMARY: 29 errors from 24 contexts (suppressed: 0 from 0)

PHP 5.3

@sjinks
Copy link
Contributor Author

sjinks commented Sep 21, 2014

The reason is that zm_deactivate_phalcon() calls phalcon_deinitialize_memory() during request shutdown and zm_post_zend_deactivate_phalcon(), which is called after RSHUTDOWN phase, reinitializes persistent variables (z_XXX) when CG(unclean_shutdown) evaluates to non-zero.

sjinks added a commit to sjinks/cphalcon that referenced this issue Sep 21, 2014
sjinks added a commit to sjinks/cphalcon that referenced this issue Sep 22, 2014
h0tw1r3 pushed a commit to h0tw1r3/cphalcon that referenced this issue Sep 25, 2014
h0tw1r3 pushed a commit to h0tw1r3/cphalcon that referenced this issue Sep 25, 2014
wupsbr pushed a commit to wupsbr/cphalcon that referenced this issue Jul 8, 2015
wupsbr pushed a commit to wupsbr/cphalcon that referenced this issue Jul 8, 2015
wupsbr pushed a commit to wupsbr/cphalcon that referenced this issue Jul 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant