|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80079 dl("ffi") report "malloc_consolidate(): invalid chunk size" when enable zts
Submitted: 2020-09-08 12:00 UTC Modified: 2021-09-16 21:26 UTC
From: hark110 at 163 dot com Assigned:
Status: Open Package: FFI (PECL)
PHP Version: master-Git-2020-09-08 (Git) OS: Fedora 32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: hark110 at 163 dot com
New email:
PHP Version: OS:


 [2020-09-08 12:00 UTC] hark110 at 163 dot com
When php enable zts and debug,
then use dl() function load ffi extension in php code
when after ffi module shutdown, will report "malloc_consolidate(): invalid chunk size"
This bug only occurs when the dl() loads FFI. 
1.does not occurs when php non-zts
2.does not occurs when php enable zts and  static COMPILE ,
3.does not occur when set "extension=" configuration option
GDB message:
Stack trace of thread 443691:
 #0  0x00007fc2e8c7d9e5 __GI_raise ( + 0x3c9e5)
                #1  0x00007fc2e8c66895 __GI_abort ( + 0x25895)
                #2  0x00007fc2e8cc1857 __libc_message ( + 0x80857)
                #3  0x00007fc2e8cc8d7c malloc_printerr ( + 0x87d7c)
                #4  0x00007fc2e8cc9c48 malloc_consolidate ( + 0x88c48)
                #5  0x00007fc2e8cca3f0 _int_free ( + 0x893f0)
                #6  0x0000000000927ea5 n/a (./sapi/cli/php + 0x527ea5)
                #7  0x000000000090ed98 n/a (./sapi/cli/php + 0x50ed98)
                #8  0x0000000000865217 n/a (./sapi/cli/php + 0x465217)
                #9  0x000000000090fd50 n/a (./sapi/cli/php + 0x50fd50)
                #10 0x000000000086ae0c n/a (./sapi/cli/php + 0x46ae0c)
                #11 0x00000000009ffbf5 n/a (./sapi/cli/php + 0x5ffbf5)
                #12 0x00007fc2e8c68042 __libc_start_main ( + 0x27042)
                #13 0x000000000060171e n/a (./sapi/cli/php + 0x20171e)
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	  return ret;

Test script:
Test command:
../../sapi/cli/php -d enable_dl=1 -d extension_dir=./ffi/modules test.php

test.php code:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-16 21:26 UTC]
-Package: ffi +Package: FFI
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC