File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -353,19 +353,20 @@ def test_vmprof_real_time_many_threads():
353353def test_vmprof_real_time_threads_exit ():
354354 # Registered threads that exit while profiling goes on used to leave
355355 # stale pthread ids in the list, and forwarding SIGALRM to one of them
356- # segfaulted.
356+ # segfaulted. Enough threads that glibc unmaps some of their stacks
357+ # instead of caching them, and a slow timer: sampling threads while
358+ # they start or exit at a high rate hits a different, older problem.
357359 import threading
358360 prof = vmprof .Profiler ()
359- with prof .measure (period = 0.001 , real_time = True ):
360- for _ in range (5 ):
361- threads = [threading .Thread (target = functime_foo , args = [0.01 , True ])
362- for _ in range (20 )]
363- for thread in threads :
364- thread .start ()
365- for thread in threads :
366- thread .join ()
367- # keep forwarding signals now that all of them are gone
368- functime_bar (0.1 )
361+ with prof .measure (period = 0.01 , real_time = True ):
362+ threads = [threading .Thread (target = functime_foo , args = [0.05 , True ])
363+ for _ in range (20 )]
364+ for thread in threads :
365+ thread .start ()
366+ for thread in threads :
367+ thread .join ()
368+ # keep forwarding signals now that all of them are gone
369+ functime_bar (0.3 )
369370 stats = prof .get_stats ()
370371 d = dict (stats .top_profile ())
371372 assert foo_time_name in d
You can’t perform that action at this time.
0 commit comments