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 msys64 if mprotected-based incremental collection is on #634

Open
ivmai opened this issue Apr 17, 2024 · 9 comments
Open

Comments

@ivmai
Copy link
Owner

ivmai commented Apr 17, 2024

Source: master (2b30780)
Build: https://ci.appveyor.com/project/ivmai/bdwgc/builds/49679393/job/c6p5a9x5oxe7vrci
Host: Windows x64
compiler: gcc 13.3.0 9 (cygwin-based compiler, not mingw one)
AppVeyor image: Visual Studio 2022
Config: CFLAGS_EXTRA=-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 -D NO_TEST_ENDTHREADEX -D GC_ASSERTIONS

@ivmai
Copy link
Owner Author

ivmai commented Apr 17, 2024

Might be related: #573

@ivmai ivmai changed the title gctest hang rarely on msys64 gctest hang on msys64 Apr 24, 2024
@ivmai
Copy link
Owner Author

ivmai commented May 3, 2024

Not reproducible with -D NO_MPROTECT_VDB

@ivmai
Copy link
Owner Author

ivmai commented May 3, 2024

Output:

./gctest
Got 65536 bytes from OS
Got 65536 bytes from OS
Got 65536 bytes from OS
In-use heap: 0% (0 KiB pointers + 0 KiB other)
Got 65536 bytes from OS
Grow heap to 64 KiB after 0 bytes allocated
Grew heap sections array to 32 elements
Initiating full world-stop collection!
0 bytes in heap blacklisted for interior pointers

--> Marking for collection #1 after 0 allocated bytes
Pushed 1 thread stacks
World-stopped marking took 6 ms 434801 ns (6 ms in average)
Bytes recovered before sweep - f.l. count = 0
GC #1 freed 0 bytes, heap 64 KiB (+ 0 KiB unmapped + 362 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 29000 ns + 0 ms 42900 ns
Complete collection took 6 ms 624600 ns
Initiating full world-stop collection!
0 bytes in heap blacklisted for interior pointers

--> Marking for collection #2 after 0 allocated bytes
Pushed 1 thread stacks
World-stopped marking took 0 ms 824600 ns (3 ms in average)
Bytes recovered before sweep - f.l. count = 0
GC #2 freed 0 bytes, heap 64 KiB (+ 0 KiB unmapped + 362 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 400 ns + 0 ms 22401 ns
Complete collection took 0 ms 951900 ns
Supported VDBs: manual mprotect
Initializing mprotect virtual dirty bit implementation
Switched to incremental mode
Emulating dirty bits with mprotect/signals (covering also ptr-free pages)
Adding block map for size of 3 granules (48 bytes)
...
--> Marking for collection #1867 after 464608 allocated bytes
Marked from 53 dirty pages
Pushed 5 thread stacks
World-stopped marking took 2 ms 437600 ns (1 ms in average)
Bytes recovered before sweep - f.l. count = 0
GC #1867 freed 0 bytes, heap 4032 KiB (+ 6016 KiB unmapped + 874 KiB internal)
In-use heap: 43% (1123 KiB pointers + 616 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 35000 ns + 0 ms 227400 ns
Finished second reverse_test at time 5032 (0x7ff7fc988)
Finished 0x7ff7fc988

@ivmai ivmai changed the title gctest hang on msys64 gctest hang on msys64 if mprotected-based incremental collection is on May 3, 2024
@ivmai
Copy link
Owner Author

ivmai commented May 3, 2024

Reproduced locally with
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 -D NO_TEST_ENDTHREADEX' check

@ivmai
Copy link
Owner Author

ivmai commented Jun 4, 2024

@ivmai
Copy link
Owner Author

ivmai commented Aug 6, 2024

--> Marking for collection #1867 after 464608 allocated bytes

This may vary from run to run, e.g. GC#1788

Hang occurs in ~2 mins

@ivmai
Copy link
Owner Author

ivmai commented Aug 6, 2024

Tip how to install msys2 on Win64 host (https://www.devdungeon.com/content/install-gcc-compiler-windows-msys2-cc) w/o mingw compiler:

@ivmai
Copy link
Owner Author

ivmai commented Aug 6, 2024

Reproduced locally with
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 -D NO_TEST_ENDTHREADEX -D GC_ASSERTIONS' check

Not reproduced locally (as of commit 7f1503d), but a silent exit occurs after collection ~424.

@ivmai
Copy link
Owner Author

ivmai commented Aug 6, 2024

After this issue is fixed, reenable pure (non-mingw) msys2 config to test the fix: TARGET=msys64, CFLAGS_EXTRA='-O3 -march=native -D GC_ASSERTIONS -D GC_GCJ_SUPPORT -D GC_THREADS -D GC_TIME_LIMIT=10'

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