Skip to content

UDS tests: the first 0x78 races P2ClientMax, and no test-side spacing governs it #118

Description

@dborgards

Split out of #114 because it survives that audit rather than being part of it. Not measured failing — a named quantity with a thin margin, filed so it is checkable rather than remembered.

What #117 fixed, and what it did not

#117 removed the delayBetween spacing from ResponsePending_Loop_Aborts_When_Exceeding_MaxResponsePendingCount, because that spacing raced P2StarClientMax and was not load-bearing (a no-restart mutation passes at the old 20 ms, so it carried nothing).

delayBetween only governs the gap between 0x78 responses. It says nothing about the first one, whose arrival is an ISO-TP round trip across two channels plus the simulated ECU's own loop, and which must land inside P2ClientMax or the client times out on P2 before any of the pending logic is reached.

So every one of these tests carries a first-hop budget that no test-side value controls:

test P2ClientMax
Client_Times_Out_With_P2Star_When_Ecu_Sends_Only_ResponsePending 100 ms
ResponsePending_Restarts_P2Star_And_Returns_Final_Response 120 ms
Client_Times_Out_When_Ecu_Silent_Within_P2 150 ms
TimedOut_Request_Does_Not_Poison_Next_Same_Service_Transaction 80 ms
ResponsePending_Loop_Aborts_When_Exceeding_MaxResponsePendingCount 500 ms
two Dispose tests (:732, :760) 5 s

The bottom two are generous on purpose. The 80 ms and 150 ms entries are tests where the timeout is the subject — a slow host only makes them surer, so they fail safe. The two in bold are the exposure: the first 0x78 must arrive inside 100 ms or 120 ms, and the assertion is that something other than a P2 timeout happens.

Why this is a hypothesis and not a finding

It has never gone red, and I have not reproduced it. What makes it worth filing is the arithmetic against a quantity the host demonstrably perturbs — the same day produced three measured instances of exactly that:

the wait the budget inflation measured
#115 Th 50 ms × 28 gaps ShortTimeout 5 s — (margin 3.6×, 6/6 red)
#116 Th 1 ms × 254 gaps WithTimeout 10 s Schedule(1 ms) → ~200 ms under 8× load
#117 delayBetween 20 ms P2StarClientMax 1 s a 20 ms Task.Delay past 1 s on macOS

A host that stretches a 20 ms Task.Delay past a second is a host that can stretch an ISO-TP round trip past 100 ms. That is the whole argument, and it is an argument, which is why this is filed rather than fixed.

What would settle it

Lower P2ClientMax in the two bold tests until they fail, under load, with the unmodified suite run as a control under the same load — the control is not optional here, and #114 records why: a probe on the ISO-TP deadlines reported one failure at every value I tried, and the control showed every one of them was an unrelated flake (Bam_MaximumPayload_Roundtrip, now #116) rather than anything the probe caused.

If the cliff is near 100 ms, these are red and want fixing. If it is an order of magnitude below, this issue closes as not planned with the number recorded.

What a fix would not be

Raising P2ClientMax. It is a product timing option, the tests set it deliberately low to prove the client is not living inside a generous initial budget (ResponsePending_Restarts_P2Star_… says so in its own comment), and raising it is the tolerance that gets widened again next time.

The real answer is the one #114's seam table already names for this layer: UdsClientImpl reads Stopwatch.GetTimestamp() directly at :804, so P2 and P2* cannot be driven by a test clock. A time seam there would remove the whole family of first-hop races at once — and it overlaps #102's area, so the two want sequencing together.

Provenance

This was written into #117's description as "it stays on #114" before any such record existed. It did not; #114 has five comments and none mentions P2ClientMax. Filed here after the maintainer asked whether an issue existed or whether I had merely noted it.

Refs #92, #114, #117.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: testsTest suite, coverage, API approvalstype: testsTest coverage — a missing, weak or flaky test

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions