Re: macOS libsystem_pthread POSIX thread cancellation bug

46 views
Skip to first unread message

Justin C. Walker

unread,
Oct 17, 2026, 11:21:49 PM (9 days ago) Oct 17
to Dima Pasechnik, SAGE Development
Hi, Dima,

For one reason or another, most of my Apple contacts have retired :-}.

I will see if I can dredge up someone to give me an idea of what’s going on with this.

I will let you know when I get a response.  The failure to get a response may get into the Turing Halting Problem…

Justin

On Oct 17, 2026, at 20:05 , Dima Pasechnik <dim...@gmail.com> wrote:

Hi Justin,

do you (or anyone here) by any chance know if there any way to get Apple devs to pay attention to
the report I submitted few days ago:
(marked as FB25195692) 

It's essentially a reproduction of something Pari/GP devs found last year, 
and it goes back a few versions of macOS, reproducible on Intel and arm64.

It might be one of the reasons our testing on macOS is flakier than on Linux...

Probably a race in the kernel (statistically, about 0.1%-0.5% of threads in the testing can't get canceled, and persist no matter what; same code runs fine on Linux, where everything is fine).

Python script and C code attached.

Running it on macOS looks like this (which run times out is a lottery, but well, 10000 runs is
always enough):

 % ./reproduce.py # it does the compilation, too
1000 runs completed
Run 1338 timed out; sampling PID 12201
{
  "started": "2026-10-17T21:56:34.320583-05:00",
  "build_command": [
    "cc",
    "-O2",
    "-g",
    "-Wall",
    "-Wextra",
    "-pthread",
    "/private/tmp/bill-pthread-checked.c",
    "-o",
    "/private/tmp/results/bill-pthread-checked"
  ],
  "requested_iterations": 10000,
  "timeout_seconds": 5,
  "confirmation_seconds": 10,
  "completed": 1337,
  "outcome": "persistent-hang",
  "iteration": 1338,
  "pid": 12201,
  "observed_at": "2026-10-17T21:56:42.629657-05:00",
  "initial_sample_status": 0,
  "confirmation_sample_status": 0,
  "returncode": -9,
  "stdout": "",
  "stderr": "",
  "elapsed_seconds": 20.53075637499569
}

whereas on Linux no runs are timed out.

Best
Dima

<reproduce.py><bill-pthread-checked.c>

--
Justin C. Walker
Curmudgeon-at-large
--
Network, n., Difference between work
charged for and work done



Dima Pasechnik

unread,
Oct 22, 2026, 12:23:32 AM (5 days ago) Oct 22
to Justin C. Walker, sage-devel
reproduce.py
bill-pthread-checked.c
Reply all
Reply to author
Forward
0 new messages