[Bug 283101] pthread_cancel() doesn't cancel a thread that's currently in pause()

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 22 Dec 2024 00:04:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283101

--- Comment #20 from vedad@kajtaz.net ---
(In reply to Konstantin Belousov from comment #19)

(gdb) thread apply all bt full

Thread 2 (LWP 100391):
#0  _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:38
No locals.
#1  0x00000008215fdd4b in _thr_umtx_wait (mtx=0xd7be813c00, id=707144,
timeout=0x0) at /usr/src/lib/libthr/thread/thr_umtx.c:198
No locals.
#2  0x00000008215f2a7e in join_common (pthread=0xd7be813c00,
thread_return=0x820da5ca0, abstime=0x0, peek=<optimized out>) at
/usr/src/lib/libthr/thread/thr_join.c:144
        __cup = {prev = 0x0, routine = 0x8215f2bf0 <backout_join>, routine_arg
= 0xd7be813c00, onheap = 0}
        ts = {tv_sec = 34910919760, tv_nsec = 34919627244}
        ts2 = {tv_sec = 0, tv_nsec = 926614102016}
        curthread = 0xd7be812000
        ret = <optimized out>
        tid = 707144
        tsp = 0xaca48
        tmp = <optimized out>
#3  0x0000000000201aee in thread_cancel_and_join (ptid=0xd7be813c00) at
pthread.c:28
        status = 0x0
        error = 0
#4  0x0000000000201a2c in main (argc=1, argv=0x820da5d78) at pthread.c:73
        ptid = 0xd7be813c00
        err = 0
        iteration = 499
        pid = 31870

Thread 1 (LWP 707144):
#0  abort2 () at abort2.S:4
No locals.
#1  0x00000008215f9b0d in sigcancel_handler (sig=<optimized out>,
info=<optimized out>, ucp=<optimized out>) at
/usr/src/lib/libthr/thread/thr_sig.c:199
        p = {0xd7be813c00}
        curthread = 0xd7be813c00
        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  0x00000008215fda30 in __thr_umutex_lock (mtx=0xd7be813c08, id=707144) at
/usr/src/lib/libthr/thread/thr_umtx.c:79
        owner = <optimized out>
#5  0x00000008215f0aa4 in _thr_umutex_lock (mtx=0xd7be813c08, id=17) at
/usr/src/lib/libthr/thread/thr_umtx.h:123
No locals.
#6  thread_start (curthread=0xd7be813c00) at
/usr/src/lib/libthr/thread/thr_create.c:264
        set = {__bits = {0, 0, 617922520, 8}}
#7  0x0000000000000000 in ?? ()
No symbol table info available.
Backtrace stopped: Cannot access memory at address 0x82452e000
(gdb) frame 1
#1  0x00000008215f9b0d in sigcancel_handler (sig=<optimized out>,
info=<optimized out>, ucp=<optimized out>) at
/usr/src/lib/libthr/thread/thr_sig.c:199
199                             abort2("thr_in_critical %p", 1, p);
(gdb) print *curthread
$1 = {tid = 707144, 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 = 0xd7be812000, tqe_prev =
0x821601600 <_thread_list>}, gcle = {
    tqe_next = 0x0, tqe_prev = 0x0}, hle = {le_next = 0x0, le_prev =
0x821601f10}, 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 = 0x82432e000, stacksize_attr = 2097152, guardsize_attr =
4096, cpuset = 0x0, cpusetsize = 0}, cancel_enable = 1, cancel_pending = 1,
cancel_point = 0, no_cancel = 0, cancel_async = 0, cancelling = 0, sigmask =
{__bits = {0, 0, 0, 0}},
  unblock_sigcancel = 0, in_sigsuspend = 0, 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 = 0xd7be812000, flags = 0, tlflags = 2, mq =
{{tqh_first = 0x0,
      tqh_last = 0xd7be813da8}, {tqh_first = 0x0, tqh_last = 0xd7be813db8},
{tqh_first = 0x0, tqh_last = 0xd7be813dc8}, {tqh_first = 0x0, tqh_last =
0xd7be813dd8}, {tqh_first = 0x0, tqh_last = 0xd7be813de8}, {tqh_first = 0x0,
tqh_last = 0xd7be813df8}}, ret = 0x0,
  specific = 0x0, specific_data_count = 0, rdlock_count = 0, rtld_bits = 0, tcb
= 0xd7bee07120, cleanup = 0x0, ex = {exception_class = 0, exception_cleanup =
0x0, private_1 = 0, private_2 = 0}, unwind_stackend = 0x0, 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 = 0xd7bee00048, sleepqueue =
0xd7be819100, name = 0x0, dlerror_msg = '\000' <repeats 511 times>,
dlerror_seen = 0}

-- 
You are receiving this mail because:
You are the assignee for the bug.