servodriver: Shut down Servo elegantly when all tests finish#40455
servodriver: Shut down Servo elegantly when all tests finish#40455yezhizhen merged 5 commits intoservo:mainfrom
Conversation
|
🔨 Triggering try run (#19134282694) for Linux (WPT) |
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#55907) with upstreamable changes. |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#55907) title and body. |
1 similar comment
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#55907) title and body. |
|
Test results for linux-wpt from try job (#19134282694): Flaky unexpected result (28)
Stable unexpected results that are known to be intermittent (11)
|
|
I started 6 actions in my fork. It seems 50% of executors can finish, but rest all stuck around 90% indefinitely. I will fix this tomorrow. |
| conn.request("GET", "/status") | ||
| res = conn.getresponse() | ||
| except Exception: | ||
| self.logger.info("Servo has shutted down normally.") |
There was a problem hiding this comment.
| self.logger.info("Servo has shutted down normally.") | |
| self.logger.info("Servo has shut down normally.") |
Should this perhaps also be debug? info seems very verbose.
There was a problem hiding this comment.
Yeah. Do you know how can I make things appear in console, if I use debug?
| self.logger.info(f"Got response status for shutdown command: {res.status}") | ||
| # 0.05 is a heuristic value manually tested, after which servo always shutted down. | ||
| time.sleep(0.05) | ||
| while self.is_alive(): |
There was a problem hiding this comment.
do we perhaps want a timeout here after a couple of tries?
There was a problem hiding this comment.
You mean kill the process? Will that result in empty coverage report?
There was a problem hiding this comment.
it will result in a missing profile (so the coverage would be missing information from that process / test-run), but better than hanging forever. We could print a warning, if the regular shutdown failed.
There was a problem hiding this comment.
|
🔨 Triggering try run (#19155439487) for Linux (WPT) |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#55907). |
|
Test results for linux-wpt from try job (#19155439487): Flaky unexpected result (31)
Stable unexpected results that are known to be intermittent (16)
|
|
🔨 Triggering try run (#19156647195) for Linux (WPT) |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#55907). |
|
Test results for linux-wpt from try job (#19156647195): Flaky unexpected result (16)
Stable unexpected results that are known to be intermittent (8)
|
|
🔨 Triggering try run (#19158949680) for Linux (WPT) |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#55907). |
|
Test results for linux-wpt from try job (#19158949680): Flaky unexpected result (43)
Stable unexpected results that are known to be intermittent (22)
|
I still don't know why.. This seems so magical. Now 95% can finish; remaining 5% executor stuck at 90%... Will check log later. |
|
🔨 Triggering try run (#19319611504) for Linux (WPT) |
|
Test results for linux-wpt from try job (#19319611504): Flaky unexpected result (42)
Stable unexpected results that are known to be intermittent (31)
|
|
✨ Try run (#19319611504) succeeded. |
|
@yezhizhen Is this ready for review? |
yes. |
tests/wpt/tests/tools/wptrunner/wptrunner/browsers/servodriver.py
Outdated
Show resolved
Hide resolved
tests/wpt/tests/tools/wptrunner/wptrunner/browsers/servodriver.py
Outdated
Show resolved
Hide resolved
tests/wpt/tests/tools/wptrunner/wptrunner/browsers/servodriver.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
- Add retry Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
d3ad52c to
f97b92f
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#55907). |
Signed-off-by: Euclid Ye <[email protected]>
f97b92f to
1b4fdec
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#55907). |
|
⛔ Failed to properly merge the upstream pull request (web-platform-tests/wpt#55907). Please address any CI issues and try to merge manually. |
I like `servo` runner, or better known as its previous name `servodriver` to some people. However, it is getting quite often that I use `legacy`, or better known as its previous name `servo`. This is because `servo (previously servodriver)` harness shutdown very slowly due to its shutdown command #40455 - This PR improves the shutdown command in the way as titled. - Avoids accidental Prockill that may happen after regular shutdown. This may be related to @jschwe's report that coverage for WPT still reports empty more often than it should. Previously, shutdown is like: ``` 0:15.06 INFO Trying to shut down gracefully by extension command 0:18.13 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=8378): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=8378): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it")) 0:18.13 DEBUG Stopping WebDriver 0:20.19 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=8378): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=8378): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it")) 0:22.24 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=8378): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=8378): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it")) 0:14.99 DEBUG Hanging up on WebDriver session ``` Now: ``` INFO Trying to shut down gracefully by extension command 0:18.41 DEBUG Servo has shut down normally. HTTPConnectionPool(host='127.0.0.1', port=9098): Max retries exceeded with url: /status (Caused by NewConnectionError("HTTPConnection(host='127.0.0.1', port=9098): Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it")) 0:18.41 DEBUG TestRunnerManager cleanup 0:15.30 DEBUG Hanging up on WebDriver session ``` Testing: Locally, this reduce shutdown time from about 5 sec to 1 sec, counting from "Trying to shut down gracefully by extension command". [Try](https://github.com/servo/servo/actions/runs/22295662553/job/64492009162). Signed-off-by: Euclid Ye <[email protected]>

Previously, we always kill the instance when tests finish instead of normally shutting down. That blocked clean-ups works, such as Code Coverage we wanted to add, and other things I'm not aware of.
Testing: We have tested for a week and checked the logs of CI to confirm it works normally now.