Bug #73471 [Opn]: PHP freezes with AppendIterator

From: Date: Tue, 08 Nov 2016 10:04:02 +0000
Subject: Bug #73471 [Opn]: PHP freezes with AppendIterator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205233@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73471&edit=1

 ID:                 73471
 User updated by:    saschaprolic at googlemail dot com
 Reported by:        saschaprolic at googlemail dot com
 Summary:            PHP freezes with AppendIterator
 Status:             Open
 Type:               Bug
 Package:            SPL related
 Operating System:   Linux 4.4.0-43-generic Ubuntu
 PHP Version:        7.1.0RC5
 Block user comment: N
 Private report:     N

 New Comment:

Here is the shortest script to reproduce the issue.

<?php

$iterator1 = new \AppendIterator();
$iterator2 = new \AppendIterator();

$events = new \ArrayIterator(['event']);

$iterator1->append($events);
$iterator2->append($events);

// without this foreach, i will not hang
foreach ($iterator2 as $event) {
}

$events = new \ArrayIterator(['event']);
$iterator1->append($events);
$iterator2->append($events);


Previous Comments:
------------------------------------------------------------------------
[2016-11-07 13:22:52] saschaprolic at googlemail dot com

I tried to create an isolated test script where you don't need to clone the event-store
repository, and run the phpunit tests yourself. Unfortunately I was not successful so far. But I
gave you the required links, so you actually are able to reproduce this issue, it's just a
little more work than running a simple 20 line test-script.

PHP hangs forever exactly at this line:
https://github.com/prooph/event-store/pull/210/commits/61465535e6acc657c80a1bab7ab909470cf579e8#diff-cded286a30dea4e80fa00f01cfa1a8fbL73

It does not crash, so maybe it's an infinite loop, but not in the userland code, but in PHP
itself.

------------------------------------------------------------------------
[2016-11-07 08:23:15] requinix@php.net

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.

"Freezes"? Could it be an infinite loop somewhere? Use a debugger to find out exactly
where and when the problem is.

------------------------------------------------------------------------
[2016-11-07 07:45:41] saschaprolic at googlemail dot com

The change is here: https://github.com/prooph/event-store/pull/210/commits/61465535e6acc657c80a1bab7ab909470cf579e8

------------------------------------------------------------------------
[2016-11-07 07:43:27] saschaprolic at googlemail dot com

Description:
------------
PHP freezes when I use the append iterator. I could not create an isolated script, where only this
problem is covered, yet.

But here is how to reproduce and how to bypass it, take a look at the following change in my PR to
prooph/event-store:

https://github.com/prooph/event-store/pull/210

I hope this helps you guys already to isolate the problem. Either way, you can always clone our
repository and run the tests with that patch excluded, so you will see the same in real action.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73471&edit=1


Thread (11 messages)

« previous php.bugs (#205233) next »