summaryrefslogtreecommitdiff
path: root/src/libelogind/sd-event
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2017-02-08 20:56:22 +0100
committerSven Eden <yamakuzure@gmx.net>2017-07-17 17:58:36 +0200
commit093a10d73a66352cb8c03f38659e214638dba6b5 (patch)
tree8c892979175292e283556fc64081f5eeb11cdd16 /src/libelogind/sd-event
parent306d96a538d1c007e1f5a700ec7555ef76372306 (diff)
sd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)
The code make the following assertion: when freeing a event loop object (usually it's done after exiting from the main event loop), no signal events are still queued and are pending. This assertion can be found in event_unmask_signal_data() with "assert(!d->current);" assertion. It appears that this assertion can be wrong at least in a specific case described below. Consider the following example which is inspired from udev: a process defines 3 source events: 2 are created by sd_event_add_signal() and 1 is created by sd_event_add_post(). 1. the process receives the 2 signals consecutively so that signal 'A' source event is queued and pending. Consequently the post source event is also queued and pending. This is done by sd_event_wait(). 2. The callback for signal 'A' is called by sd_event_dispatch(). 3. The next call to sd_event_wait() will queue signal 'B' source event. 4. The callback for the post source event is called and calls sd_event_exit(). 5. the event loop is exited. 6. freeing the event loop object will lead to the assertion failure in event_unmask_signal_data(). This patch simply removes this assertion as it doesn't seem to be a bug if the signal data still reference a signal source at this point.
Diffstat (limited to 'src/libelogind/sd-event')
-rw-r--r--src/libelogind/sd-event/sd-event.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/libelogind/sd-event/sd-event.c b/src/libelogind/sd-event/sd-event.c
index 1cdb3d139..019d411c4 100644
--- a/src/libelogind/sd-event/sd-event.c
+++ b/src/libelogind/sd-event/sd-event.c
@@ -732,7 +732,6 @@ static void event_unmask_signal_data(sd_event *e, struct signal_data *d, int sig
/* If all the mask is all-zero we can get rid of the structure */
hashmap_remove(e->signal_data, &d->priority);
- assert(!d->current);
safe_close(d->fd);
free(d);
return;