[Bug 283101] pthread_cancel() doesn't cancel a thread that's currently in pause()
Date: Sat, 21 Dec 2024 11:15:35 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283101 --- Comment #18 from vedad@kajtaz.net --- (In reply to Konstantin Belousov from comment #17) Your latest patch didn't apply over the previous one, so I git-checkout'd first. > PID 33078, iteration 340...pthread_cancel() succeeded > OK > Abort trap (core dumped) I guess the abort() occurred at iteration 341, whose stdout wasn't flushed. dmesg: > pthread(pid 33078 uid 0) aborted: thr_in_critical %p(0x1fc231a12700) (gdb) thread apply all bt full Thread 2 (LWP 337498): #0 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:38 No locals. #1 0x0000000821978d4b in _thr_umtx_wait (mtx=0x1fc231a12700, id=688152, timeout=0x0) at /usr/src/lib/libthr/thread/thr_umtx.c:198 No locals. #2 0x000000082196da7e in join_common (pthread=0x1fc231a12700, thread_return=0x82043ebc0, abstime=0x0, peek=<optimized out>) at /usr/src/lib/libthr/thread/thr_join.c:144 __cup = {prev = 0x0, routine = 0x82196dbf0 <backout_join>, routine_arg = 0x1fc231a12700, onheap = 0} ts = {tv_sec = 34901060464, tv_nsec = 34923276780} ts2 = {tv_sec = 0, tv_nsec = 34918916759552} curthread = 0x1fc231a12000 ret = <optimized out> tid = 688152 tsp = 0xa8018 tmp = <optimized out> #3 0x0000000000201aee in thread_cancel_and_join (ptid=0x1fc231a12700) at pthread.c:28 status = 0x0 error = 0 #4 0x0000000000201a2c in main (argc=1, argv=0x82043ec98) at pthread.c:73 ptid = 0x1fc231a12700 err = 0 iteration = 341 pid = 33078 Thread 1 (LWP 688152): #0 abort2 () at abort2.S:4 No locals. #1 0x0000000821974b0e in sigcancel_handler (sig=<optimized out>, info=<optimized out>, ucp=<optimized out>) at /usr/src/lib/libthr/thread/thr_sig.c:198 p = {0x1fc231a12700} curthread = 0x1fc231a12700 err = <optimized out> #2 <signal handler called> No symbol table info available. #3 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:38 No locals. #4 0x0000000821978a30 in __thr_umutex_lock (mtx=0x1fc231a12708, id=688152) at /usr/src/lib/libthr/thread/thr_umtx.c:79 owner = <optimized out> #5 0x000000082196c30a in _thr_umutex_lock (mtx=0x1fc231a12708, id=17) at /usr/src/lib/libthr/thread/thr_umtx.h:123 No locals. #6 exit_thread () at /usr/src/lib/libthr/thread/thr_exit.c:301 curthread = 0x1fc231a12700 #7 0x000000082196c1fe in _pthread_exit_mask (status=status@entry=0x1, mask=mask@entry=0x0) at /usr/src/lib/libthr/thread/thr_exit.c:263 curthread = 0x1fc231a12700 cleanup = <optimized out> #8 0x000000082196c06b in _Tthr_exit (status=0x1fc231a12708, status@entry=0x1) at /usr/src/lib/libthr/thread/thr_exit.c:206 No locals. #9 0x000000082196a400 in testcancel (curthread=<optimized out>) at /usr/src/lib/libthr/thread/thr_cancel.c:51 No locals. #10 _thr_cancel_enter (curthread=curthread@entry=0x1fc231a12700) at /usr/src/lib/libthr/thread/thr_cancel.c:149 No locals. #11 0x0000000821975002 in __thr_sigsuspend (set=0x822ca5f80) at /usr/src/lib/libthr/thread/thr_sig.c:692 newset = {__bits = {583688064, 8, 0, 0}} curthread = 0x1fc231a12700 old = 0 ret = <optimized out> #12 0x0000000821fcea65 in __pause () at /usr/src/lib/libc/gen/pause.c:51 oset = {__bits = {0, 0, 0, 0}} #13 0x0000000000201a81 in thread (arg=0x0) at pthread.c:12 No locals. #14 0x000000082196bb55 in thread_start (curthread=0x1fc231a12700) at /usr/src/lib/libthr/thread/thr_create.c:289 set = {__bits = {0, 0, 596938712, 8}} #15 0x0000000000000000 in ?? () (gdb) frame 1 #1 0x0000000821974b0e in sigcancel_handler (sig=<optimized out>, info=<optimized out>, ucp=<optimized out>) at /usr/src/lib/libthr/thread/thr_sig.c:198 198 abort2("thr_in_critical %p", 1, p); (gdb) print *curthread $1 = {tid = 688152, lock = {m_owner = 0, m_flags = 0, m_ceilings = {0, 0}, m_rb_lnk = 0, m_spare = {0, 0}}, cycle = 0, locklevel = 1, critical_count = 0, sigblock = 0, fsigblock = 0, tle = {tqe_next = 0x1fc231a12000, tqe_prev = 0x82197c600 <_thread_list>}, gcle = { tqe_next = 0x0, tqe_prev = 0x0}, hle = {le_next = 0x0, le_prev = 0x82197ce68}, wle = {tqe_next = 0x0, tqe_prev = 0x0}, refcount = 1, start_routine = 0x201a70 <thread>, arg = 0x0, attr = {sched_policy = 2, sched_inherit = 4, prio = 0, suspend = 0, flags = 2, stackaddr_attr = 0x822aa6000, stacksize_attr = 2097152, guardsize_attr = 4096, cpuset = 0x0, cpusetsize = 0}, cancel_enable = 1, cancel_pending = 1, cancel_point = 0, no_cancel = 1, cancel_async = 0, cancelling = 1, sigmask = {__bits = {0, 0, 0, 0}}, unblock_sigcancel = 0, in_sigsuspend = 1, deferred_siginfo = {si_signo = 0, si_errno = 0, si_code = 0, si_pid = 0, si_uid = 0, si_status = 0, si_addr = 0x0, si_value = {sival_int = 0, sival_ptr = 0x0, sigval_int = 0, sigval_ptr = 0x0}, _reason = {_fault = { _trapno = 0}, _timer = {_timerid = 0, _overrun = 0}, _mesgq = {_mqd = 0}, _poll = {_band = 0}, _capsicum = {_syscall = 0}, __spare__ = {__spare1__ = 0, __spare2__ = {0, 0, 0, 0, 0, 0, 0}}}}, deferred_sigmask = {__bits = {0, 0, 0, 0}}, deferred_sigact = { __sigaction_u = {__sa_handler = 0x0, __sa_sigaction = 0x0}, sa_flags = 0, sa_mask = {__bits = {0, 0, 0, 0}}}, deferred_run = 0, force_exit = 0, state = PS_RUNNING, error = 0, joiner = 0x1fc231a12000, flags = 0, tlflags = 2, mq = {{tqh_first = 0x0, tqh_last = 0x1fc231a128a8}, {tqh_first = 0x0, tqh_last = 0x1fc231a128b8}, {tqh_first = 0x0, tqh_last = 0x1fc231a128c8}, {tqh_first = 0x0, tqh_last = 0x1fc231a128d8}, {tqh_first = 0x0, tqh_last = 0x1fc231a128e8}, {tqh_first = 0x0, tqh_last = 0x1fc231a128f8}}, ret = 0x1, specific = 0x0, specific_data_count = 0, rdlock_count = 0, rtld_bits = 0, tcb = 0x1fc232003120, cleanup = 0x0, ex = {exception_class = 0, exception_cleanup = 0x0, private_1 = 0, private_2 = 0}, unwind_stackend = 0x822ca6000, unwind_disabled = 0, magic = 3499860245, report_events = 0, event_mask = 0, event_buf = {event = TD_EVENT_NONE, th_p = 0, data = 0}, wchan = 0x0, mutex_obj = 0x0, will_sleep = 0, nwaiter_defer = 0, robust_inited = 0, robust_list = 0, priv_robust_list = 0, inact_mtx = 0, defer_waiters = { 0x0 <repeats 50 times>}, wake_addr = 0x1fc232000000, sleepqueue = 0x1fc231a19040, name = 0x0, dlerror_msg = "Undefined symbol \"_Unwind_ForcedUnwind\"", '\000' <repeats 472 times>, dlerror_seen = 0} -- You are receiving this mail because: You are the assignee for the bug.