Comments (4)
This was also reproduced on #684 (specifically, RISC-V failing).
from mlibc.
As discussed on discord, the suspected cause is the following sequence of events:
- Thread 2 goes to sleep for a second.
- Thread 1 cancels thread 2, by first setting
tcbCancelTriggerBit
intcb->cancelBits
, then, if cancellation is enabled, sending a SIGCANCEL to the thread. - Thread 2 wakes up after
tcbCancelTriggerBit
was set, but before the signal was sent. - Thread 2 calls
sleep
again, sees that cancellation was requested, and exits via__mlibc_do_cancel
. - Thread 1 finally gets around to sending SIGCANCEL, but it's too late, as thread 2 has quit due to the cancellation request.
- Thread 1's call to
sys_tgkill
fails, andpthread_cancel
erroneously forwards the error code.
The solution would be to check for tcb->cancelBits & tcbExitingBit
if sys_tgkill
fails, and if it's set, ignoring the error.
from mlibc.
to reproduce, run yes | parallel strace -e trace=tgkill -e status=failed qemu-riscv64 tests/posix-pthread_cancel
on a ubuntu 20.04 machine. you'll need to watch out since the output will be spammed by useless exit codes since ubuntu 20.04 is too old for straces quiet option, but we've gotta match ci
Tange, O. (2022, May 22). GNU Parallel 20220522 ('NATO').
Zenodo. https://doi.org/10.5281/zenodo.6570228
from mlibc.
Also reproducible on AArch64: https://github.com/managarm/mlibc/runs/7482261270
from mlibc.
Related Issues (20)
- sysdeps: sys_futex_wake should take a number of threads to wake
- meta: add a mechanism to keep third-party code in sync
- posix: locks should spin a bit before invoking sys_futex_wait
- gcc: `__cxa_finalize` is unimplemented
- mbtowc: is broken HOT 1
- options: allow logging and debugging to be configured by environment variables
- rtdl: env vars LD_LIBRARY_PATH, LD_PRELOAD and friends are unimplemented HOT 1
- rtdl: TCB is not deallocated on thread exit
- options/posix: review locking in syslog implementation HOT 1
- pthread_condattr_* are not correctly implemented HOT 1
- mbtowc does not handle decoding errors
- x86 port HOT 5
- setxid should change credentials for all threads HOT 6
- ansi: strxfrm unimplemented HOT 1
- frigg: slab_pool corruption HOT 2
- calloc() does not check for overflow
- implement `freopen` for `mem_file`
- code formatting rules? HOT 4
- Functions with weak attribute sometimes don't get built into executables if built as a static library HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlibc.