Comments (14)
Here is a test case that is consistantly giving segfaults on my osx 10.7.4, macports php 5.3.15.
https://gist.github.com/3699796
Can anybody confirm this?
from msgpack-php.
I can not get segfault, but:
PHP Warning: msgpack Parse error in /tmp/1.php on line 7
[Wed Sep 12 14:55:03 2012] Script: '/tmp/1.php'
/home/huixinchen/opensource/github/msgpack-php/msgpack_unpack.c(469) : Freeing 0x16CCAC08 (24 bytes), script=/tmp/1.php
[Wed Sep 12 14:55:03 2012] Script: '/tmp/1.php'
/home/huixinchen/opensource/github/msgpack-php/msgpack_unpack.c(477) : Freeing 0x16A33950 (8 bytes), script=/tmp/1.php
=== Total 2 memory leaks detected ===
from msgpack-php.
Are you fixing the memory leaks? i have the same problem with an array bigger than 40 objects and more than 456466 Chars of payload.
from msgpack-php.
I can confirm the segfault now, digging
from msgpack-php.
@advect could you please look at this too?
from msgpack-php.
I got a fix:
$ git diff
diff --git a/msgpack_unpack.h b/msgpack_unpack.h
index 2ffa790..1221c7d 100644
--- a/msgpack_unpack.h
+++ b/msgpack_unpack.h
@@ -4,7 +4,7 @@
#include "ext/standard/php_var.h"
-#define MSGPACK_EMBED_STACK_SIZE 1024
+#define MSGPACK_EMBED_STACK_SIZE 2048
#include "msgpack/unpack_define.h"
but I need more time to confirm it, maybe we should use heap memory for that stack
@Dexus @bkw could you please try with this patch? thanks
from msgpack-php.
Hey Laurence, thanks for the patch! Unfortunately, is does not seem to do what You expected:
The test script gives me:
Warning: [msgpack] (php_msgpack_unserialize) Parse error in […]/tests/bug002.php on line 11
And my own test above still segfaults:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000003644099df9
VM Regions Near 0x3644099df9:
MALLOC_LARGE 0000000122599000-0000000122c99000 [ 7168K] rw-/rwx SM=PRV
-->
MALLOC_TINY 00007fa2a2c00000-00007fa2a2f00000 [ 3072K] rw-/rwx SM=PRV
Application Specific Information:
objc[24468]: garbage collection is OFF
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 php 0x000000010ede2761 gc_zval_possible_root + 113
1 php 0x000000010edd3353 zend_hash_destroy + 67
2 php 0x000000010ede5b24 zend_objects_free_object_storage + 52
3 php 0x000000010ede9401 zend_objects_store_del_ref_by_handle_ex + 401
4 php 0x000000010ede94ba zend_objects_store_del_ref + 26
5 php 0x000000010edbb3da _zval_ptr_dtor + 74
6 msgpack.so 0x00000001120bbdc9 msgpack_unserialize_var_destroy + 89 (msgpack_unpack.c:304)
7 msgpack.so 0x00000001120b6e90 php_msgpack_unserialize + 192 (msgpack.c:273)
8 msgpack.so 0x00000001120b5fa5 zif_msgpack_unserialize + 85 (msgpack.c:334)
9 php 0x000000010ee2d7f9 zend_do_fcall_common_helper_SPEC + 1081
10 php 0x000000010ee2def1 execute + 609
11 php 0x000000010edc6888 zend_execute_scripts + 440
12 php 0x000000010ed72782 php_execute_script + 722
13 php 0x000000010ee44f01 main + 4529
14 php 0x000000010ebff624 start + 52
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000122959038 rbx: 0x0000000122a719f8 rcx: 0x0000003521740dc0 rdx: 0x00007fff6e7fbed0
rdi: 0x0000000122a719f8 rsi: 0x0000000000000000 rbp: 0x00007fff6e7f1c40 rsp: 0x00007fff6e7f1c30
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000481 r11: 0x00000001120bbd70
r12: 0x0000000000000000 r13: 0x00007fff6e7fc178 r14: 0x0000000122a72138 r15: 0x0000000122a721b8
rip: 0x000000010ede2761 rfl: 0x0000000000000206 cr2: 0x0000003644099df9
Logical CPU: 0
from msgpack-php.
https://github.com/kjdev/php-ext-msgpacki
msgpacki is this no problem.
might be good.
from msgpack-php.
php-msgpacki looks interesting, but it doesn't compile on osx yet. I'll give it a shot.
from msgpack-php.
It's a shame that
from msgpack-php.
@advect it's better if there is only one msgpack php extension, so maybe we should contact with the msgpacki guy, merge our works together..
from msgpack-php.
Hello,
The test bug002.phpt for this issue makes the RPM build impossible.
Can this test be marked as SKIP until the problem is resolved?
SKIP unpack of template converter: multiple class/variable: class unpacker (array) [tests/136b.phpt] reason: tests in PHP 5.1 or older
XFAIL Bug #2 (Deserializing a large array of nested objects gives "zend_mm_heap corrupted") [tests/bug002.phpt]
PASS Bug #6 (bug with incorrect packing of mixed arrays) [tests/bug006.phpt]
=====================================================================
TIME END 2012-12-14 11:50:34
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 30
---------------------------------------------------------------------
Number of tests : 191 113
Tests skipped : 78 ( 40.8%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 0 ( 0.0%) ( 0.0%)
Expected fail : 1 ( 0.5%) ( 0.9%)
Tests passed : 112 ( 58.6%) ( 99.1%)
---------------------------------------------------------------------
Time taken : 5 seconds
=====================================================================
=====================================================================
EXPECTED FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #2 (Deserializing a large array of nested objects gives "zend_mm_heap corrupted") [tests/bug002.phpt]
=====================================================================
+ unset NO_INTERACTION REPORT_EXIT_STATUS
++ find tests -name '*.diff' -type f -print
+ '[' -n tests/bug002.diff ']'
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.85923 (%check)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.85923 (%check)
from msgpack-php.
hey, maybe you can remove that from the rpm package?
thanks
from msgpack-php.
Done. Check out the pull request #9
from msgpack-php.
Related Issues (20)
- Recursion encoded as NULL
- 034.phpt fails HOT 1
- Consider making MessagePackUnpacker cloneable
- Memory Consumption Problem in 2.1.0 HOT 1
- msgpack (un)pack error HOT 11
- try to compile from source by zts-phpize HOT 2
- php_add_session_var: symbol not found HOT 1
- More and more memory, there seems to be a leak HOT 1
- PHP 8 recursion
- my code is printed ,but out to show the garbled code, why? HOT 2
- How to get in touch about a security issue? HOT 2
- Support PHP 8.1's ZEND_ACC_NOT_SERIALIZABLE flag on zend_class_entries
- uint32 numbers are incorrectly serialized on Windows HOT 1
- PHP 8.2 - msgpack_check_ht_is_map assertion error in ZEND_HASH_FOREACH_BUCKET
- PHP 8.2: msgpack_unpack: Support deprecation of dynamic properties, forbid dynamic properties in `readonly` classes HOT 1
- MsgPack TS non TS fail HOT 5
- Compilation error reported HOT 3
- Question: release 2.2.0
- Serializing/Unserializing Enum
- Windows DLL available to download
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msgpack-php.