[MG_Remote, MG_Test] (P12 review): a lost server window is answered before every ring record, and a stopping in-process server leaves a streaming client's queue unapplied

- Major: the window-lost release was picked up only between drain batches (PumpControlRequest), and a client streaming frames keeps the command ring from emptying for seconds - surfaceDestroyed waited out its 3 s bound on the UI thread, answered TimedOut, and the session kept presenting into the destroyed window. DrainRing now checks the request after its latch check, before every pop. ServerLoopLatchTest.ALostServerWindowIsReleasedMidBatchWhileTheClientStreams streams a 4 s batch under Detach.
- Stop while streaming: mobilegl_server_stop_inprocess ended the session through loop.Stop(), whose batch and final drain of a ring the client keeps refilling could outlast the bounded join (Fatal{ApplyThreadJoinTimeout} aborts the display Activity's process). RunSession now calls ServerLoop::AbandonQueuedRecords() first when the server is stopping: the drain stops after the record in hand and the exit path declines the rest, as a ReverseChannelForfeit does. ServerLoopTest.StoppingTheServerUnderAStreamingClientLeavesTheQueueAndJoinsPromptly.
This commit is contained in:
2026-09-24 14:03:46 +00:00
parent cb0404f2b9
commit 8f2a084354
4 changed files with 213 additions and 0 deletions
+6
View File
@@ -437,6 +437,7 @@ int RunSession(std::unique_ptr<SocketTransport> control, std::vector<std::uint8_
if (backendBuilt) {
// Stop() joins a running apply thread (it destroys the backend on it), or - never
// started - drops the backend here; either way the display lease goes with it.
if (g_inProcessStop.load(std::memory_order_acquire)) loop.AbandonQueuedRecords();
loop.Stop();
session.SetBackend(nullptr);
}
@@ -723,6 +724,11 @@ int RunSession(std::unique_ptr<SocketTransport> control, std::vector<std::uint8_
}
}
loop.SetControlProgressSink(nullptr, nullptr);
// P12 review fix: A STOPPING SERVER DOES NOT DRAIN A STREAMING CLIENT. The session ends because
// the display server is going away, not because its client finished - and a client still
// streaming would keep the apply thread's final drain going past Stop()'s bounded join, whose
// Fatal{ApplyThreadJoinTimeout} aborts this (the display Activity's) process.
if (inProcess && g_inProcessStop.load(std::memory_order_acquire)) loop.AbandonQueuedRecords();
loop.Stop();
// Publish the final server window while log forwarding is still attached.
MobileGL::MG_Util::PipeStats::Shutdown();