zebrunner / appium

Enhanced Appium for Elastic Selenium Grid/MCloud services
8 stars 3 forks source link

Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started #58

Closed dhreben closed 2 years ago

dhreben commented 2 years ago

The appium fails with the error "Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started"

2022-02-22 09:44:08:900 - [debug] [DevCon Factory] Cached connections count: 0 2022-02-22 09:44:08:900 - [debug] [BaseDriver] [MCLOUD] stopping capturing artifacts for session f44........cb42de 2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] Encountered internal error running command: The process has received SIGTERM signal[[[--udid 00008...........0113802E --name iPhone_XR --sessionId f30a18......6d9cb42de]]] 2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] Error: The process has received SIGTERM signal 2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] at map (/usr/lib/node_modules/appium/lib/appium.js:530:84) 2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] at Array.map () 2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] at AppiumDriver.deleteAllSessions (/usr/lib/node_modules/appium/lib/appium.js:530:33) 2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at process.onSignal (/usr/lib/node_modules/appium/lib/main.js:168:30) 2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at Object.onceWrapper (events.js:421:26) 2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at process.emit (events.js:326:22) 2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at process.emit (/usr/lib/node_modules/appium/node_modules/source-map-support/source-map-support.js:495:21) 2022-02-22 09:44:08:914 - [HTTP] <-- POST /wd/hub/session/f30a181e-6.................09e6d9cb42de/element 500 121 ms - 919 2022-02-22 09:44:08:914 - [HTTP] 2022-02-22 09:44:08:929 - [BaseDriver] [MCLOUD] [MCLOUD] start capturing artifacts error: Command failed: /opt/start-capture-artifacts.sh f30a181e-6714-4366-8a35-09e6d9cb42de >> /tmp/video.log 2>&1 2022-02-22 09:44:08:929 - [BaseDriver] 2022-02-22 09:44:08:929 - [BaseDriver] [MCLOUD] [MCLOUD] stop capturing artifacts error: Command failed: /opt/stop-capture-artifacts.sh f30a181e-6714-4366-8a35-09e6d9cb42de 2022-02-22 09:44:08:930 - [BaseDriver] 2022-02-22 09:44:09:164 - [HTTP] --> POST /wd/hub/session/f30a181e-.........5-09e6d9cb42de/element 2022-02-22 09:44:09:164 - [HTTP] {"using":"-ios class chain","value":"/XCUIElementTypeButton[name == 'OK' or label == 'OK']"} 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started**[[[--udid 0000..................A0113802E --name iPhone_XR --sessionId f30a181e-...............8a35-09e6d9cb42de]]] 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at asyncHandler (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:243:15) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at /usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:426:15 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Layer.handle [as handle_request] (/usr/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at next (/usr/lib/node_modules/appium/node_modules/express/lib/router/route.js:137:13) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Route.dispatch (/usr/lib/node_modules/appium/node_modules/express/lib/router/route.js:112:3) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Layer.handle [as handle_request] (/usr/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at /usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:281:22 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at param (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:354:14) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at param (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:365:14) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Function.process_params (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:410:3) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at next (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:275:10) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at logger (/usr/lib/node_modules/appium/node_modules/morgan/index.js:144:5) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Layer.handle [as handle_request] (/usr/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at trim_prefix (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:317:13) 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at /usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:284:7 2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Function.process_params (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:335:12 2022-02-22 09:44:09:167 - [HTTP] <-- POST /wd/hub/session/f30a181e-..................-09e6d9cb42de/element 404 3 ms - 1998 2022-02-22 09:44:09:167 - [HTTP] 2022-02-22 09:44:09:212 - [debug] [BaseDriver] [MCLOUD] uploading captured artifacts Exit status: 0

dhreben commented 2 years ago

The following links were found to solve this issue:

https://github.com/appium/appium/issues/15643 https://github.com/appium/appium/issues/13217 https://github.com/appium/java-client/issues/1309 https://github.com/appium/appium/issues/15163 https://discuss.appium.io/t/mjsonwp-encountered-internal-error-running-command-error/15556 https://stackoverflow.com/questions/55995876/fix-this-appium-error-a-session-is-either-terminated-or-not-started https://github.com/zebrunner/mcloud-grid/issues/5 https://github.com/webdriverio/webdriverio/issues/4844 https://github.com/appium/java-client/issues/1309

vdelendik commented 2 years ago

in 1.4 and 1.4.1 we redesigned healtchcheck for appium, especially for iOS. it shouldn't kill appium itself anymore, so hopefully we minimized this particular problem:

The process has received SIGTERM signal

Also improved WDA status detection using netcat so we detect wda crash asap without extra /status-wda calls in healthcheck

dhreben commented 2 years ago

Fixed