Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gctest hang on Cygwin in gdb (multi-threaded w/o thread-local-alloc) #523

Open
ivmai opened this issue Jan 17, 2023 · 6 comments
Open

gctest hang on Cygwin in gdb (multi-threaded w/o thread-local-alloc) #523

ivmai opened this issue Jan 17, 2023 · 6 comments

Comments

@ivmai
Copy link
Owner

ivmai commented Jan 17, 2023

Source: master (98200e4) (also reproduced even on release-7_4)
Host: Windows 10 (x64)
Build: gcc -O0 -g -I include -D GC_THREADS -D GC_ASSERTIONS -D GC_DISABLE_INCREMENTAL tests/test.c extra/gc.c && gdb a.exe
(same w/o -D GC_ASSERTIONS -D GC_DISABLE_INCREMENTAL)
set GC_PRINT_STATS=1
(same w/o GC_PRINT_STATS)
Ctrl-C (or Break) does not work.

Output:
...
--> Marking for collection #2 after 0 allocated bytes
World-stopped marking took 8 ms 225600 ns (10 ms in average)
GC #2 freed 0 bytes, heap 64 KiB (+ 425 KiB internal)
In-use heap: 0% (0 KiB pointers + 0 KiB other)
0 finalization entries; 0/0 short/long disappearing links alive
0 finalization-ready objects; 0/0 short/long links cleared
Finalize and initiate sweep took 0 ms 900 ns + 1 ms 987500 ns
Complete collection took 20 ms 565100 ns
Switched to incremental mode
Emulating dirty bits with mprotect/signals
[New Thread 158144.0x26b48]
Adding block map for size of 3 granules (48 bytes)
Adding block map for size of 12 granules (192 bytes)

@ivmai
Copy link
Owner Author

ivmai commented Jan 17, 2023

If launched w/o gdb, may hang in other places:

Case 1:

--> Marking for collection #23 after 128 allocated bytes
World-stopped marking took 14 ms 931500 ns (13 ms in average)
GC #23 freed -7040 bytes, heap 3008 KiB (+ 489 KiB internal)
In-use heap: 0% (28 KiB pointers + 0 KiB other)
0 finalization entries; 0/0 short/long disappearing links alive
0 finalization-ready objects; 0/0 short/long links cleared
Finalize and initiate sweep took 0 ms 1300 ns + 17 ms 515000 ns
Complete collection took 50 ms 409500 ns
Initiating full world-stop collection!
Forked child process, pid= 1327

@ivmai
Copy link
Owner Author

ivmai commented Jan 17, 2023

Case 2:

--> Marking for collection #99 after 5237232 allocated bytes
Marked from 5 dirty pages
World-stopped marking took 28 ms 678000 ns (16 ms in average)
GC #99 freed 9842400 bytes, heap 44992 KiB (+ 2089 KiB internal)
In-use heap: 18% (3120 KiB pointers + 5211 KiB other)
0 finalization entries; 6/0 short/long disappearing links alive
0 finalization-ready objects; 0/0 short/long links cleared
Finalize and initiate sweep took 0 ms 192600 ns + 12 ms 828000 ns
Finished second reverse_test at time 36498 (0xff7fcbb0)
Finished 0xff7fcbb0

@ivmai
Copy link
Owner Author

ivmai commented Jan 25, 2023

Also reproduced without gdb:
gcc -O3 -I include -Wall -Wextra -Wpedantic -D GC_THREADS -D GC_ASSERTIONS -D USE_MMAP -D USE_MUNMAP tests/gctest.c extra/gc.c && a.exe

@ivmai
Copy link
Owner Author

ivmai commented Feb 9, 2023

Probably same case with Mingw32.
Source: master (ba3051b)
Command: make -j -f Makefile.direct CC=gcc CFLAGS_EXTRA='-Werror -Wall -Wextra -Wpedantic -O3 -march=native -D GC_THREADS -D GC_GCJ_SUPPORT -D GC_TIME_LIMIT=10 -D WINXP_USE_PERF_COUNTER -D NO_MSGBOX_ON_ERROR' -j4 check
Not reproduced if GC_DISABLE_INCREMENTAL=1 or THREAD_LOCAL_ALLOC
Output (last lines):

--> Marking for collection #53 after 5228928 allocated bytes
Marked from 249 dirty pages
World-stopped marking took 17 ms 234300 ns (14 ms in average)

@ivmai
Copy link
Owner Author

ivmai commented Apr 28, 2023

Reproduced locally on release-8_2 (bef858c)
Build command: gcc -O2 -Wall -Wextra -Wpedantic -I include -D GC_ASSERTIONS -D GC_THREADS -I libatomic_ops/src tests/test.c extra/gc.c

  1. run gctest -> hang
  2. set GC_PRINT_STATS=1 and run gctest -> terminates silently after GC 152

Not reproduced with -D THREAD_LOCAL_ALLOC

@ivmai
Copy link
Owner Author

ivmai commented Oct 25, 2023

Source: unknown
Hang (cygwin): gcc -O0 -g -I include -Wall -Wextra -Wpedantic -D GC_THREADS -D GC_ASSERTIONS -D USE_MMAP -D USE_MUNMAP -D GC_DISABLE_INCREMENTAL tests/gctest.c extra/gc.c
gcc -O3 -I include -D_WINDOWS -DGC_THREADS -DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION -DGC_REQUIRE_WCSDUP -DUSE_MUNMAP -DUSE_MMAP tests/gctest.c extra/gc.c
Hang after: GC #178 freed 2716864 bytes, heap 17472 KiB (+ 32256 KiB unmapped + 2218 KiB internal)
Ctrl-C does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant