termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
2k stars 303 forks source link

[Bug]: Intermittent X Connection Issues Causing Application Crashes #615

Closed b374sec closed 5 months ago

b374sec commented 5 months ago

Problem description

I have encountered an intermittent issue where applications occasionally crash due to X connection problems. This issue seems to occur unpredictably and results in the application exiting unexpectedly with X connection-related errors.

This problem does not affect all applications uniformly and seems particularly prevalent with for example simple games like "ExtremeTuxRacer" or "BillardGL". The crashes appear to be linked to X connection errors, but it is not yet clear whether these issues stem from the applications themselves, their interaction with Termux X11, or another aspect of the system setup.

Running the app (extremetuxracer) with strace appears to prevent the crash, which suggests there may be underlying timing or race condition issues involved.

Environment:

Device Information: OnePlus 7 Pro
Termux Version: Latest
Termux X11 Version: Latest
Mesa Driver: Turnip DRI3
Mesa Version: Mesa 24.0.5 - kisak-mesa PPA
GPU Acceleration Library: Zink
Linux: Ubuntu 22.04.4 LTS Chroot

What steps will reproduce the bug?

  1. Start the application normally, for example extremetuxracer by launching it from console etr
  2. Interact with the application
  3. Observe that the application sometimes exits unexpectedly

Console Output:

First Application (etr):

[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
billard-gl: ../../src/xcb_io.c:278: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted

Second Application (billard-gl):

X connection to :0 broken (explicit kill or server shutdown).
MESA: error: zink: failed to update swapchain capabilities: VK_ERROR_SURFACE_LOST_KHR

What is the expected behavior?

Applications should run continuously without interruption unless explicitly closed by the user.

twaik commented 5 months ago

The problem is reproducible only with specific application on your device so that means the problem is related to applications themselves or their dependencies (mesa?). All other applications work fine so I assume the problem is not relevant to the X server.

b374sec commented 5 months ago

It's indeed plausible that the issue could be specific to how certain applications or their dependencies interact with the X server, particularly since some other applications are functioning normally. However, the occurrence of xcb errors led me to consider the possibility that there might be an underlying issue related to the X server's handling of messages from these applications.

I plan to conduct additional tests and check if any recent updates to the applications or their dependencies might correlate with the issues observed.