Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: paulmck@linux.vnet.ibm.com (Paul E. McKenney)
Subject: [lttng-dev] [RFC] Userspace RCU library internal error handling
Date: Thu, 21 Jun 2012 09:53:34 -0700	[thread overview]
Message-ID: <20120621165334.GE2397@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120621164113.GA21197@Krystal>

On Thu, Jun 21, 2012 at 12:41:13PM -0400, Mathieu Desnoyers wrote:
> Hi,
> 
> Currently, liburcu calls "exit(-1)" upon internal consistency error.
> This is not pretty, and usually frowned upon in libraries.
> 
> One example of failure path where we use this is if pthread_mutex_lock()
> would happen to fail within synchronize_rcu(). Clearly, this should
> _never_ happen: it would typically be triggered only by memory
> corruption (or other terrible things like that). That being said, we
> clearly don't want to make "synchronize_rcu()" return errors like that
> to the application, because it would complexify the application error
> handling needlessly.
> 
> So instead of calling exit(-1), one possibility would be to do something
> like this:
> 
> #include <signal.h>
> #include <pthread.h>
> #include <stdio.h>
> 
> #define urcu_die(fmt, ...)                      \
>         do {    \
>                 fprintf(stderr, fmt, ##__VA_ARGS__);    \
>                 (void) pthread_kill(pthread_self(), SIGBUS);    \
>         } while (0)
> 
> and call urcu_die(); in those "unrecoverable error" cases, instead of
> calling exit(-1). Therefore, if an application chooses to trap those
> signals, it can, which is otherwise not possible with a direct call to
> exit().

This approach makes a lot of sense to me.

							Thanx, Paul




  reply	other threads:[~2012-06-21 16:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-21 16:41 Mathieu Desnoyers
2012-06-21 16:53 ` Paul E. McKenney [this message]
2012-06-21 18:59 ` [lttng-dev] [rp] " Josh Triplett
2012-06-21 19:03   ` Mathieu Desnoyers
2012-06-21 19:14     ` [lttng-dev] [RFC PATCH] " Mathieu Desnoyers
2012-06-21 19:28     ` [lttng-dev] [rp] [RFC] " Josh Triplett
2012-06-21 19:48       ` Mathieu Desnoyers
2012-06-21 21:21         ` Josh Triplett
2012-06-22 15:22           ` Mathieu Desnoyers
2012-06-22 19:55             ` Josh Triplett

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=20120621165334.GE2397@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    /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