Package: tcl8.6
Version: 8.6.18+dfsg-2
Severity: normal
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: hppa

Dear Maintainer,

Package: tcl8.6
Version: 8.6.18+dfsg-1
Severity: important
User: [email protected]
Usertags: hppa
X-Debbugs-Cc: [email protected]

Subject: tcl8.6: threaded notifier futex deadlock / missed PTY EOF wakeups in 
expect on hppa (causes multi-day GCC buildd delays)

Dear Maintainer,

When running the GCC DejaGnu testsuite on PA-RISC (hppa), expect
(tcl-expect 5.45.4-10) intermittently hangs for the full 300-second
DejaGnu timeout even after the spawned child process has already exited and
become <defunct>. Once triggered, every subsequent test in that shard cascades
into a persistent 300-second timeout.

Impact on Debian hppa builds:
Because GCC and gcc-snapshot run tens of thousands of DejaGnu tests during
package builds, a single cascading expect hang turns a normal testsuite phase
into days of idle wall-clock waiting on hppa buildds. For example, the official
gcc-snapshot 1:20260902-1 build on paladin took nearly 9 days to complete
(started Fri, 11 Sep 2026 23:03:04 +0000; finished 2026-09-20 17:55:29):
https://buildd.debian.org/status/fetch.php?pkg=gcc-snapshot&arch=hppa&ver=1%3A20260902-1&stamp=1789926929&raw=0

Root cause and strace diagnostics:
On native PA-RISC hardware (HP rp3440), this hang is reliably triggered by
GCC testsuite suites involving Python or heavy subprocess/PTY activity (such as
plugins.exp, modules.exp, and libstdc++'s xmethods.exp), after which even
simple compilation and execution tests hang.

Attaching strace to a wedged expect process shows the main thread blocked in
Tcl's threaded notifier futex while the spawned child process has already
terminated:

  strace: Process 26912 attached
  restart_syscall(<... resuming interrupted futex ...>

Only when the 300-second expect timeout finally expires does the notifier
trigger pipe wake the futex:

  write(6, "\0", 1)                       = 1
  futex(0xf853ae90, FUTEX_WAKE_PRIVATE, 1) = 1
  clock_gettime64(CLOCK_REALTIME, {tv_sec=1794666174, tv_nsec=877701364}) = 0
  clock_gettime64(CLOCK_REALTIME, {tv_sec=1794666174, tv_nsec=878192432}) = 0
  write(4, "WARNING: program timed out.\n", 28) = 28

Process table inspection during the hang shows the spawned test executable and
helper processes already exited as <defunct> children of expect. The child
did not hang—Tcl's background notifier thread (enabled via --enable-threads
in debian/rules) missed or lost the PTY EOF / POLLHUP wakeup on hppa, leaving
the main thread asleep in pthread_cond_wait / futex until the timeout alarm
fired.

Verified fix:
Rebuilding tcl8.6 (8.6.18+dfsg-1) with --disable-threads in debian/rules
disables the background notifier thread and switches Tcl back to a single-
threaded select() event loop. With ::tcl_platform(threaded) disabled, full
gcc, g++, and libstdc++ testsuite runs (including plugins.exp, modules.exp,
and xmethods.exp) complete normally on native hppa hardware with zero futex
deadlocks and zero cascading timeouts.

System information:
- Architecture: hppa (HP rp3440, native hardware)
- Packages: tcl8.6 8.6.18+dfsg-1, tcl-expect 5.45.4-10, dejagnu

Please consider either investigating the threaded notifier futex wakeup bug
on hppa or passing --disable-threads on hppa in debian/rules (especially as
upstream Tcl 8.6 is now end-of-life).

Regards,
Dave Anglin

-- System Information:
Debian Release: forky/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: hppa (parisc64)

Kernel: Linux 6.18.58-dirty (SMP w/4 CPU threads)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages tcl8.6 depends on:
ii  libc6      2.43-7
hi  libtcl8.6  8.6.18+dfsg-2

tcl8.6 recommends no packages.

Versions of packages tcl8.6 suggests:
pn  tcl-tclreadline  <none>

-- no debconf information

Reply via email to