Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2024 17:52:40 +0000
From:      bugzilla-noreply@freebsd.org
To:        threads@FreeBSD.org
Subject:   [Bug 283101] pthread_cancel() doesn't cancel a thread that's currently in pause()
Message-ID:  <bug-283101-13406-DX06NpYu7o@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-283101-13406@https.bugs.freebsd.org/bugzilla/>
References:  <bug-283101-13406@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283101

--- Comment #17 from Konstantin Belousov <kib@FreeBSD.org> ---
(In reply to vedad from comment #16)
We seems to getting close, but still not quite.  The victim thread was
caught by SIGCANCEL inside the critical section.  Then, returning from
the section should have caused cancellation to trigger.  Since it does
not, and I verified manually all places where we leave critical counters,
lets try with more debugging to see what happens.

Please provide me with both the backtrace and the p *curthread on the
victim thread.

diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c
index b953c430158c..9f7fcbe33566 100644
--- a/lib/libthr/thread/thr_sig.c
+++ b/lib/libthr/thread/thr_sig.c
@@ -191,8 +191,13 @@ sigcancel_handler(int sig __unused,
        struct pthread *curthread = _get_curthread();
        int err;

-       if (THR_IN_CRITICAL(curthread))
+       if (THR_IN_CRITICAL(curthread)) {
+               void *p[1];
+
+               p[0] = curthread;
+               abort2("thr_in_critical %p", 1, p);
                return;
+       }
        err = errno;
        check_suspend(curthread);
        check_cancel(curthread, ucp);

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

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-283101-13406-DX06NpYu7o>