Menu

#426 crash on launch in gdk_x_error

v1.0_(example)
open
nobody
None
5
2024-01-03
2023-12-31
No

On my macOS 12.7.2 system, gscan2pdf 2.13.2 (installed using MacPorts) crashes on launch. It suggests to set the GDK_SYNCHRONIZE environment variable and run the program under a debugger and get a backtrace, which I've done.

% gscan2pdf

(net.sourceforge.gscan2pdf:75532): Gdk-ERROR **: 13:12:16.745: The program 'net.sourceforge.gscan2pdf' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 245 error_code 10 request_code 132 (unknown) minor_code 1)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
zsh: trace trap  gscan2pdf
% lldb -- perl5.34 /opt/local/bin/gscan2pdf
(lldb) target create "perl5.34"
Current executable set to 'perl5.34' (x86_64).
(lldb) settings set -- target.run-args  "/opt/local/bin/gscan2pdf"
(lldb) b gdk_x_error
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) run
Process 75631 launched: '/opt/local/bin/perl5.34' (x86_64)
1 location added to breakpoint 1
Process 75631 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00000001025d0b26 libgdk-3.0.dylib`gdk_x_error
libgdk-3.0.dylib`gdk_x_error:
->  0x1025d0b26 <+0>: pushq  %rbp
    0x1025d0b27 <+1>: movq   %rsp, %rbp
    0x1025d0b2a <+4>: pushq  %r15
    0x1025d0b2c <+6>: pushq  %r14
Target 0: (perl5.34) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x00000001025d0b26 libgdk-3.0.dylib`gdk_x_error
    frame #1: 0x0000000100c9dd70 libX11.6.dylib`_XError + 278
    frame #2: 0x0000000100c9bbc4 libX11.6.dylib`handle_error + 89
    frame #3: 0x0000000100c9b3aa libX11.6.dylib`handle_response + 93
    frame #4: 0x0000000100c9b8ef libX11.6.dylib`_XReply + 288
    frame #5: 0x0000000100c85dfe libX11.6.dylib`_XGetWindowAttributes + 170
    frame #6: 0x0000000100c85fed libX11.6.dylib`XGetWindowAttributes + 50
    frame #7: 0x00000001025d78ad libgdk-3.0.dylib`gdk_x11_window_foreign_new_for_display + 194
    frame #8: 0x00000001025dee2f libgdk-3.0.dylib`check_manager_window + 122
    frame #9: 0x00000001025c429a libgdk-3.0.dylib`_gdk_x11_display_open + 371
    frame #10: 0x000000010259f005 libgdk-3.0.dylib`gdk_display_manager_open_display + 343
    frame #11: 0x00000001049edfe8 libgtk-3.0.dylib`gtk_init_check + 19
    frame #12: 0x00000001049ee01c libgtk-3.0.dylib`gtk_init + 13
    frame #13: 0x0000000100ad5eaa libffi.8.dylib`ffi_call_unix64 + 82
    frame #14: 0x0000000100ad5765 libffi.8.dylib`ffi_call_int + 730
    frame #15: 0x0000000100ad5467 libffi.8.dylib`ffi_call + 219
    frame #16: 0x0000000100be592b Introspection.bundle`invoke_c_code + 3211
    frame #17: 0x0000000100bde36b Introspection.bundle`XS_Glib__Object__Introspection_invoke + 1243
    frame #18: 0x0000000100633641 libperl.dylib`Perl_pp_entersub + 2561
    frame #19: 0x0000000100628026 libperl.dylib`Perl_runops_standard + 22
    frame #20: 0x000000010057e8d9 libperl.dylib`Perl_call_sv + 889
    frame #21: 0x000000010057a8f5 libperl.dylib`Perl_call_list + 501
    frame #22: 0x0000000100566e18 libperl.dylib`S_process_special_blocks + 440
    frame #23: 0x000000010055e9b0 libperl.dylib`Perl_newATTRSUB_x + 6000
    frame #24: 0x000000010055f78b libperl.dylib`Perl_utilize + 1611
    frame #25: 0x00000001005b6117 libperl.dylib`Perl_yyparse + 2807
    frame #26: 0x000000010057d03c libperl.dylib`perl_parse + 9004
    frame #27: 0x0000000100003de6 perl5.34`main + 166
    frame #28: 0x000000010001552e dyld`start + 462
(lldb) 

Discussion

  • Jeffrey Ratcliffe

    I don't own a Mac and I don't know of anyone with one, so debugging this is going to be tricky. I'm also in the middle of a complete rewrite in Python (from Perl) in order be able to move from Gtk3 to Gtk4.

    This looks like a problem with gtk and Perl on your Mac, rather than being a bug in gscan2pdf.

    So if you can come up with a patch that fixes this, I'd be happy to consider it. Otherwise, I'd say try out the rewrite (probably called scantpaper) when I have finished it. Not sure when that might be. I hope maybe in a couple of months.

     
  • Ryan Carsten Schmidt

    Agreed, I am seeing the same crash with other software that uses gtk.

     

Log in to post a comment.