~martijnbraam/Megapixels#52: 
Race condition at start-up on X

After upgrading GTK+ 4 on Hương Tràm, Megapixels now can occasionally start on Sxmo. Since the following patch seems to fix the crash, I suspect it is due to a race condition.

diff --git a/src/main.c b/src/main.c
index b096e8e..67ba5b5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,6 +2,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <linux/videodev2.h>
 #include <linux/media.h>
 #include <linux/v4l2-subdev.h>
@@ -914,6 +915,7 @@ activate(GtkApplication *app, gpointer data)
        update_screen_rotation(conn);
 
        mp_io_pipeline_start();
+       sleep(1);
 
        gtk_application_add_window(app, GTK_WINDOW(window));
        gtk_widget_show(window);

Edit: This was last night. The patch isn't working for me any more )-;

Status
REPORTED
Submitter
~cnx
Assigned to
No-one
Submitted
3 years ago
Updated
3 years ago
Labels
No labels applied.

~murks 3 years ago

So is the GTK4 issue actually fixed? Do we know what the issue was? Right now we are doing nothing more than playing bug tracker ping pong between Megapixels and SXMO.

~cnx 3 years ago

#51 was fixed, I don't have any insight though. Megapixels now can occasionally starts on my ALARM with Sxmo, but in most of the cases the window is not initialized (i.e. there's a frame with the content of the element underneath), which response to close event but megapixels does not die with it (I still need to ^C at it).

~murks 3 years ago

#51 was only closed because it is believed to be a bug in SXMO. Over at SXMO it was closed because they thought it had been solved elsewhere. So now we have a "resolved: not our bug" in both bug trackers and no actual solution. Someone with knowledge of GTK at their hands or a lot of time would need to have a look at what the actual issue is.

~cnx 3 years ago

So now we have [...] no actual solution

There is: Megapixels is working on Sxmo on ALARM. Since this only started to happen after an GTK+ 4 upgrade, my bet would be on the GTK+ 4 version. On Arch Linux it is currently 4.2.1-1 while on Alpine Linux it is 4.2.0-r0.

I agree that for the race condition,

Someone with knowledge [...] at their hands or a lot of time would need to have a look at what the actual issue is.

~murks 3 years ago

Well, 4.2.1 sure helped in a sense. Now I get a different error on every startup. In one case Megapixels even showed the preview image only to crash on taking a photo with process_pipeline.c: process_image: 593 I'm struggling a bit with redirecting both stdout and stderr in ash, so I don't have proper logs yet.

~murks 3 years ago

One issue seems to be that Megapixels asks over DBUS for a DisplayConfig. org.freedesktop.DBus.Error.NameHasNoOwner: Name "org.gnome.Mutter.DisplayConfig" From what I could gather that is provided by the Gnome Settings Daemon, which of course is not running on SXMO.

This is more likely a regular failure than the root cause of this issue.

~murks 3 years ago

Also interesting, on Phosh vs SXMO Megapixels initialises:

OpenGL ES 2.0

OpenGL 2.1

~murks 3 years ago

I have found further evidence that it is indeed a race condition. Megapixels starts up reliably for me through X-Forwarding.

  1. Enable X forwarding on the PinePhone.
  2. Connect using 'ssh -X -Y -C'.
  3. Uninstall megapixels-gtk3-0.16.1-r0 and install megapixels-1.0.1-r0 (in that order since the packages are not conflicting and would overwrite files).
  4. Start megapixels and see it work (with abysmal framerate, but still).

$ GDK_SCALE=2 megapixels
Renderdoc not found
Found config file at /usr/share/megapixels/config/pine64,pinephone-1.2.ini
Adding camera rear from config
Adding camera front from config
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 37554
debug1: channel 1: new [x11]
debug1: confirm x11

(megapixels:10848): GLib-GIO-CRITICAL **: 22:16:55.715: g_dbus_connection_signal_subscribe: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(megapixels:10848): GLib-GIO-CRITICAL **: 22:16:55.715: g_dbus_connection_call_internal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
Found postprocessor script at /usr/share/megapixels/postprocess.sh
Initialized OpenGL 3.1

(megapixels:10848): Gtk-CRITICAL **: 22:16:59.041: Unable to connect to the accessibility bus at 'unix:path=/tmp/dbus-JC3XqPgPFe,guid=a2258a4fe58728b5db7b9eb760e48c50': Could not connect: No such file or directory
Gdk-Message: 22:16:59.135: Failed to get file transfer portal: Failed to execute child process “dbus-launch” (No such file or directory)

~murks 3 years ago

Probably unrelated but this error comes up regularly while running megapixels this way, but it doesn't have any obvious adverse effect.

WARNING: decoder/databar.c:1248: _zbar_decode_databar: Assertion "seg->finder >= 0" failed. i=31 f=-1(010) part=0

~benjamin-schaaf 3 years ago

Register here or Log in to comment, or comment via email.