Skip to content

Fix HTTP callback dispatch after JNI re-registration - #148

Open
lirenzzzin wants to merge 1 commit into
minecraft-linux:masterfrom
lirenzzzin:fix/http-callback-dispatch
Open

lirenzzzin wants to merge 1 commit into
minecraft-linux:masterfrom
lirenzzzin:fix/http-callback-dispatch

Conversation

@lirenzzzin

Copy link
Copy Markdown

Summary

  • preserve the request callbacks resolved from libHttpClient.Android.so
  • identify libHttpClient source calls through the launcher linker
  • route each completion or failure callback to the native implementation that owns its source call

Root cause

A later JNI library can register native methods with the same HttpClientRequest callback names. That replaces the callback stored in the shared FakeJni descriptor. Normal Minecraft HTTP requests are then delivered to a callback that expects a different sourceCall layout, which eventually tries to lock an invalid mutex and crashes in pthread_mutex_lock.

This keeps the later registration available for calls created by that library, while calls whose first native pointer belongs to libHttpClient.Android.so are sent back to the original libHttpClient callback.

Validation

  • built with the Trinity Flatpak SDK on x86_64
  • tested with Minecraft Bedrock 1.26.31.1 and the official update module enabled
  • before the fix: repeatable SIGSEGV immediately after the first successful HTTP response
  • after the fix: two isolated startup tests reached MinecraftGame initialization and Play Games, then remained alive until the 20 s and 25 s test timeouts
  • the dispatch behavior was also validated in a diagnostic build with Microsoft sign-in, online presence, and joining a friend world

Related to minecraft-linux/mcpelauncher-manifest#1759.

@lirenzzzin

Copy link
Copy Markdown
Author

CI follow-up: 14 checks passed, including Bookworm x86, x86_64, armhf and arm64 plus the main macOS client variants. I inspected the logs for all five failed checks; none reached the modified client code.

  • linux build and build32: actions/checkout cannot start because the Xenial container lacks the GLIBC versions required by the bundled Node 20 runtime
  • Buster AppImage: the Debian Buster repositories used by the builder no longer expose Release files
  • macOS M1 ANGLE: Xcode reports that the Metal Toolchain is not installed
  • macOS Protobuf: its dependency compiler check cannot find C++11 support

So the red overall workflow status is caused by existing builder/toolchain failures, not a compile failure in this patch. The local RelWithDebInfo build and runtime smoke tests remain green.

@ChristopherHX

Copy link
Copy Markdown
Member

Why not just uninstall mod mcpelauncher-updates then? It is not compatible with trinity and never is going to be.

@lirenzzzin

Copy link
Copy Markdown
Author

Thanks for clarifying. In my setup, removing mcpelauncher-updates also removes the compatibility patches needed by the newer game version. I understand that Trinity is unsupported. If this scenario is out of scope upstream, I’ll maintain the fix downstream.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants