In @wdio/appium-service, kill entire Appium process tree#13151
In @wdio/appium-service, kill entire Appium process tree#13151christian-bromann merged 8 commits intowebdriverio:mainfrom samuelfreiberg:main
Conversation
|
@samuelfreiberg thanks for raising the PR ❤️ do you mind resolving the conflict in the pnpm-lock.yaml? |
No problem! And just did fix the conflict |
|
@samuelfreiberg thanks for the changes. I will take a look today at the build issues we face and will update your branch once these are resolved to see if this patch is good to go. |
Sounds good - thanks |
|
@samuelfreiberg mind rebasing your branch, I pushed some fixes to the |
|
@samuelfreiberg mind taking a look a the following test: |
Just updated |
|
mhm .. I still see 2 failing tests: |
Looks like it's passing now. I had to mock up the entire _process in order to set the pid |
|
The one failure is an known issue we are trying to fix, will move ahead and merge. @samuelfreiberg thanks so much, mind raising the same PR against the |
|
Hey samuelfreiberg 👋 Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution. We've sent you an email with further instructions on how to claim your expenses from our development fund. Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord. We are looking forward to more contributions from you in the future 🙌 Have a nice day, |
Issue #13108
Proposed changes
This change kills the entire Appium process tree in the
onComplete()callback. The current method is only doing:this._process.kill(). This doesn't take into account the spawned process' from Appium.Currently, there is a lingering Node process after executing testing. I found that this node process is spawned from WebDriverIO, specifically for Appium:
"C:\Program Files\nodejs\node.exe" C:\my_local_project_path\node_modules\appium\index.js --base-path /This causes the next test execution in the same cmd prompt to fail with:
2024-07-01T22:39:19.725Z ERROR @wdio/appium-service: Appium exited before timeout (exit code: 1) [HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.Types of changes
My solution is to take a dependency on the
tree-killNPM package. This is a simple package that allows us to kill all process' in a tree. I'm usingthis._process.pidto kill the entire process tree.I've confirmed there is no more lingering Node process after test execution
However, as I stated in the issue, we're still getting
ERROR @wdio/appium-service: Appium exited before timeout (exit code: null). I can't figure out why. I don't see any actual user bad from this - the tests still pass successfully. Nothing in the Appium logs indicate anything bad, either - and now there's no lingering node process.Since there's no user bad, and the process is getting shut down successfully, I'm going to change this from a
log.errorto alog.warn.Checklist
Backport Request
//: # (The current
mainbranch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against thev8branch.)v9and doesn't need to be back-ported#XXXXXI will backport this once it gets approved
Further comments
Reviewers: @webdriverio/project-committers