soegaard2
2020-5-7 08:21:08

Am I missing something or is the order of xy and yx different here?


soegaard2
2020-5-7 08:23:30

Also from dc.rkt:


laurent.orseau
2020-5-7 10:03:36

Do you observe a strange behaviour or is it only the docs?


soegaard2
2020-5-7 10:05:20

If the order is swapped in the docs, then the behaviour is as observed.

I noticed because of this issue: https://github.com/sicp-lang/sicp/issues/35


soegaard2
2020-5-7 10:08:32

The cairo docs explains the meaning:


soegaard2
2020-5-7 10:08:49

Maybe those equations should be added to the docs too.


popa.bogdanp
2020-5-7 10:11:09

Are there pre-built variants of Racket w/ debug symbols turned on anywhere? I’m trying to debug a segfault on Linux but I don’t have a dedicated Linux machine so I’d like to avoid building it myself. The segfault is reproducible with both BC 7.6 and 7.7.


popa.bogdanp
2020-5-7 10:12:26

The failure is to do with use of continuations in the web-server and possibly raco exe. Under load I can reliably get it to crash with

SIGSEGV MAPERR si_code 1 fault on addr 0x280 Aborted (core dumped) but the GDB trace isn’t very useful:

Program terminated with signal SIGABRT, Aborted. #0 0x00007fdaa22627bb in ?? () [Current thread is 1 (LWP 109)] (gdb) bt #0 0x00007fdaa22627bb in ?? () #1 0x0000000000010402 in ?? () #2 0x0000000000000000 in ?? () (gdb)


laurent.orseau
2020-5-7 10:13:36

Not sure if that’s helpful, but have you tried running as racket -l errortrace -t <myprog.rkt>? I don’t know if errortrace gives meaningful info on a segfault though


popa.bogdanp
2020-5-7 10:14:19

I don’t think I can, because this is a compiled app (with raco exe)


laurent.orseau
2020-5-7 10:14:55

can you embed errortrace with ++lib? I don’t know if that will make it use it though


popa.bogdanp
2020-5-7 10:14:56

oops, I was passing the wrong executable to gdb (the resulting exe instead of lib/plt/racket3m). I get a better trace now:


