Bug in pict3d leads to crash in DrRacket

There has been a bug with pict3d for some time now.

Already posted the problem a couple of times on the racket discord. Hopefully someone here can fix it

Thanks for the bump. Perhaps unsurprisingly, I'm unable to reproduce this bug on macOS. Are there other linux desktop users that can test this?

1 Like

Please, could anyone else with linux ( or another os besides mac os ) try to replicate the bug?

I see the bug as well. The current-pict3d-legacy? parameter does not change the results.

This appears to be a pretty fundamental issue in racket/draw. The following program crashes for me (on 8.17):

#lang racket
(require racket/gui/base)

(define canvas (new canvas% [parent (new frame% [label ""])] [style '(gl)]))
(send (send canvas get-dc) get-gl-context)

For me, too:

philip@bastet:/tmp$ cat sam.rkt 
#lang racket
(require racket/gui/base)

(define canvas (new canvas% [parent (new frame% [label ""])] [style '(gl)]))
(send (send canvas get-dc) get-gl-context)
philip@bastet:/tmp$ racket sam.rkt 

(process:410960): Gtk-WARNING **: 16:25:02.222: Locale not supported by C library.
        Using the fallback 'C' locale.
Gtk-Message: 16:25:02.312: Failed to load module "colorreload-gtk-module"
Gtk-Message: 16:25:02.312: Failed to load module "window-decorations-gtk-module"
invalid memory reference.  Some debugging context lost
  context...:
   /gnu/store/z0qlv55n78aajs2f6r5jcq1rfcwrdlrb-racket-vm-cs-8.17/opt/racket-vm/collects/racket/private/more-scheme.rkt:266:2: call-with-exception-handler
   /gnu/store/z0qlv55n78aajs2f6r5jcq1rfcwrdlrb-racket-vm-cs-8.17/opt/racket-vm/collects/racket/private/promise.rkt:104:0: force/generic
   /gnu/store/1c5x53nqspxpsqqipvzzf99wpas532qb-racket-8.17/lib/racket/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt:352:0: make-gtk-drawable-gl-context
   /gnu/store/1c5x53nqspxpsqqipvzzf99wpas532qb-racket-8.17/lib/racket/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt:465:0: make-gtk-widget-gl-context
   /gnu/store/1c5x53nqspxpsqqipvzzf99wpas532qb-racket-8.17/lib/racket/pkgs/gui-lib/mred/private/wx/gtk/dc.rkt:190:4: get-gl-context method in dc%
   .../private/arrow-higher-order.rkt:379:33
   body of "/tmp/sam.rkt"

(The Gtk locale and module-loading messages are probably due to my local setup, but the rest shouldn't be.)

This code is not crashing for me on Linux. I'm running Mint 20, which is fairly old, and Racket from git(only 2 commits behind).

Are you suggesting pict3d is bugged because of an error with racket/draw?

Yes, I do not think the bug is in pict3d.

1 Like

I tried this on another Linux machine and was still not able to replicate it. This was a Linux Mint 22 machine.

It would be helpful to know more about which systems are crashing:
kernel version
X or Wayland
graphics driver
etc.

Also, reproducing the crash in gdb might reveal more about where the problem lies. If not familiar with gdb, try something like:

# gdb racket
(gdb) run crash.rkt
<crash occurs>
(gdb) bt full
<gdb stack trace>
1 Like

| LiberalArtist
August 31 |

  • | - |

samth:

This appears to be a pretty fundamental issue in racket/draw. The following program crashes for me (on 8.17):

For me, too:

philip@bastet:/tmp$ cat sam.rkt 
#lang racket
(require racket/gui/base)

(define canvas (new canvas% [parent (new frame% [label ""])] [style '(gl)]))
(send (send canvas get-dc) get-gl-context)

FWIW, this program doesn't crash for me on macOS 12.7.6 (!) running Racket 8.17 [cs].

I'm getting this on Wayland. Here's the backtrace:

Thread 1 "gracketcs" received signal SIGSEGV, Segmentation fault.
Downloading source file /build/libx11-aL6a2q/libx11-1.8.7/build/src/../../src/QuExt.c
0x00007ffff54e9205 in XQueryExtension (dpy=dpy@entry=0x555555787a90, name=name@entry=0x7ffff092317f "GLX",
    major_opcode=major_opcode@entry=0x5555561e9ad4, first_event=first_event@entry=0x7fffffffdb34,
    first_error=first_error@entry=0x5555561e9ad8) at ../../src/QuExt.c:48
warning: 48     ../../src/QuExt.c: No such file or directory
(gdb) where
#0  0x00007ffff54e9205 in XQueryExtension
    (dpy=dpy@entry=0x555555787a90, name=name@entry=0x7ffff092317f "GLX", major_opcode=major_opcode@entry=0x5555561e9ad4, first_event=first_event@entry=0x7fffffffdb34, first_error=first_error@entry=0x5555561e9ad8) at ../../src/QuExt.c:48
#1  0x00007ffff091f5dc in InitDisplayInfoEntry (dpy=0x555555787a90) at ../src/GLX/libglxmapping.c:639
#2  __glXLookupDisplay (dpy=dpy@entry=0x555555787a90) at ../src/GLX/libglxmapping.c:755
#3  0x00007ffff09206dd in glXQueryVersion (dpy=0x555555787a90, major=0x54adabf8, minor=0x54adac48) at ../src/GLX/libglx.c:1166
#4  0x0000000051c5d1cf in ??? ()
#5  0x0000000000000026 in ??? ()
#6  0x0000555555574c3a in S_call_help (tc_in=tc_in@entry=0x555555635440 <S_G>, singlep=singlep@entry=1, lock_ts=lock_ts@entry=0)
    at racket/src/ChezScheme/c/schlib.c:249
#7  0x0000555555574ecd in S_call (argcnt=2, cp=0x43ab0afd, tc=0x555555635440 <S_G>) at racket/src/ChezScheme/c/schlib.c:212
#8  Scall2 (cp=0x43ab0afd, x1=x1@entry=0x43ac175d, x2=x2@entry=0x43a64869) at racket/src/ChezScheme/c/schlib.c:166
#9  0x000055555556749c in racket_boot (ba=ba@entry=0x7fffffffdd80) at racket/src/cs/c/boot.c:256
#10 0x0000555555565718 in bytes_main
    (argc=<optimized out>, argv=<optimized out>, wm_is_gracket_or_x11_arg_count=0, gracket_guid_or_x11_args=0x55555561e127 "0x0")
    at racket/src/cs/c/main.c:287
#11 0x00007ffff7c2a1ca in __libc_start_call_main
    (main=main@entry=0x555555564e60 <main>, argc=argc@entry=1, argv=argv@entry=0x7fffffffdfc8)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#12 0x00007ffff7c2a28b in __libc_start_main_impl
    (main=0x555555564e60 <main>, argc=1, argv=0x7fffffffdfc8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdfb8) at ../csu/libc-start.c:360
#13 0x0000555555564fe5 in _start ()

And the system is running an Intel graphics card with the xe driver, kernel 6.11.0 on Ubuntu.

1 Like

This post mentioning Wayland remember me that on my Linux (Ubuntu) i no more use Wayland and use Xorg simply because Racket does not works with Wayland. I switched one year ago, so i can not remember what happened, ah si, the package manager GUI was freezing and Racket was not usable for this reason (but i could have installed package from CLI , annoying solution)...I do not know if i'm off topic, perheaps the problem is not coming from Racket but with Wayland or the Racket code needs to be adapted for Wayland, i do not know...

update: note i can not confirm that with Wayland, as i use fvwm crystal with an uptime of 21 days...i can not check it now :sweat_smile:

Running with GDK_BACKEND=x11 fixes the crash. I recommend trying that as a workaround.

2 Likes

I think i provided all that information on the github issue

Could you elaborate a little more on how to use gdb or the like ? i have no experience using such tools

Can confirm running pict3d on x server doesnt crash drracket. The problem at least for me happens with wayland

currently using X11 and no problem with DrRacket to run the test from github issue

mattei@acer:~$ echo $XDG_SESSION_TYPE
x11
mattei@acer:~$ echo $WAYLAND_DISPLAY

mattei@acer:~$ loginctl show-session 3 -p Type
Type=x11

but can not test it under Wayland as it requires closing all my session

1 Like