From c6f828532abaf926066a3b65fbe9402c7f801f84 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Thu, 1 Oct 2026 10:31:20 -0400 Subject: [PATCH] [Fix] (Pipe): nothing is published once the split session is gone MobileGL::Destroy shuts the split roles down first and resets the GL context after, by design. The frontend objects that die in that reset still found their handles published, so their deletes were routed to whichever applier was installed by then - the monolith one, which never had those resources and asserted ("ResourceDestroy named {slot, gen}") from eglTerminate. The abort also threw away the program's buffered output, so eglinfo printed nothing but the assertion. Every twin the server held died with the session, so ShutdownSplitRoles now clears the publication latch (MGPipeForgetAllPublications): the deletes that follow are local bookkeeping only. --- MobileGL/MG_Backend/Init.cpp | 4 ++++ MobileGL/MG_Impl/Pipe/PipeFill.cpp | 7 +++++++ MobileGL/MG_Pipe/PipeMutation.h | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/MobileGL/MG_Backend/Init.cpp b/MobileGL/MG_Backend/Init.cpp index 0bf7aba6..531bd8c1 100644 --- a/MobileGL/MG_Backend/Init.cpp +++ b/MobileGL/MG_Backend/Init.cpp @@ -14,6 +14,7 @@ #if MOBILEGL_BUILD_DISAGGREGATED #include #include +#include // MGPipeForgetAllPublications, at the end of ShutdownSplitRoles #include #include // InstallPipeSessionFailHook, installed at step 0 below #include @@ -398,6 +399,9 @@ namespace MobileGL::MG_Backend { // and every later split bring-up in the process fails at CreateBackend's m_backend!=null // guard. MG_Remote::Server::ServerLoopInstance().Stop(); + // The server's twins died with the session; the frontend objects that are destroyed after + // this (the GL context's) have nothing left on the other side to delete. + MG_Pipe::MGPipeForgetAllPublications(); } #endif diff --git a/MobileGL/MG_Impl/Pipe/PipeFill.cpp b/MobileGL/MG_Impl/Pipe/PipeFill.cpp index 1817ce21..3e7264a0 100644 --- a/MobileGL/MG_Impl/Pipe/PipeFill.cpp +++ b/MobileGL/MG_Impl/Pipe/PipeFill.cpp @@ -1828,6 +1828,11 @@ namespace MobileGL::MG_Pipe { *entry = Entry{}; } + void Clear() { + for (auto& table : m_kinds) table.clear(); + m_band.clear(); + } + private: struct Entry { Uint32 Gen = 0; @@ -1892,6 +1897,8 @@ namespace MobileGL::MG_Pipe { PublicationLatch().NoteUnpublished(kind, handle); } + void MGPipeForgetAllPublications() { PublicationLatch().Clear(); } + // THE GATE ITSELF, AS AN OBSERVABLE (ID-39, widened by S-3 / ID-41). Every P4a birth hook // below and every `wants()` row in the walk resolve through FamilyIsLive / // P4aFamilyHasItsConsumer / P4aFamilyDependenciesAreSet, and none of the three is reachable diff --git a/MobileGL/MG_Pipe/PipeMutation.h b/MobileGL/MG_Pipe/PipeMutation.h index 4382c15b..78ce8ba4 100644 --- a/MobileGL/MG_Pipe/PipeMutation.h +++ b/MobileGL/MG_Pipe/PipeMutation.h @@ -341,6 +341,12 @@ namespace MobileGL::MG_Pipe { void MGPipeNoteHandlePublished(MGPipeKind kind, MGPipeHandle handle); Bool MGPipeHandleIsPublished(MGPipeKind kind, MGPipeHandle handle); void MGPipeNoteHandleUnpublished(MGPipeKind kind, MGPipeHandle handle); + // THE SESSION IS GONE, AND EVERYTHING IT HELD WITH IT. Called once the split roles are shut + // down: every object the server twinned died with the session, so nothing is published any + // more - and the frontend objects that die after it (MobileGL::Destroy resets the GL context + // after ShutdownSplitRoles, by design) must not route a delete for a twin that no longer + // exists to whichever applier is installed now, which asserts on the unknown handle. + void MGPipeForgetAllPublications(); // ---- the four mints (pure allocator work, no family knowledge) ---- //