Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webdriver module hangs when starting a new sequence #412

Open
ferpasri opened this issue Dec 10, 2024 · 0 comments
Open

Webdriver module hangs when starting a new sequence #412

ferpasri opened this issue Dec 10, 2024 · 0 comments

Comments

@ferpasri
Copy link
Member

Description

Sometimes, the TESTAR web driver hangs when starting the web URL and trying to fetch the initial web state. This provokes TESTAR to hang around 120 seconds, stop the system, and start a second try connection again.

Reproduce

The main issue is that this bug is not 'easy' to reproduce. But running a lot of sequences (e.g., 100) with a small number of actions (e.g., 1) sometimes shows this hang and restart bug behavior.

Possible cause

It seems that the origin cause of this bug is the implementation of a synchronized method that can potentially block some TESTAR threads to update the web tabs' handle information.

/*
* Update the list of handles with added handles (new tabs)
* Remove handles from closed tabs
*/
private synchronized static void updateHandlesList() {
Set<String> currentHandles = remoteWebDriver.getWindowHandles();
// Remove handles not present anymore (closed tabs)
for (String handle : new ArrayList<>(windowHandles)) {
if (!currentHandles.contains(handle)) {
windowHandles.remove(handle);
}
}
// Add new handles (new tabs), shouldn't be more than one
for (String handle : currentHandles) {
if (!windowHandles.contains(handle)) {
windowHandles.add(handle);
}
}
}

Possible solution

A solution we are investigating is changing this synchronized implementation with a multi-thread safe CopyOnWriteArrayList solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant