aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.57k stars 322 forks source link

Calls to /detools/, /download/, /clipboard/ do not close current timeout channel, which results in unwanted timeout function execution #1112

Closed pavelsmolensky closed 3 years ago

pavelsmolensky commented 3 years ago

Selenoid version 1.10.3

STR:

  1. Create a snippet with the following steps
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.setCapability("sessionTimeout", "30s");
    driver = new RemoteWebDriver(new URL("selenoid_url"), chromeOptions);
    driver.get("_website_url");
    SessionId sessionId = driver.getSessionId();
    connectToDevtools(sessionId.toString()); 
    driver.quit();

    where connectToDevtools() makes ws connection to /devtools/_sessionid/page

  2. Run the snippet and inspect selenoid logs
    2021/06/23 09:34:43 [-] [NEW_REQUEST] [unknown] [10.159.16.39]
    2021/06/23 09:34:43 [-] [NEW_REQUEST_ACCEPTED] [unknown] [10.159.16.39]
    2021/06/23 09:34:43 [0] [LOCATING_SERVICE] [chrome] []
    2021/06/23 09:34:43 [-] [DEFAULT_VERSION] [Using default version: 91.0]
    2021/06/23 09:34:43 [0] [USING_DOCKER] [chrome] [91.0]
    2021/06/23 09:34:43 [0] [CREATING_CONTAINER] [selenoid/vnc_chrome:91.0]
    2021/06/23 09:34:43 [0] [STARTING_CONTAINER] [selenoid/vnc_chrome:91.0] [667a34edbb67e19269901a1328ddc37ce41e9e12e0208fbe8fdb5f34a129fc45]
    2021/06/23 09:34:43 [0] [CONTAINER_STARTED] [selenoid/vnc_chrome:91.0] [667a34edbb67e19269901a1328ddc37ce41e9e12e0208fbe8fdb5f34a129fc45] [0.42s]
    2021/06/23 09:34:44 [0] [SERVICE_STARTED] [selenoid/vnc_chrome:91.0] [667a34edbb67e19269901a1328ddc37ce41e9e12e0208fbe8fdb5f34a129fc45] [0.61s]
    2021/06/23 09:34:44 [0] [PROXY_TO] [667a34edbb67e19269901a1328ddc37ce41e9e12e0208fbe8fdb5f34a129fc45] [http://192.168.0.4:4444/]
    2021/06/23 09:34:44 [0] [SESSION_ATTEMPTED] [http://192.168.0.4:4444/] [1]
    2021/06/23 09:34:45 [0] [SESSION_CREATED] [e807da2bc4b5c989a4d54a614a2f091c] [1] [2.00s]
    2021/06/23 09:34:48 [4] [DEVTOOLS] [e807da2bc4b5c989a4d54a614a2f091c] [/page]
    2021/06/23 09:34:48 [5] [SESSION_DELETED] [e807da2bc4b5c989a4d54a614a2f091c]
    2021/06/23 09:34:48 [0] [REMOVING_CONTAINER] [667a34edbb67e19269901a1328ddc37ce41e9e12e0208fbe8fdb5f34a129fc45]
    2021/06/23 09:34:48 [0] [CONTAINER_REMOVED] [667a34edbb67e19269901a1328ddc37ce41e9e12e0208fbe8fdb5f34a129fc45]
    2021/06/23 09:35:15 [1] [SESSION_TIMED_OUT] [e807da2bc4b5c989a4d54a614a2f091c]
    2021/06/23 09:35:15 [1] [DELETE_FAILED] [e807da2bc4b5c989a4d54a614a2f091c] [404 Not Found]

    Result: Last 2 log entries indicate that timeout function was called, however session was already closed and container removed

pavelsmolensky commented 3 years ago

Proposed fix: https://github.com/aerokube/selenoid/pull/1113

vania-pooh commented 3 years ago

Fixed in #1113.