-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Open
Labels
C-dotnet.NET Bindings.NET BindingsI-defectSomething is not working as intendedSomething is not working as intended
Description
Description
I wasn't sure this issue should be considered a bug or a feature request, let me know if the issue should be turned into a feature request.
- Issue
- Application deadlocks when trying to synchronously execute a command with a WebDriver. Observed mostly when creating a new ChromeDriver instance or closing an existing ChromeDriver (i.e StartSession & Close methods).
- Expected behavior
- The WebDriver is either create or closed, or throws should the command execution fail.
- Actual behavior
- The application deadlocks when calling
WebDriver.Execute.
- The application deadlocks when calling
Stack Trace:
[Managed to Native Transition]
System.Private.CoreLib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout) Unknown
System.Private.CoreLib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Unknown
System.Private.CoreLib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Unknown
System.Private.CoreLib.dll!System.Threading.Tasks.Task.InternalWaitCore(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Unknown
System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task, System.Threading.Tasks.ConfigureAwaitOptions options) Unknown
System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter<System.__Canon>.GetResult() Unknown
[Waiting on Async Operation, double-click or press enter to view Async Call Stacks]
WebDriver.dll!OpenQA.Selenium.WebDriver.Execute(string driverCommandToExecute, System.Collections.Generic.Dictionary<string, object> parameters) Unknown
WebDriver.dll!OpenQA.Selenium.WebDriver.StartSession(OpenQA.Selenium.ICapabilities capabilities) Unknown
WebDriver.dll!OpenQA.Selenium.WebDriver.WebDriver(OpenQA.Selenium.ICommandExecutor executor, OpenQA.Selenium.ICapabilities capabilities) Unknown
WebDriver.dll!OpenQA.Selenium.Chromium.ChromiumDriver.ChromiumDriver(OpenQA.Selenium.Chromium.ChromiumDriverService service, OpenQA.Selenium.Chromium.ChromiumOptions options, System.TimeSpan commandTimeout) Unknown
WebDriver.dll!OpenQA.Selenium.Chrome.ChromeDriver.ChromeDriver(OpenQA.Selenium.Chrome.ChromeDriverService service, OpenQA.Selenium.Chrome.ChromeOptions options, System.TimeSpan commandTimeout) Unknown
WebDriver.dll!OpenQA.Selenium.Chrome.ChromeDriver.ChromeDriver(OpenQA.Selenium.Chrome.ChromeOptions options) Unknown
WebDriver.dll!OpenQA.Selenium.Chrome.ChromeDriver.ChromeDriver() Unknown
> TestsRunner.dll!Program.<Main>$(string[] args) Line 13 C#
It looks like adding a timeout on the task inside WebDriver.Execute could be help and allow to fail early.
Thank you for looking into this!
Reproducible Code
using OpenQA.Selenium.Chrome;
//Use thread pool starvation to force the command execution task to never complete.
//Requires 3 threads or fewer.
const int numberOfThreads = 3;
ThreadPool.SetMinThreads(numberOfThreads, numberOfThreads);
ThreadPool.SetMaxThreads(numberOfThreads, numberOfThreads);
Console.WriteLine("About to instantiate Chrome driver instance. It will deadlock");
using var driver = new ChromeDriver(); //will deadlock.Debugging logs
15:18:31.270 TRACE SeleniumManager: DEBUG Sending stats to Plausible: Props { browser: "chrome", browser_version: "", os: "windows", arch: "x86_64", lang: "csharp", selenium_version: "4.40" }
15:18:31.280 TRACE SeleniumManager: DEBUG chromedriver not found in PATH
15:18:31.280 TRACE SeleniumManager: DEBUG chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe
15:18:31.280 TRACE SeleniumManager: DEBUG Detected browser: chrome 144.0.7559.133
15:18:31.280 TRACE SeleniumManager: DEBUG Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
15:18:31.281 TRACE SeleniumManager: DEBUG Required driver: chromedriver 144.0.7559.133
15:18:31.281 TRACE SeleniumManager: DEBUG chromedriver 144.0.7559.133 already in the cache
15:18:31.281 TRACE SeleniumManager: INFO Driver path: C:\Users\<user>\.cache\selenium\chromedriver\win64\144.0.7559.133\chromedriver.exe
15:18:31.281 TRACE SeleniumManager: INFO Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe
15:18:31.281 TRACE SeleniumManager: Driver path: C:\Users\<user>\.cache\selenium\chromedriver\win64\144.0.7559.133\chromedriver.exe
15:18:31.281 TRACE SeleniumManager: Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-dotnet.NET Bindings.NET BindingsI-defectSomething is not working as intendedSomething is not working as intended