[MG_Util, MG_Remote] (P12 review): the in-process display server forwards only its live session's own log lines to that session's client, and sends them outside the log mutex

SetLogForwarder forwards every server-role thread's line, which is right for a session child (the process is the session) and wrong for the display Activity's process, where MOBILEGL_IPC_ROLE=server makes every thread a server thread: the UI thread's surface callbacks and the listener's lines - naming other peers' addresses, Busy refusals included - went into the live client's control socket. And the forward was a blocking SendFrame under the global log mutex, so a client that stopped reading held that mutex and hung the UI thread at its next log line (surfaceDestroyed's Detach logs).

In-process, RunSession now installs SetSessionLogForwarder: only the session thread and the threads that opt in (the session's apply thread, SetThreadForwardsLogToPeer) forward, and the send happens after the log mutex is released, under a forward mutex of its own (WithLogBarrier takes both, so the flush ack still follows every send that began; a line logged by the send itself is not re-sent). The forked session child keeps SetLogForwarder unchanged; the pull build's Log() is unchanged (G1).
This commit is contained in:
2026-09-24 14:03:47 +00:00
parent 7680b78621
commit ee456ccc40
4 changed files with 73 additions and 3 deletions
+3
View File
@@ -362,6 +362,9 @@ namespace MobileGL::MG_Remote::Server {
// own log. Under spawn the process role already answers this; under INPROC it is the
// only thing that can, because the client role is another thread of this same process.
MG_Util::Debug::SetThreadLogRole(MG_Util::Debug::LogRole::Server);
// P12 review fix: and it is one of the session's own threads, whose lines a session-scoped
// forwarder (the in-process display server's) sends to the client. Inert otherwise.
MG_Util::Debug::SetThreadForwardsLogToPeer(true);
Bool recognised = true;
const char* raw = AffinityStringFromConfig();
+7 -2
View File
@@ -574,8 +574,13 @@ int RunSession(std::unique_ptr<SocketTransport> control, std::vector<std::uint8_
}
const char* forwarding = std::getenv("MOBILEGL_IPC_LOG_FORWARD");
if (tcp && (!forwarding || std::strcmp(forwarding, "0") != 0))
MobileGL::MG_Util::Debug::SetLogForwarder(&ForwardLog, control.get());
if (tcp && (!forwarding || std::strcmp(forwarding, "0") != 0)) {
// P12 review fix: in-process, only THIS session's threads (this one and its apply thread)
// forward, and outside the log mutex - the UI thread, the listener and the next session's
// refusals share this process and must neither reach this client nor wait on it.
if (inProcess) MobileGL::MG_Util::Debug::SetSessionLogForwarder(&ForwardLog, control.get());
else MobileGL::MG_Util::Debug::SetLogForwarder(&ForwardLog, control.get());
}
// p7/spawnhang: this thread posts every surface op the client sends (ServerApplyWireSurfaceOp,
// below) and is the one that says "still running" while the apply thread runs it. Cleared
// after the loop, on this same thread, so no post can be in flight when it goes.