-
- Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
C-dotnet.NET Bindings.NET BindingsD-firefoxI-defectSomething is not working as intendedSomething is not working as intendedOS-windows
Description
Description
If the browser process exits before a BiDi
is disposed (e.g. due to the user pressing close button, or due to an interrupt as in #16090 (comment)) , it causes many (infinite?) WebSocketExceptions
to be logged.
Reproducible Code
using OpenQA.Selenium.BiDi; using OpenQA.Selenium.Firefox; using System; using System.Threading; using var webDriver = new FirefoxDriver(new FirefoxOptions() { UseWebSocketUrl = true, }); await using var bidi = await webDriver.AsBiDiAsync().ConfigureAwait(false); Thread.Sleep(TimeSpan.FromSeconds(100)); // Kill browser process to produce WebSocketExceptions
Debugging Logs
1754428864215 geckodriver INFO Listening on 127.0.0.1:50968 1754428869404 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "50969" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "C:\\Users\\Kevin\\AppData\\Local\\Temp\\rust_mozprofileMW5401" Read port: 50974 15:21:16.867 ERROR Broker: Couldn't process received BiDi remote message: System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake. at System.Net.WebSockets.ManagedWebSocket.ThrowEOFUnexpected() at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state) --- End of stack trace from previous location --- at OpenQA.Selenium.BiDi.Communication.Transport.WebSocketTransport.ReceiveAsync(CancellationToken cancellationToken) at OpenQA.Selenium.BiDi.Communication.Broker.ReceiveMessagesAsync(CancellationToken cancellationToken) 15:21:17.007 ERROR Broker: Couldn't process received BiDi remote message: System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseSent' at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates) at System.Net.WebSockets.ManagedWebSocket.ReceiveAsync(ArraySegment`1 buffer, CancellationToken cancellationToken) --- End of stack trace from previous location --- at OpenQA.Selenium.BiDi.Communication.Transport.WebSocketTransport.ReceiveAsync(CancellationToken cancellationToken) at OpenQA.Selenium.BiDi.Communication.Broker.ReceiveMessagesAsync(CancellationToken cancellationToken) 15:21:17.124 ERROR Broker: Couldn't process received BiDi remote message: System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseSent' at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates) at System.Net.WebSockets.ManagedWebSocket.ReceiveAsync(ArraySegment`1 buffer, CancellationToken cancellationToken) --- End of stack trace from previous location --- at OpenQA.Selenium.BiDi.Communication.Transport.WebSocketTransport.ReceiveAsync(CancellationToken cancellationToken) at OpenQA.Selenium.BiDi.Communication.Broker.ReceiveMessagesAsync(CancellationToken cancellationToken) 15:21:17.241 ERROR Broker: Couldn't process received BiDi remote message: System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseSent' at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates) at System.Net.WebSockets.ManagedWebSocket.ReceiveAsync(ArraySegment`1 buffer, CancellationToken cancellationToken) --- End of stack trace from previous location --- at OpenQA.Selenium.BiDi.Communication.Transport.WebSocketTransport.ReceiveAsync(CancellationToken cancellationToken) at OpenQA.Selenium.BiDi.Communication.Broker.ReceiveMessagesAsync(CancellationToken cancellationToken) 15:21:17.372 ERROR Broker: Couldn't process received BiDi remote message: System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseSent' at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates) at System.Net.WebSockets.ManagedWebSocket.ReceiveAsync(ArraySegment`1 buffer, CancellationToken cancellationToken) --- End of stack trace from previous location --- at OpenQA.Selenium.BiDi.Communication.Transport.WebSocketTransport.ReceiveAsync(CancellationToken cancellationToken) at OpenQA.Selenium.BiDi.Communication.Broker.ReceiveMessagesAsync(CancellationToken cancellationToken) 15:21:17.489 ERROR Broker: Couldn't process received BiDi remote message: System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseSent' at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates) at System.Net.WebSockets.ManagedWebSocket.ReceiveAsync(ArraySegment`1 buffer, CancellationToken cancellationToken) --- End of stack trace from previous location --- at OpenQA.Selenium.BiDi.Communication.Transport.WebSocketTransport.ReceiveAsync(CancellationToken cancellationToken) at OpenQA.Selenium.BiDi.Communication.Broker.ReceiveMessagesAsync(CancellationToken cancellationToken) ...
Metadata
Metadata
Assignees
Labels
C-dotnet.NET Bindings.NET BindingsD-firefoxI-defectSomething is not working as intendedSomething is not working as intendedOS-windows