0

我在 docker compose 中使用 selenoid 在一组 jenkins 节点上运行测试,我发现有时测试会随机失败,因为 selenium 没有响应,通常只需要几秒钟。查看节点,它似乎有足够的内存和 cpu,知道这里会发生什么吗?

2021/07/28 15:19:48 [-] [NEW_REQUEST_ACCEPTED] [unknown] [192.168.240.4]
2021/07/28 15:19:48 [3] [LOCATING_SERVICE] [firefox] []
2021/07/28 15:19:48 [-] [DEFAULT_VERSION] [Using default version: 72]
2021/07/28 15:19:48 [3] [USING_DOCKER] [firefox] [72]
2021/07/28 15:19:48 [3] [CREATING_CONTAINER] [selenoid/firefox:72.0]
2021/07/28 15:19:48 [3] [STARTING_CONTAINER] [selenoid/firefox:72.0] [743731426c4ae30549f824c5a4a7a7aae9a48367e1b1612b1d9f48b7cd2baee4]
2021/07/28 15:19:49 [3] [CONTAINER_STARTED] [selenoid/firefox:72.0] [743731426c4ae30549f824c5a4a7a7aae9a48367e1b1612b1d9f48b7cd2baee4] [0.46s]
2021/07/28 15:20:49 [3] [REMOVING_CONTAINER] [743731426c4ae30549f824c5a4a7a7aae9a48367e1b1612b1d9f48b7cd2baee4]
2021/07/28 15:20:49 [3] [CONTAINER_REMOVED] [743731426c4ae30549f824c5a4a7a7aae9a48367e1b1612b1d9f48b7cd2baee4]
2021/07/28 15:20:49 [3] [SERVICE_STARTUP_FAILED] [wait: http://172.17.0.3:4444/wd/hub does not respond in 1m0s]```
4

2 回答 2

0

例如,可能是因为磁盘速度慢\过载或功能设置错误。需要查看系统指标,如 CPU 负载、平均负载、内存使用情况、iowait 等。另外我会查看浏览器容器日志(您可以在这一分钟内使用常规docker logs命令执行此操作)。

于 2021-07-30T11:20:47.053 回答
0

所以这个问题似乎已经解决了,我们添加了一个脚本,在执行后清理机器中留下的任何浏览器容器,但是我现在面临另一个问题:

2021/08/04 03:16:06 [-] [NEW_REQUEST] [unknown] [172.17.0.6]
2021/08/04 03:16:06 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.17.0.6]
2021/08/04 03:16:06 [175] [LOCATING_SERVICE] [firefox] []
2021/08/04 03:16:06 [-] [DEFAULT_VERSION] [Using default version: 72]
2021/08/04 03:16:06 [175] [USING_DOCKER] [firefox] [72]
2021/08/04 03:16:06 [175] [CREATING_CONTAINER] [selenoid/firefox:72.0]
2021/08/04 03:16:09 [175] [STARTING_CONTAINER] [selenoid/firefox:72.0] [b03f86e30e850bb48ce1194bc49b3549e369cb1511754aa1c24c29483a538fa9]
2021/08/04 03:16:10 [175] [CONTAINER_STARTED] [selenoid/firefox:72.0] [b03f86e30e850bb48ce1194bc49b3549e369cb1511754aa1c24c29483a538fa9] [1.37s]
[2021-08-04 04:16:26.385047] Exception trying to get the WebDriver instance:
HTTPConnectionPool(host='172.17.0.2', port=4444): Read timed out. (read timeout=20)
2021/08/04 03:16:27 [175] [SERVICE_STARTED] [firefox:72.0] [b03f86e30e850bb48ce1194bc49b3549e369cb1511754aa1c24c29483a538fa9] [16.91s]
2021/08/04 03:16:27 [175] [PROXY_TO] [b03f86e30e850bb48ce1194bc49b3549e369cb1511754aa1c24c29483a538fa9] [http://172.17.0.16:4444/wd/hub]
2021/08/04 03:16:27 [175] [SESSION_ATTEMPTED] [http://172.17.0.16:4444/wd/hub] [1]
2021/08/04 03:16:27 [175] [CLIENT_DISCONNECTED] [unknown] [172.17.0.6] [20.92s]

似乎浏览器容器需要很长时间才能启动并且硒请求超时,有没有办法解决这个问题?

于 2021-08-04T08:26:17.317 回答