www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GtkD crash: 'BadAlloc (insufficient resources for operation)'

reply mark <mark qtrac.eu> writes:
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
Apr 27 2020
next sibling parent Cogitri <oss cogitri.dev> writes:
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.
Apr 27 2020
prev sibling parent reply mark <mark qtrac.eu> writes:
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

/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

/usr/lib/x86_64-linux-gnu/libgdk-3.so.0

/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.)


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


/usr/lib/x86_64-linux-gnu/libX11.so.6

/usr/lib/x86_64-linux-gnu/libX11.so.6

/usr/lib/x86_64-linux-gnu/libX11.so.6

/usr/lib/x86_64-linux-gnu/libX11.so.6

/usr/lib/x86_64-linux-gnu/libgdk-3.so.0

/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

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


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


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


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

Apr 27 2020
parent Cogitri <oss cogitri.dev> writes:
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.
Apr 28 2020