php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74714 serialize() crashes with multiple threads / pthreads
Submitted: 2017-06-08 17:47 UTC Modified: 2021-06-09 15:06 UTC
From: benjamin dot roth at jaumo dot com Assigned: cmb (profile)
Status: Wont fix Package: Reproducible crash
PHP Version: 7.1.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: benjamin dot roth at jaumo dot com
New email:
PHP Version: OS:

 

 [2017-06-08 17:47 UTC] benjamin dot roth at jaumo dot com
Description:
------------
serialize() seems to be not thread safe. Scripts crash with SIGSEGV or SIGABORT on a regular basis if parallel threads do serialization with pthreads. Sometimes this happens at the end of the script on shutdown and sometimes in the middle of script execution. As it is a race condition there is no deterministic way to reproduce it but the attached script fails after some time in almost all cases.

Test script:
---------------
https://gist.github.com/brstgt/e04d08c237d84003103050dc7c371acd

Serialized file required as "entities.txt" in test script: https://cl.ly/2v3Y1o2S351Q

Run in loop until it segfaults or aborts. Normally between 1-30s

while true; do php scripts/segv.php || break; done



Expected result:
----------------
No SIGABORT or SIGSEGV

Actual result:
--------------
https://gist.github.com/brstgt/76e3e1135872e2ae1770ae4e59b66696

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-09 15:06 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-06-09 15:06 UTC] cmb@php.net
pthreads is no longer supported as of PHP 7.4.0[1].

[1] <https://github.com/krakjoe/pthreads/issues/929>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC