Repository navigation
Conversation
When the websocket closes, receive() returns null, so fetch() hands back an empty string and json_decode() turns that into null. Neither the error branch nor the break condition can match null, so execute() keeps looping until something outside the test kills it. Throw a ServerNotFoundException instead, and add a unit test that gives the client a connection whose receive() returns null.
|
We hit this in a real suite, with a variant worth knowing about. A parallel run (6 processes) lost its Playwright connection during a We now apply this pull request's change as a local patch on v5.0.1. With it, the same closed connection fails the test with |
|
#277 fixes the same hang in fetch(), so I'm closing this one. Thanks for merging it. |
When the Playwright server's websocket closes,
receive()returnsnull,fetch()turns that into an empty string, andjson_decode('')givesnull. None of the checks inexecute()can matchnull, so the loop never ends and the run just sits there until some outer timeout kills it.This throws a
ServerNotFoundExceptionwhen a frame doesn't decode to an array, so the test fails with a message instead of hanging.I added a unit test that sets a mocked connection whose
receive()returnsnull. Without the change it never finishes (I had to kill it after 20 seconds). With it, it passes in well under a second. Locally I only ran that test and PHPStan onsrc, not the full suite.Happy to use a different exception if you'd rather keep
ServerNotFoundExceptionfor the HTTP server.