chrome-dev-tools-runtime icon indicating copy to clipboard operation
chrome-dev-tools-runtime copied to clipboard

(Critical) SendCommand continuing before socket has opened, breaking all sorts of things.

Open xPeyotii opened this issue 7 years ago • 0 comments

In the ChromeSession class, after the socket has been opened once, m_openEvent stays set/true as it is never reset. This causes SendCommand to continue before the socket has fully opened thus resulting in the common "Command response not received" issue, socket exhaustion, and many other things not working as they should. Simply adding m_openEvent.Reset(); before m_sessionSocket.Open(); will fix this.

        private async Task OpenSessionConnection(CancellationToken cancellationToken)
        {
            if (m_sessionSocket.State != WebSocketState.Open)
            {
                //m_openEvent.Reset(); needs to go here
                m_sessionSocket.Open();

                await Task.Run(() => m_openEvent.Wait(cancellationToken));
            }
        }

xPeyotii avatar Jan 10 '19 19:01 xPeyotii