# Bug in pict3d leads to crash in DrRacket

**URL:** <https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897>\
**Category:** Questions & Answers\
**Tags:** drracket\
**Created:** [August 11, 2025, 2:36am UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897 "2025-08-11T02:36:35Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![GunpowderGuy](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gunpowderguy/32/2192_2.png) [@GunpowderGuy](https://racket.discourse.group/u/GunpowderGuy)\
**Post date:** [August 11, 2025, 2:36am UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/1 "2025-08-11T02:36:35Z")

</div>

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

> <https://github.com/jeapostrophe/pict3d/issues/34>
>
> Hellow, i am a novice racket programmer trying to test pict3d. I followed the in…structions to test it, but running the example program
> 
> \#lang racket
> (require pict3d)
> (sphere origin 1/2)
> 
> results in the crash of drracket
> 
> could you please explain how i can diagnose this problem
> 
> A few months ago i experienced the same problem on another machine that used a different linux distro ( opensuse tumbleweed ) . I currently used fedora

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [August 11, 2025, 11:59am UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/2 "2025-08-11T11:59:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![GunpowderGuy](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gunpowderguy/32/2192_2.png) [@GunpowderGuy](https://racket.discourse.group/u/GunpowderGuy)\
**Post date:** [August 31, 2025, 12:56am UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/3 "2025-08-31T00:56:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [August 31, 2025, 4:09pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/4 "2025-08-31T16:09:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [August 31, 2025, 7:34pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/5 "2025-08-31T19:34:39Z")

</div>

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

```scheme
#lang racket
(require racket/gui/base)

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

```

---

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [August 31, 2025, 8:29pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/6 "2025-08-31T20:29:17Z")

</div>

> [@samth](#):
>
> This appears to be a pretty fundamental issue in `racket/draw`. The following program crashes for me (on 8.17):

For me, too:

```scheme
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.)

---

<div class="post-metadata">

**Author:** ![jjsimpso](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jjsimpso/32/602_2.png) [@jjsimpso](https://racket.discourse.group/u/jjsimpso)\
**Post date:** [August 31, 2025, 9:05pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/7 "2025-08-31T21:05:11Z")

</div>

> [@samth](#):
>
> ```scheme
> #lang racket
> (require racket/gui/base)
> 
> (define canvas (new canvas% [parent (new frame% [label ""])] [style '(gl)]))
> (send (send canvas get-dc) get-gl-context)
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![GunpowderGuy](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gunpowderguy/32/2192_2.png) [@GunpowderGuy](https://racket.discourse.group/u/GunpowderGuy)\
**Post date:** [September 2, 2025, 4:08pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/8 "2025-09-02T16:08:38Z")

</div>

> [@samth](#):
>
> racket/draw

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

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [September 2, 2025, 4:37pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/9 "2025-09-02T16:37:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjsimpso](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jjsimpso/32/602_2.png) [@jjsimpso](https://racket.discourse.group/u/jjsimpso)\
**Post date:** [September 3, 2025, 8:27pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/10 "2025-09-03T20:27:17Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [September 3, 2025, 9:01pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/11 "2025-09-03T21:01:43Z")

</div>

> > ![](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/45/151_2.png "LiberalArtist") | [LiberalArtist](https://racket.discourse.group/u/liberalartist)  
> > August 31 |
> > 
> > - | - |
> 
> > ![](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/48/3_2.png)samth:
> > 
> > This appears to be a pretty fundamental issue in `racket/draw`. The following program crashes for me (on 8.17):
> 
> For me, too:
> 
> ```scheme
> 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].

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [September 6, 2025, 8:49pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/12 "2025-09-06T20:49:49Z")

</div>

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

```scheme
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.

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [September 6, 2025, 9:29pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/13 "2025-09-06T21:29:06Z")

</div>

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 😅

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [September 6, 2025, 9:38pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/14 "2025-09-06T21:38:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GunpowderGuy](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gunpowderguy/32/2192_2.png) [@GunpowderGuy](https://racket.discourse.group/u/GunpowderGuy)\
**Post date:** [September 6, 2025, 9:46pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/15 "2025-09-06T21:46:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [September 6, 2025, 10:06pm UTC](https://racket.discourse.group/t/bug-in-pict3d-leads-to-crash-in-drracket/3897/16 "2025-09-06T22:06:24Z")

</div>

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

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

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

```

 ![2025-09-07-000412_1920x1080_scrot](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/1/1b6766660ca0e25ffaf8ee41b0146b24f2800c03.png)

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