H17: Sample soak client memory at the results of a match decided in the drop
The R5 gate's soak failed its client leak check: match 0 was decided during the drop (23 eliminations as the clients landed) and never reached play, which is the only phase soak_clients sampled memory in, so each client process had one sample instead of two. Hashes, tick timing and server memory all passed. A match that never reaches play is now sampled at its results, and the memory line says which phase it was taken in. The rule is a static function, SoakClients.samples_memory_in, covered by a new test. A results sample can sit a little above a play sample, so a run that samples match 0 at its results is slightly lenient on growth from it. Closes #86 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
extends TestCase
|
||||
|
||||
## R5: the soak samples each client process's memory once a match. A match can be
|
||||
## decided during the drop (test_match covers that) and never reach play, so such a
|
||||
## match is sampled at its results; otherwise the soak's leak check had too few samples.
|
||||
|
||||
const SoakClients: GDScript = preload("res://tools/soak_clients.gd")
|
||||
|
||||
|
||||
func test_memory_is_sampled_in_play_and_at_results() -> void:
|
||||
assert_true(SoakClients.samples_memory_in(Match.PLAY))
|
||||
assert_true(SoakClients.samples_memory_in(Match.RESULTS), "a match decided during the drop")
|
||||
|
||||
|
||||
func test_memory_is_not_sampled_before_play() -> void:
|
||||
for phase: int in [Match.LOBBY, Match.COUNTDOWN, Match.DROP]:
|
||||
assert_false(SoakClients.samples_memory_in(phase), Match.PHASE_NAMES[phase])
|
||||
@@ -0,0 +1 @@
|
||||
uid://clerstsk6qkiw
|
||||
+12
-3
@@ -17,7 +17,8 @@
|
||||
## same N as --hash-every here), when the client's world has caught up exactly.
|
||||
## {"event":"client_match", "client", "match", ...}: a client's prediction statistics
|
||||
## for a match it played, once the match is over for it.
|
||||
## {"event":"memory", "match", "mem_bytes"}: this process's memory as each match began.
|
||||
## {"event":"memory", "match", "at", "mem_bytes"}: this process's memory as each match
|
||||
## began play, or at its results for a match decided during the drop.
|
||||
## {"event":"soak_client", ...}: one per client at the end.
|
||||
## {"event":"soak_process", ...}: frame times, totals and errors, last.
|
||||
## It stops when every client's connection has closed, or after --seconds.
|
||||
@@ -170,9 +171,11 @@ func _follow(client: Dictionary) -> void:
|
||||
elif int(client["stats_match"]) >= 0:
|
||||
_report_match(client)
|
||||
# Once a match is in play every client here has let go of the last match's world.
|
||||
if game.match_phase == Match.PLAY and not _memory_logged.has(game.match_index):
|
||||
# A match can be decided during the drop and never reach play; then it is sampled
|
||||
# at its results instead, so every match still gives one sample.
|
||||
if samples_memory_in(game.match_phase) and not _memory_logged.has(game.match_index):
|
||||
_memory_logged[game.match_index] = Time.get_ticks_msec()
|
||||
print(JSON.stringify({"event": "memory", "match": game.match_index, "mem_bytes": OS.get_static_memory_usage(), "objects": Performance.get_monitor(Performance.OBJECT_COUNT), "worlds": _live_worlds()}))
|
||||
print(JSON.stringify({"event": "memory", "match": game.match_index, "at": Match.PHASE_NAMES[game.match_phase], "mem_bytes": OS.get_static_memory_usage(), "objects": Performance.get_monitor(Performance.OBJECT_COUNT), "worlds": _live_worlds()}))
|
||||
elif game.match_phase == Match.PLAY and _memory_logged.has(game.match_index) and _memory_logged.has(-1 - game.match_index) == false \
|
||||
and Time.get_ticks_msec() - int(_memory_logged[game.match_index]) > LATE_MEMORY_MSEC:
|
||||
# A second look a minute later, for telling a leak from something let go late.
|
||||
@@ -180,6 +183,12 @@ func _follow(client: Dictionary) -> void:
|
||||
print(JSON.stringify({"event": "memory_late", "match": game.match_index, "mem_bytes": OS.get_static_memory_usage(), "objects": Performance.get_monitor(Performance.OBJECT_COUNT), "worlds": _live_worlds()}))
|
||||
|
||||
|
||||
## Whether a client's memory is sampled for a match in `phase`: when it begins play, or
|
||||
## at its results if it was decided during the drop and never reached play.
|
||||
static func samples_memory_in(phase: int) -> bool:
|
||||
return phase == Match.PLAY or phase == Match.RESULTS
|
||||
|
||||
|
||||
func _report_match(client: Dictionary) -> void:
|
||||
var stats: Array = client["last_stats"]
|
||||
var record: Dictionary = {
|
||||
|
||||
Reference in New Issue
Block a user