Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] [RFC] Userspace RCU library internal error handling
@ 2012-06-21 16:41 Mathieu Desnoyers
  2012-06-21 16:53 ` Paul E. McKenney
  2012-06-21 18:59 ` [lttng-dev] [rp] " Josh Triplett
  0 siblings, 2 replies; 10+ messages in thread
From: Mathieu Desnoyers @ 2012-06-21 16:41 UTC (permalink / raw)


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().

Thoughts ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-06-22 19:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-21 16:41 [lttng-dev] [RFC] Userspace RCU library internal error handling Mathieu Desnoyers
2012-06-21 16:53 ` Paul E. McKenney
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox