-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP8: Uncaught ValueError: No stream arrays wered pased in StreamSelectLoop:: #220
Comments
@holtkamp Thanks for reporting, I can see a possible problem and understand where you're coming from!
This is the actual problem you're seeing – plus the existing error handling isn't particularly helpful either. Streams that have a filter attached MUST NOT be passed to
Unfortunately, there doesn't seem to be a way to check whether a stream resource has any filters attached. This means it's up to you to ensure that streams passed to the event loop are "valid". Additionally, the existing error handling isn't particularly helpful. If you pass a stream with a filter attached to
If you do not pass any streams to
Both combined however means that we have no idea that PHP filters out these invalid streams and as such we could end up with an empty array of streams, thus running into the problem again. On top of this, we do not report any errors generated by We may want to look into using Sorting this out definitely requires a non-trivial amount of work to check out, but I suppose we're happy to accept PRs. The gist to reproduce this: https://3v4l.org/b8gYu This combined means you're dealing with an error that is indeed very hard to see. The good news is that this should be relatively easy to fix on your end by making sure you're not passing any streams with a filter attached as discussed above. I've double checked this and don't see any way this would interfere with PHP 8 other than the above observation. The code base has full code coverage and is tested against PHP 8 and older versions, so I don't see anything that would be broken here at the moment. This turned out to be long wall of text. I'm curious what others have to add, any input is welcome 👍 |
Thanks for the greatly appreciated wall of text! By searching for
As far as I am concerned the referenced project "octopus" itself does not use any filters. When searching in the However, I do not see any indication this Local file versus remote file Together with the observation that using So what would be the suggested approach to ensure that the array with $write streams is not empty, probably caused by a remote file that has not started downloading yet? Off-topic |
We're not aware of any such issues in any other projects, so I wonder what could be the cause. I'm not familiar with the octopus code base, but perhaps you can provide a simple gist to reproduce this? 👍
Can you be more specific what "local file" means here? A simple gist would help 👍
Unfortunately, this will break existing logic and test cases. The code is correct as-is. If you change this to
|
You can have a look at the issue I mentioned dpovshed/octopus#45 for an example on how to reproduce, this also indicates what I mean with "local" file 😉 It comes down to run the following on a PHP 8 environment:
|
This is a bug in octopus:
The gist of what's happening here: $f = fopen('https://www.rocktherankings.com/sitemap.xml', 'r');
$loop->addReadStream($f, function () { }); The In order to send non-blocking HTTP requests, https://github.com/reactphp/http should be used instead. It looks like octopus already uses similar logic to send HTTP requests for each URL it finds in the sitemap. It needs to use the same logic to download the sitemap itself. I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this 👍 |
@clue See amphp/amp@73f6e71 for a possible implementation for avoiding the suppression. Feel free to copy with attribution. |
Big thanks for #220 (comment) Indeed the initial step of the process of the example is blocking. This problem was "suppressed" when used on PHP < 8 and now surfaced. |
@holtkamp Glad to hear this has been tracked down successfully! For future reference, here's the relevant section from the PHP documentation for "Backward Incompatible Changes" in PHP 8:
|
It seems this kind of error suppression causes fatal errors on PHP 8
Is there any way to circumvent such error to cause a fatal error?
Also see dpovshed/octopus#45 for a way how to reproduce...
When removing the error suppression by changing
to
The following error is generated:
When changing
event-loop/src/StreamSelectLoop.php
Line 271 in 8bd064c
to
it works, but at this moment I have no idea what other effects this might have... 😕
The text was updated successfully, but these errors were encountered: