As 512 bytes are read at a time, it occasionally occurs that we get a truncated WebSocket URL. For example, that is the output of the ws_url variable within a CI tests run that failed:
As you can see, the ws://127.0.0.1:42227/devtools/browser/907bc2f7-20ea-42e2-b1ea one is truncated which eventually result in the driver raising a Ferrum::DeadBrowserError exception.
Proposed solution
The proposed fix is to enhance the regex by checking that the URL ends with a complete UUID.
Alternative solution
The logic could be changed to read the IO line by line instead of a fixed 512 bytes as Chrome is outputting with line breaks.
Details
The Chrome WebSocket URL is read from the IO with the following: https://github.com/rubycdp/ferrum/blob/a71634d065cd976626e1b612134f2ef5eef90d67/lib/ferrum/browser/process.rb#L142-L150
As 512 bytes are read at a time, it occasionally occurs that we get a truncated WebSocket URL. For example, that is the output of the
ws_url
variable within a CI tests run that failed:As you can see, the
ws://127.0.0.1:42227/devtools/browser/907bc2f7-20ea-42e2-b1ea
one is truncated which eventually result in the driver raising aFerrum::DeadBrowserError
exception.Proposed solution
The proposed fix is to enhance the regex by checking that the URL ends with a complete UUID.
Alternative solution
The logic could be changed to read the IO line by line instead of a fixed 512 bytes as Chrome is outputting with line breaks.