Thread overview
GtkD crash: 'BadAlloc (insufficient resources for operation)'
Apr 27, 2020
mark
Apr 27, 2020
Cogitri
Apr 27, 2020
mark
Apr 28, 2020
Cogitri
April 27, 2020
I'm getting a crash when I add 1000s of rows to a tree (up to 100s seems to work ok).

The source code is here: https://github.com/mark-summerfield/debfind
Note that this will only build and run on a Debian or Debian-derived system (e.g., Ubuntu).

I am pretty well reaching the point of giving up with GtkD -- and therefore with GUI programming in D since there isn't really a decent reliable D GUI library that I can find. (I don't want to use Qt or QML because of the licensing issues.)


(DebFind:3285): Gdk-ERROR **: 12:59:59.299: The program 'DebFind' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
  (Details: serial 25818 error_code 11 request_code 130 (MIT-SHM) minor_code 5)
  (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.)
Program exited with code -5

April 27, 2020
Hello,

could you try what the error message suggest you to do:

On Monday, 27 April 2020 at 12:03:18 UTC, mark wrote:
>   (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.)
> Program exited with code -5

With that you should be able to run your program in gdb and get a backtrace.
However, BadAlloc sounds to me as if your program is running out of RAM and as such can't allocate more memory.
April 27, 2020
I took Adam's advice about .gdbinit and now it runs in gdb.

When I ran the program I did Find 'memoize' which worked. Then 'memoize python' which also worked. Then said to find 'any word' (which produces 1000s of rows) at which point it crashed. Below is the bt. Does it look like my bug or a Gtk or GtkD bug?

$ gdb DebFind
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
[snip]
Reading symbols from DebFind...done.
(gdb) run
Starting program: /home/mark/app/d/debfind/DebFind
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffeddfc700 (LWP 2441)]
[New Thread 0x7fffed5fb700 (LWP 2442)]
[New Thread 0x7fffe7fff700 (LWP 2443)]
[New Thread 0x7ffff7fe2700 (LWP 2444)]
[New Thread 0x7ffff7fdc700 (LWP 2445)]
[New Thread 0x7ffff7fd6700 (LWP 2446)]
[New Thread 0x7ffff7e64700 (LWP 2447)]
[New Thread 0x7ffff7e5e700 (LWP 2448)]
[New Thread 0x7ffff7e58700 (LWP 2449)]
[New Thread 0x7ffff7e52700 (LWP 2450)]
warning: Corrupted shared library list: 0x5555560a5e60 != 0x555555dabe00
[New Thread 0x7fffc20ff700 (LWP 2451)]
[New Thread 0x7fffc18fe700 (LWP 2452)]
[Thread 0x7fffe7fff700 (LWP 2443) exited]
[Thread 0x7fffc18fe700 (LWP 2452) exited]
populateNames
populateNames
populateNames

(DebFind:2436): Gdk-ERROR **: 15:48:40.080: The program 'DebFind' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
  (Details: serial 12790 error_code 11 request_code 130 (MIT-SHM) minor_code 5)
  (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.)

Thread 1 "DebFind" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff66c3ea1 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007ffff66c3ea1 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007ffff66c6819 in g_log_writer_default () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff66c4a8e in g_log_structured_array () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff66c54ce in g_log_structured_standard () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff5f62c41 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#5  0x00007ffff5f6fac3 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x55555579a280 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

#6  0x00007ffff37138fa in _XError () at /usr/lib/x86_64-linux-gnu/libX11.so.6
warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

#7  0x00007ffff371082b in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#8  0x00007ffff37108d5 in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#9  0x00007ffff3711205 in _XEventsQueued () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#10 0x00007ffff3702d3d in XPending () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#11 0x00007ffff5f6a09e in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#12 0x00007ffff66bdb28 in g_main_context_prepare () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff66be4fb in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

#14 0x00007ffff66be6dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

#15 0x00007ffff537eefd in g_application_run () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

#16 0x000055555579a2d5 in warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

_D3gio11ApplicationQn3runMFAAyaZiwarning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

 (warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

this=0x7ffff7ed0360, warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

argv=...)warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

 at Application.dwarning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x55555579a2d4 in read in psymtab, but not in symtab.)

:931
#17 0x0000555555784380 in D main (args=...) at app.d:18

April 28, 2020
On Monday, 27 April 2020 at 14:53:06 UTC, mark wrote:
> Below is the bt. Does it look like my bug or a Gtk or GtkD bug?

That's hard to say without the debug info for gtkd, gtk and glib installed (so the backtrace isn't all the useful), but since gtkd isn't mentioned in the log I guess that it's something in the interaction of gdk and X11. I guess it'd be best to ask the GTK folks about this.