test: fix L0_lifecycle test_shutdown_dynamic exit timeout - #8889
Conversation
| suffix = msg[len(self._GRPC_CONNECTION_REFUSED_PREFIX) :].strip() | ||
| self.assertIn(suffix, self._GRPC_CONNECTION_REFUSED_SUFFIXES, msg) | ||
|
|
||
| def _assert_shutdown_rejects_new_request(self, ex): |
There was a problem hiding this comment.
Since it's only called once, I'm not sure this function is necessary.
There was a problem hiding this comment.
Agreed , it was only used in one place, so the helper wasn't worth it. Removed in 721e9c07; test_shutdown_sequence now inlines the check (allow CANCELLED, otherwise expect the connection-refused error string), same as the other call sites.
Greptile SummaryThis PR fixes flaky
Confidence Score: 5/5Safe to merge — two minimal, well-scoped shell fixes that directly address the documented root cause without touching production code. Both changes are in test infrastructure only. The 120 s exit timeout sourced from util.sh is consistent with the value already used for model-stability waits throughout the same script. The || true on wait is narrowly placed in the cleanup path after the test has already validated its assertions, so no real failure can be silently swallowed. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant SH as test.sh
participant TS as Triton Server
participant PT as pytest (test_shutdown_dynamic)
SH->>TS: "start with --exit-timeout-secs=120s"
SH->>PT: run test (set +e)
PT->>TS: "send 6 async inferences (execute_delay_ms=5000)"
PT->>TS: SIGINT
note over TS: drains in-flight requests (up to 120 s window)
TS-->>SH: exit (may be non-zero if timeout fires)
PT-->>SH: pytest result
SH->>SH: check_unit_test (set -e)
SH->>SH: grep server log for gRPC connection count
SH->>TS: "kill $SERVER_PID || true (safety net)"
SH->>SH: "wait $SERVER_PID || true (non-zero exit tolerated)"
Reviews (5): Last reviewed commit: "test: fix L0_lifecycle test_shutdown_dyn..." | Re-trigger Greptile |
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
| # flake8: noqa |
There was a problem hiding this comment.
Pre-commit #8897 fixed flake8 arg parsing, and it now enforces rules that were silently disabled before. That surfaced ~30 pre-existing lints in this file (unused vars, imports after sys.path.append, etc.) ,none from this fix. Added # flake8: noqa to unblock CI without turning this PR into a lint cleanup. Happy to drop it and clean them up in a separate PR if you'd rather.
There was a problem hiding this comment.
Can you clean it up in this PR?
There was a problem hiding this comment.
If you install pre-commit locally, does it automatically reformat for you?
There was a problem hiding this comment.
No isort and black auto-fix formatting, but flake8 is a reporter. E402/F841/E721/E712/E711/F401 all need manual edits.
There was a problem hiding this comment.
Can you clean it up in this PR?
Cleaned up in f36a9bd — removed the # flake8: noqa and fixed the pre-existing lints (E402/F841/E266/E721/E712/E711/F401).
| self.assertTrue( | ||
| msg.startswith(self._GRPC_CONNECTION_REFUSED_PREFIX), msg | ||
| ) | ||
| self.assertStartsWith(self._GRPC_CONNECTION_REFUSED_PREFIX, msg) |
There was a problem hiding this comment.
I just realized self.assertStartsWith is available in 3.14. Our test environment might not be supporting it.
There was a problem hiding this comment.
So I'll revert back to self.assertTrue(msg.startswith(...)) - okay?
There was a problem hiding this comment.
Went with self.assertTrue(msg.startswith(...)) in f36a9bd.
Extend the exit-timeout window for the test_shutdown_dynamic server launch to SERVER_TIMEOUT (120s) and tolerate a non-zero wait exit so "set -e" does not abort the rest of L0_lifecycle when the exit timeout fires while draining in-flight dynamic-batch work. Root cause: the test issues 6 async inferences with execute_delay_ms=5000 and then SIGINTs the server while they are in flight. The default 30s Triton exit timeout is not enough for the drain on Luna, so the server logs "Exit timeout expired" and exits non-zero, and "wait $SERVER_PID" under "set -e" aborts the whole suite. The related lifecycle_test.py assertion-string and lint changes from earlier revisions of this branch are now redundant with #8888 on main, so this PR carries only the shutdown-timeout fix in test.sh.
f36a9bd to
0256d33
Compare
|
I removed your NVBUGS ID from title. |
What does the PR do?
Fix
L0_lifecyclefailures on Luna whereLifeCycleTest.test_shutdown_dynamicpasses pytest but the QA script aborts during server cleanup.Root cause
test_shutdown_dynamicstarts the server without--exit-timeout-secs, so Triton uses the default 30s shutdown window.execute_delay_ms=5000, then SIGINT while they are in flight; draining can exceed 30s on Luna (~80% failure rate).Exit timeout expiredand exits non-zero;wait $SERVER_PIDunderset -eaborts the rest ofL0_lifecycle(silent failure in the main log).Fix
qa/L0_lifecycle/test.sh:--exit-timeout-secs=${SERVER_TIMEOUT}(120s) for thetest_shutdown_dynamicserver launch so draining has room to complete.wait $SERVER_PID || trueafter cleanup so a non-zero server exit does not abort the suite.Previous revisions of this branch also touched
qa/L0_lifecycle/lifecycle_test.py(gRPC error-string assertions and pre-existing flake8 lints). Those changes are redundant with #8888, which landed on main after this PR was opened, so this PR now carries only thetest.shfix.Checklist
<commit_type>: <Title>Commit Type:
Related PRs:
lifecycle_test.pyfor gRPC v1.81.1)Where should the reviewer start?
qa/L0_lifecycle/test.sh—test_shutdown_dynamicserver args (--exit-timeout-secs) and cleanupwait.Test plan:
L0_lifecycle--basegreen at commit721e9c07(job 368596258, pipeline 58809167); log showstest_shutdown_dynamicran and*** Test Passed ***.d41ea55failed on(111)assertion mismatch (job 368365178);8ba9e9fband38c233daalso green.TRITON_SERVER_BRANCH_NAME=vinyak/nvbug-6450088-l0-lifecycle-shutdown-timeoutandTRITON_THIRD_PARTY_REPO_TAG=4d8c8cecto work around a transientmasterpy3 build break (gRPC patch); that pin is CI-only, not part of this PR.Caveats:
third_partyfor CI verification only;mainpy3 builds were failing independently (gRPCCMakeLists.txtpatch mismatch).test.shfix is unchanged.Background
L0_lifecycle) and platform (Luna x86).Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)