-
Notifications
You must be signed in to change notification settings - Fork 406
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
GC takes too long with "parallel mark" if using GC_allow_register_threads()
#619
Comments
Is this reproducible with the following? On the latest master. If it is, then please provide back trace for all threads. |
Hi @ivmai -- with your cmake command it completes in about 80 seconds. Actually, I realized even my original build will also complete if given enough time, it just takes a very long time (~3min). This is latest master 7fc3e07 -- the 1
2
3
|
Hmm, the stack traces above do not show any issue - e.g. in case 1: thread 2 is working, other threads just wait thread 2 to complete its part of work. Is there a hang inside GC_mark_from (of thread 2)? If yes, where? |
Yes, my mistake. Passing quotes is not straightforward sometimes. Should be: |
I can't reproduce it on Mac-mini (x86_64).
Without GC_allow_register_threads:
So, I don't see any hang. On the opposite I see that parallel marker brings a speedup. |
I observe the same issue as described in @arshajii post. macOS Sonoma 14.2.1, Apple clang version 15.0.0 (clang-1500.1.0.2.5), M1 Pro. |
I see. Could you please investigate what is going on in GC_mark_from
Is some loop in GC_mark_from running forever, or is GC_mark_from called with same arguments unlimited amount of time, or something else? |
I took a look at this -- If I add some simple print statements in
Not sure if this is expected. Let me know if there's anything else that would be helpful. |
Just following up on this. Once this is sorted we'll be able to upgrade the GC in Codon. Let me know if there's anything else we can do to help track down the issue. |
Please fetch the latest master (I've added some assertion to detect an infinite loop in alloc.c, not sure if it relates to this issue). Also please check if this is reproducible with
Also print GC_gc_no along with the GC_mark_from arguments. And I don't understand whether you observe a hang or a too long execution of the given test code? |
It would be, of course, much better if you dig into the logic and figure out the root cause of this issue. (I don't think I will have time to do it myself within April or May.) |
Hi @ivmai -- I finally had time to revisit this. I'm pretty sure I've narrowed the problem down to this commit: 60e4b3f Prior to this commit, the test program in the my original post finishes in 1-2 seconds consistently. With this commit, it occasionally hangs for >2min (and other times it also completes in 1-2 seconds). Hopefully this is enough to track down the issue -- let me know if I can be of additional help. My build steps: cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_large_config=ON -Denable_thread_local_alloc=ON -Denable_handle_fork=ON
make
clang -O3 -Iinclude test.c build/libgc.a |
Interesting. I have modified the test to output some stat at the end. |
GC_allow_register_threads()
GC_allow_register_threads()
Just wanted to follow up on this and see if there's any way I can help. Do we have any idea what the issue might be? |
Current master f7e513a. Here is the test program:
Built with
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_large_config=ON -Denable_thread_local_alloc=ON -Denable_handle_fork=ON
on a M1 Max MacBook Pro.The program hangs here:
If you comment
GC_allow_register_threads()
or build with-Denable_parallel_mark=OFF
, it completes normally in about a second.The text was updated successfully, but these errors were encountered: