public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/30558] SIGEV_THREAD is badly implemented
Date: Mon, 19 Jun 2023 20:14:00 +0000	[thread overview]
Message-ID: <bug-30558-131-Lpc56NUJ1v@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30558-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30558

--- Comment #11 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Stas Sergeev from comment #10)
> > I don't see any reentrancy issue with the current approach
> 
> But there is.
> Its trivial to verify with your
> own test-case posted here. You just
> need to insert sleeps into the handler.
> 
> Which is why I made the above quote
> from posix. It says explicitly that
> a detached thread is created in response
> to every timer expiration.
> So it explicitly allows reentrancy and
> deliberately breaks timer_getoverrun(),
> and glibc was following that very precisely.

Ah right, indeed current approach will trigger the callback function with
provided arguments on each timer expiration while the new scheme will only
issue the callback once the previous timer callback returns.  Afaiu, POSIX does
not specify an semantic regarding it; it only specify that you need an overrun
facility that you can query. And since it is the kernel that keep track of the
overrun, the reentrancy issue is not really related on the overrun itself, but
rather on the sigval argument.

My understanding from the quote you borght is not that it is specified that
concurrent threads are allowed or not, but rather that if the application
allocates some memory to use as the thread stack it can not be reliably free
since the thread is not joinable (it will eventually leak once timer_delete is
called). 

And I don't think allowing the SIGEV_THREAD thread as joinable is also a good
way forward. Besides breaking the standard, it means that timer_delete is not
the only point where you cancel the timer (worse, the kernel will continue to
trigger the timer since in this case there is no timer_delete syscall on the
timer). We can add the timer_delete on thread exit / join, but the idea of the
per-thread timerid is that is only visible for the POSIX timer threads (pthread
code does not handle it).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-06-19 20:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 19:36 [Bug libc/30558] New: " stsp at users dot sourceforge.net
2023-06-15 21:04 ` [Bug libc/30558] " adhemerval.zanella at linaro dot org
2023-06-16  2:23 ` stsp at users dot sourceforge.net
2023-06-16  6:44 ` stsp at users dot sourceforge.net
2023-06-16  7:29 ` stsp at users dot sourceforge.net
2023-06-16  7:51 ` stsp at users dot sourceforge.net
2023-06-16 11:44 ` stsp at users dot sourceforge.net
2023-06-19 17:41 ` adhemerval.zanella at linaro dot org
2023-06-19 18:54 ` stsp at users dot sourceforge.net
2023-06-19 19:33 ` adhemerval.zanella at linaro dot org
2023-06-19 19:48 ` stsp at users dot sourceforge.net
2023-06-19 20:14 ` adhemerval.zanella at linaro dot org [this message]
2023-06-19 20:26 ` stsp at users dot sourceforge.net
2023-06-19 21:15 ` adhemerval.zanella at linaro dot org
2023-06-19 21:21 ` adhemerval.zanella at linaro dot org
2023-06-19 21:58 ` stsp at users dot sourceforge.net
2023-06-19 22:51 ` adhemerval.zanella at linaro dot org
2023-06-20  4:14 ` stsp at users dot sourceforge.net
2023-06-20 12:21 ` adhemerval.zanella at linaro dot org
2023-06-20 12:49 ` stsp at users dot sourceforge.net
2023-06-20 13:01 ` adhemerval.zanella at linaro dot org
2023-06-20 13:13 ` stsp at users dot sourceforge.net
2023-06-21  3:19 ` stsp at users dot sourceforge.net
2023-06-21 14:32 ` adhemerval.zanella at linaro dot org
2023-06-21 14:41 ` stsp at users dot sourceforge.net
2023-06-21 14:43 ` adhemerval.zanella at linaro dot org
2023-06-21 14:52 ` stsp at users dot sourceforge.net
2023-06-21 15:07 ` adhemerval.zanella at linaro dot org
2023-06-22  2:57 ` bugdal at aerifal dot cx
2023-06-22  5:23 ` stsp at users dot sourceforge.net
2023-06-23 18:34 ` adhemerval.zanella at linaro dot org
2023-06-24 17:03 ` crrodriguez at opensuse dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30558-131-Lpc56NUJ1v@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).