|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63082 Segfault with libevent 2.0.20
Submitted: 2012-09-13 16:54 UTC Modified: 2012-11-16 19:35 UTC
From: evert at rooftopsolutions dot nl Assigned: tony2001 (profile)
Status: Closed Package: libevent (PECL)
PHP Version: 5.3.16 OS: OS/X 10.8
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.
Bug Type:
From: evert at rooftopsolutions dot nl
New email:
PHP Version: OS:


 [2012-09-13 16:54 UTC] evert at rooftopsolutions dot nl
I upgraded my libevent to 2.0.20, but this gave me "Segmentation fault 11" when using pecl/event.

Downgrading back to 2.0.19 seem to work. GDB indicated that the segmentation fault happened in event_pending(). The changelog seems to indicate a change did indeed happen there:

Note that I did also recompile the pecl extension. Just in case there was an ABI break.

Test script:
Run : 


with some events attached. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-17 13:13 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2012-09-17 13:13 UTC]
-Status: Open +Status: Feedback
 [2012-09-17 18:31 UTC] evert at rooftopsolutions dot nl
-Status: Feedback +Status: Open
 [2012-09-17 18:31 UTC] evert at rooftopsolutions dot nl
Took me some time to get a very simple test case, and it also made me realize my bug is a lot more specific than I initially thought. Sorry about this, but here's the new information

This script will always throw the SIG11 with Libevent 2.0.20.

$buffer = event_buffer_new(
    function() {
        echo "read\n";
    function() {
        echo "write\n";
    function() {
        echo "error\n";
event_buffer_timeout_set($buffer, 5, 5);

I also came to the realization that event_buffer_timeout_set will not throw the segmentation fault, if it is called *after* event_buffer_base.

And just in case.. The SIG11 does not get thrown with libevent 2.0.19, so this is definitely a newly introduced bug.

Hope this helps! I have my workaround in any case.
 [2012-09-18 07:07 UTC]
This is clearly a bug in libevent itself, so I reported it upstream:
I can think of a workaround in this particular case, but bufferevent_settimeout() is 
definitely not the only function that calls event_pending() and proper workaround 
would be to add a check to ALL the functions calling it, which kinda smells.
I'd suggest to wait for a fix in the libevent instead, fortunately it's extremely easy.
 [2012-09-18 07:07 UTC]
-Status: Open +Status: Feedback
 [2012-09-18 09:40 UTC] evert at rooftopsolutions dot nl
-Status: Feedback +Status: Open
 [2012-09-18 09:40 UTC] evert at rooftopsolutions dot nl
Can't seem to leave a comment without putting it back to 'Open', but wanted to say thank you anyway :)
 [2012-09-19 07:59 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: tony2001
 [2012-11-16 19:35 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 13:01:29 2024 UTC