Skip to content

Remove broken StreamReadException & canDevToolsConnectionBeEstablished timeout/retry logic

As described in more detail in the code comments & commit descriptions, the current implementation of timeout/retry handling using StreamReadException and canDevToolsConnectionBeEstablished is fundamentally broken and cannot ever operate, because:

  • Since websocket@1.5.0 this library cannot ever throw a StreamReadException
  • Since chrome-mink-driver@2.8.0 this library can only ever return false from canDevToolsConnectionBeEstablished.

Further, if those two issues were fixed the logic in waitForLoad has no limit to the number of retries it will attempt on successive timeouts reading the stream. If the library was throwing StreamReadException and detecting that the Chrome API was still reachable, but the tab had crashed or (more likely) was blocked by e.g. a window.alert, then waitForLoad would enter an infinite loop until the process was terminated either by a CI build time limit or a maximum recursion depth error. We reproduced that behaviour in early versions of our attempts to fix these issues.

Therefore I propose removing this implementation completely (which will have no impact on end-user behaviour, because as described this is all essentially dead code).

I have kept the canDevToolsConnectionBeEstablished public method but marked it as deprecated to maintain BC.

We have an experimental branch which includes a more robust approach to handling stream timeouts / retries along with various other build stability fixes, which has been working well for us for the last year or so. I intend to tidy that up and propose changes in separate merge requests to make it easier to review.

Merge request reports