popa.bogdanp
2020-5-7 10:15:01

Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. [Current thread is 1 (Thread 0x7fdaa2227300 (LWP 109))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007fdaa224d535 in __GI_abort () at abort.c:79 #2 0x000000000067afa9 in fault_handler () #3 <signal handler called> #4 0x00000000006458bf in ?? () #5 0x0000000000645ba0 in ?? () #6 0x000000000067e6f9 in ?? () #7 0x0000000000681e56 in ?? () #8 0x0000000000686e84 in ?? () #9 0x000000000047a757 in ?? () #10 0x000000000048dbc0 in ?? () #11 0x000000000048fdf3 in ?? () #12 0x00000000004653ce in scheme_do_eval () #13 0x000000000047ace2 in ?? () #14 0x000000000047f6af in scheme_force_value_same_mark () #15 0x000000000046685a in _scheme_apply_from_native () #16 0x00007fdaa1ca61a1 in ?? () #17 0x002e646572697571 in ?? () #18 0x00007fda902395f3 in ?? () #19 0x00007fda933d5f48 in ?? () #20 0xfffffffffffff410 in ?? () #21 0x00007fff18e13d30 in ?? () #22 0x0000000000000002 in ?? () #23 0x0000000000003f82 in ?? () #24 0x0000000000000000 in ?? ()


popa.bogdanp
2020-5-7 10:15:37

I can try


popa.bogdanp
2020-5-7 10:18:22

Nope, that doesn’t seem to have made a difference


samth
2020-5-7 10:46:09

Ha


samth
2020-5-7 10:46:27

Does it still fail with -j? That might have a better stack trace.


popa.bogdanp
2020-5-7 10:48:43

Is there a way to pass -j all the day down into raco exe?


popa.bogdanp
2020-5-7 10:49:34

I can’t get it to fail reliably unless I go through raco exe. I was only ever able to get racket app.rkt to fail once, on macOS and I’m not sure it was the same issue.


popa.bogdanp
2020-5-7 10:52:40

I just built an exe using <https://plt.eecs.northwestern.edu/snapshots/current/installers/racket-test-7.7.0.4-x86_64-linux-wheezy.sh> and I haven’t been able to get it to crash.


samth
2020-5-7 10:59:55

PLTNOMZJIT=1


popa.bogdanp
2020-5-7 11:01:37

Still crashes


popa.bogdanp
2020-5-7 11:02:07

Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. [Current thread is 1 (Thread 0x7f9d088fc300 (LWP 694))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007f9d08922535 in __GI_abort () at abort.c:79 #2 0x000000000067afa9 in fault_handler () #3 &lt;signal handler called&gt; #4 0x00000000006458bf in ?? () #5 0x0000000000645c30 in ?? () #6 0x000000000067e6f9 in ?? () #7 0x0000000000681e56 in ?? () #8 0x0000000000686e84 in ?? () #9 0x000000000047a757 in ?? () #10 0x000000000048dbc0 in ?? () #11 0x000000000048fdf3 in ?? () #12 0x00000000004653ce in scheme_do_eval () #13 0x000000000046726a in ?? () #14 0x0000000000464916 in scheme_do_eval () #15 0x0000000000465d4e in scheme_do_eval () #16 0x000000000048a0d9 in scheme_finish_apply_for_prompt () #17 0x000000000048a286 in scheme_apply_for_prompt () #18 0x0000000000000000 in ?? ()


samth
2020-5-7 11:06:47

I wonder what those unknown frames are


samth
2020-5-7 11:08:06

can you go into frame 12 and figure out what’s being evaluated?


popa.bogdanp
2020-5-7 11:15:27

I don’t think I can w/o debug symbols, but by gdb-fu is weak.


popa.bogdanp
2020-5-7 11:15:55

info locals complains that no symtable is available


popa.bogdanp
2020-5-7 11:21:45

Running the app from within gdb doesn’t reproduce the issue either…


popa.bogdanp
2020-5-7 11:32:15

Wait.


popa.bogdanp
2020-5-7 11:32:28

The mere act of installing gdb seems to make it impossible to reproduce…


popa.bogdanp
2020-5-7 11:33:09

I had been dumping cores inside one docker container and debugging them in another before, but now that I’ve installed gdb in the original container, I can no longer reproduce the issue.


spdegabrielle
2020-5-7 13:55:36

is there a way to capture the mouse position when a racket/gui window doesn’t have focus? (class canvas% (inherit refresh) (define x 0) (define/override (on-event a-mouse-event) (set! x (/ (send a-mouse-event get-x) 1)) (refresh)) I suspect is it possible because I can get a negative mouse x-position by moving the moving the mouse quickly.


mark.warren
2020-5-7 13:57:28

I don’t know about if the window doesn’t have focus, but you will get negative values if you move left of or above the window.


mark.warren
2020-5-7 13:58:00

I think you still need window focus.


laurent.orseau
2020-5-7 14:05:54

By window you mean frame% or a window-area&lt;%&gt;?


laurent.orseau
2020-5-7 14:07:29

If the frame does not have the focus, then that will first depend on the window manager. If the frame has the focus but not the widget, that will depend on racket, and on the hierarchy of widgets


mflatt
2020-5-7 14:43:32

This is a very long shot, but since you consistently get an error with address 0x280, and since the stack trace suggests that the crash is in C code, I grepped the disassembly of Racket3m on 64-bit Linux to look for a dereference of a pointer with offset 0x280 (on the theory that it’s likely a dereference of a NULL pointer). The only good match I found is related to the sync_box field of a thread record, which at least sounds relevant to your application. But the only way I see for that to go wrong is for scheme_curent_thread to be NULL when scheme_get_thread_sync is called from nack_guard_evt_is_ready in struct.c. Overall, this doesn’t look promising, but if adding an assertion there for a build is easy, it might be worth a try.


spdegabrielle
2020-5-7 14:52:00

it could be either. I’m willign to try anything.


spdegabrielle
2020-5-7 14:52:35

I think it needs to be with window manager.


spdegabrielle
2020-5-7 14:53:29

I’m experimenting to see if I can make a version of xeyes, but just with racket/gui, not installing X


mflatt
2020-5-7 15:02:01

I don’t think events will be delivered anywhere, but you might be able to poll with get-current-mouse-state.


spdegabrielle
2020-5-7 15:45:25

Good tip get-current-mouse-state gets me the global coordinates, but sadly only works if the canvas gets some sort of focus. It was a fun idea but no matter.


mflatt
2020-5-7 15:50:16

I had in mind starting a thread or timer that polls get-current-mouse-state. That way, focus shouldn’t be relevant.


spdegabrielle
2020-5-7 15:50:37

I’ll try that.


spdegabrielle
2020-5-7 15:51:34

I’m looking for something fun to do after I was gazumped with urls in comments wish.


notjack
2020-5-7 17:52:33

Sometimes I want a place to talk about some package I’m making and whether some feature would be a good idea or not. So I created the #api-design channel. Feel free to join if you’re interested in improving libraries, languages, or frameworks.


sorawee
2020-5-7 18:16:06

@laurent.orseau might be interested :slightly_smiling_face:


notjack
2020-5-7 18:40:33

Got the idea from talking to him :slightly_smiling_face:


popa.bogdanp
2020-5-7 19:24:32

Thanks! I ended up setting up a VM to test this (compiling in Docker on Mac is way too slow) and I’m not able to reproduce the problem on Racket master. I’m compiling the v7.6 tag now to see if I can reproduce it that way


popa.bogdanp
2020-5-7 21:00:55

Core was generated by `/home/parallels/Desktop/projection-bias-experiment/koyo-experiment/./dist/bin/k'. Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. [Current thread is 1 (Thread 0x7f906b356300 (LWP 2925))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007f906a5d8801 in __GI_abort () at abort.c:79 #2 0x000056531aecdf0d in fault_handler (sn=11, si=0x56531bf7b370, ctx=0x56531bf7b240) at ./sighand.c:103 #3 &lt;signal handler called&gt; #4 0x000056531ae9551a in prepare_thread_for_GC (t=0x7f90588a8bb0) at ./../src/thread.c:9209 #5 0x000056531ae9581b in get_ready_for_GC () at ./../src/thread.c:9280 #6 0x000056531aedc161 in garbage_collect (gc=0x56531bf9afc0, force_full=0, no_full=0, switching_master=0, lmi=0x0) at ./newgc.c:5583 #7 0x000056531aecd72c in collect_now (gc=0x56531bf9afc0, major=0, nomajor=0) at ./newgc.c:875 #8 0x000056531aece3e9 in gc_if_needed_account_alloc_size (gc=0x56531bf9afc0, allocate_size=2064) at ./newgc.c:1312 #9 0x000056531aeceba9 in allocate_medium (request_size_bytes=2048, type=2) at ./newgc.c:1510 #10 0x000056531aecf21c in GC_malloc_allow_interior (s=2048) at ./newgc.c:1765 #11 0x000056531abae1ce in copy_in_mark_stack (p=0x7f90588a8bb0, cont_mark_stack_copied=0x0, cms=5551, base_cms=5551, copied_offset=5551, _sub_conts=0x7ffecdd61d18, clear_caches=1) at ./../src/fun.c:4812 #12 0x000056531abb26f6 in restore_continuation (cont=0x7f906021fef0, p=0x7f90588a8bb0, for_prompt=0, result=0x7f9060272110, resume=0x7f906027c3a8, empty_to_next_mc=1, prompt_tag=0x7f905a9b0620, common_dw=0x0, common_next_meta=0, shortcut_prompt=0x0, clear_cm_caches=1, do_reset_cjs=1, cm_cont=0x7f906027b758, extra_marks=0x0) at ./../src/fun.c:5926 #13 0x000056531abb350b in internal_call_cc (argc=3, argv=0x7f90577702a0) at ./../src/fun.c:6180 #14 0x000056531ab80901 in scheme_do_eval (obj=0x56531bf87090, num_rands=3, rands=0x0, get_value=-1) at ./../src/eval.c:2255 #15 0x000056531ab9eb07 in force_values (obj=0x4, multi_ok=1) at ./../src/fun.c:1426 #16 0x000056531ab9ed32 in scheme_force_value_same_mark (obj=0x4) at ./../src/fun.c:1472 #17 0x000056531ab7bcf7 in _scheme_apply_from_native_fast (rator=0x56531bf87230, argc=2, argv=0x7f90577702b8) at ./../src/schnapp.inc:39 #18 0x000056531ab7bf0d in _scheme_apply_from_native (rator=0x56531bf87230, argc=2, argv=0x7f90577702b8) at ./../src/schnapp.inc:80 #19 0x000056531ac37e95 in x_ts__scheme_apply_from_native (rator=0x56531bf87230, argc=2, argv=0x7f90577702b8) at ./../src/jitcall.c:291 #20 0x00007f906b1a61bc in ?? () #21 0x000000000000fffd in ?? () #22 0x00007f905740c205 in ?? () #23 0x0000000000000000 in ?? () took me forever but I finally have this. This is on the v7.6 branch. I’ll try to repro on master again tomorrow morning. I think the issue might still be present, just harder to reproduce because I have been able to do it with one of the published 7.7 releases.


samth
2020-5-7 21:05:25

Unless you’re using places (and maybe even if you are), I would encourage you to try reproducing under rr: http://rr-project.org\|rr-project.org


samth
2020-5-7 21:06:11

also, I don’t think continuation stuff has changed much since 7.6, so debugging there might be sufficient


popa.bogdanp
2020-5-7 21:09:16

OK, thanks. I’ll give rr a try tomrrow


samth
2020-5-7 21:10:05

can you go to frame 4 there and list the code?


popa.bogdanp
2020-5-7 21:10:37

(gdb) frame 4 #4 0x000056531ae9551a in prepare_thread_for_GC (t=0x7f90588a8bb0) at ./../src/thread.c:9209 9209 seg[stackpos].key = NULL; (gdb) list 9204 int stackpos; 9205 segpos = ((intptr_t)pos &gt;&gt; SCHEME_LOG_MARK_SEGMENT_SIZE); 9206 seg = p-&gt;cont_mark_stack_segments[segpos]; 9207 if (seg) { 9208 stackpos = ((intptr_t)pos &amp; SCHEME_MARK_SEGMENT_MASK); 9209 seg[stackpos].key = NULL; 9210 seg[stackpos].val = NULL; 9211 seg[stackpos].cache = NULL; 9212 } 9213 }


samth
2020-5-7 21:11:06

and can you print seg and stackpos?


samth
2020-5-7 21:11:44

and also segpos


popa.bogdanp
2020-5-7 21:12:04

(gdb) print seg $1 = (Scheme_Cont_Mark *) 0x200 (gdb) print stackpos $2 = 0 (gdb) print segpos $3 = 86


popa.bogdanp
2020-5-7 21:12:57

SIGSEGV MAPERR si_code 1 fault on addr 0x200 Aborted (core dumped) was the fault so seg looks like it’s invalid?


samth
2020-5-7 21:13:28

what’s p?


samth
2020-5-7 21:13:50

and also p-&gt;cont_mark_stack_segments


samth
2020-5-7 21:14:28

seg looks wrong, but subscripting a valid pointer with 86 shouldn’t get 0x200


popa.bogdanp
2020-5-7 21:15:03

(gdb) p p $7 = (Scheme_Thread *) 0x7f90588a8bb0 (gdb) p p-&gt;cont_mark_stack_segments $8 = (struct Scheme_Cont_Mark **) 0x7f905ff74498 (gdb) p segpos $9 = 86 (gdb) p pos $10 = 5504


samth
2020-5-7 21:15:45

ah, pos looks bad too


samth
2020-5-7 21:16:07

maybe, at least


samth
2020-5-7 21:16:14

5504 seems pretty large


popa.bogdanp
2020-5-7 21:17:15

(gdb) p p-&gt;cont_mark_stack_bottom $11 = 5551


popa.bogdanp
2020-5-7 21:17:23

this app makes pretty heavy use of continuations


samth
2020-5-7 21:17:35

ah, ok


popa.bogdanp
2020-5-7 21:17:42

(but I’ve encountered this issue with another app that doesn’t use ’em as much)


mflatt
2020-5-7 21:35:29

Thanks! It looks like a problem with a GC being triggered while a thread’s mark stack is being updated, and the half-updated mark stack confuses get_ready_for_GC.


notjack
2020-5-7 22:09:02

Pinned this message to keep the channel discoverable over time. (If that was inappropriate or there’s a better way to do that, unpinning the message is fine with me.)


mflatt
2020-5-7 22:20:06

I’ve pushed a potential repair, but I wasn’t able to construct an example that crashes before the change, so I’m not sure that the change will fix anything.


popa.bogdanp
2020-5-7 22:32:36

Awesome! I cherry-picked the change on top of v7.6 and haven’t been able to reproduce the crash. I’ll put together a minimal example that can reproduce the crash tomorrow morning and share. “Minimal” might not be the right word to use, but I think I know what the steps might be to reproduce just using libraries in the main distribution. Thanks again!


alex.r.laurie
2020-5-7 23:45:33

@alex.r.laurie has joined the channel