From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Matthias Schneider <ma30002000@yahoo.de>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] occasional EBADF in select() in notifier.c
Date: Mon, 21 Apr 2014 23:32:22 +0200 [thread overview]
Message-ID: <53558E66.8090102@xenomai.org> (raw)
In-Reply-To: <1398115447.70510.YahooMailNeo@web171605.mail.ir2.yahoo.com>
On 04/21/2014 11:24 PM, Matthias Schneider wrote:
> Still working on thread suspension in forge/mercury, I occasionally get a EBADF
> of the select() call in notifier.c. I suspect that this is due to accessing a
> copy of the file descriptor list notifier_rset while one of the file descriptors
> is being closed. This seems to be due to concurrent access on the notifier_rset
> from notifier_sighandler() and notifier_destroy(). "notifier_lock" is held in
> notifier_lock(), but not when copying and invoking select in notifier_sighandler().
> The EBADF leads to a "spurious notification" reporting and process termination -
> obviously, the thread suspension was not triggered.
>
> I can think of several ways of addressing this issue but I am not sure about
> side effects:
> a) hold the "notifier_lock" mutex between copying the descriptor list and calling select
> b) repeating the select() call in the case of EBADF
>
> Any ideas?
>
> Anyway, why is the select call necessary, isnt the file descriptor signaled via
> siginfo->si_fd, too?
I do not know this part of the code, but normally, when select is called
for a closed descriptor, select will return with the descriptor
readable, EOF is returned when reading the descriptor, which can then be
closed. We had a bug report some time ago to implement this behaviour in
xenomai posix skin (so for cobalt).
--
Gilles.
next prev parent reply other threads:[~2014-04-21 21:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 21:24 [Xenomai] occasional EBADF in select() in notifier.c Matthias Schneider
2014-04-21 21:32 ` Gilles Chanteperdrix [this message]
2014-04-21 21:53 ` Gilles Chanteperdrix
2014-04-22 7:32 ` Philippe Gerum
2014-04-22 10:49 ` Matthias Schneider
2014-04-22 13:02 ` Philippe Gerum
2014-04-22 18:00 ` Matthias Schneider
2014-04-23 13:45 ` Philippe Gerum
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=53558E66.8090102@xenomai.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=ma30002000@yahoo.de \
--cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.