Hello community, here is the log from the commit of package libevent for openSUSE:Factory checked in at 2019-10-23 15:48:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libevent (Old) and /work/SRC/openSUSE:Factory/.libevent.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libevent" Wed Oct 23 15:48:52 2019 rev:39 rq:741477 version:2.1.11 Changes: -------- --- /work/SRC/openSUSE:Factory/libevent/libevent.changes 2019-09-05 12:31:51.863602155 +0200 +++ /work/SRC/openSUSE:Factory/.libevent.new.2352/libevent.changes 2019-10-23 15:48:56.354570658 +0200 @@ -1,0 +2,8 @@ +Tue Sep 24 12:03:16 UTC 2019 - MichaĆ Rostecki <[email protected]> + +- Add upstream patches with the feature of "prepare" and "check" + watchers. That feature is needed by envoy-proxy: + * 0001-evwatch-Add-prepare-and-check-watchers.patch + * 0002-evwatch-fix-race-condition.patch + +------------------------------------------------------------------- New: ---- 0001-evwatch-Add-prepare-and-check-watchers.patch 0002-evwatch-fix-race-condition.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libevent.spec ++++++ --- /var/tmp/diff_new_pack.F4GSoV/_old 2019-10-23 15:48:57.370571756 +0200 +++ /var/tmp/diff_new_pack.F4GSoV/_new 2019-10-23 15:48:57.370571756 +0200 @@ -36,6 +36,10 @@ Source3: libevent-rpmlintrc Source99: baselibs.conf Patch0: python3-shebang.patch +# PATCH-FEATURE-UPSTREAM 0001-evwatch-Add-prepare-and-check-watchers.patch +Patch1: 0001-evwatch-Add-prepare-and-check-watchers.patch +# PATCH-FEATURE-UPSTREAM 0002-evwatch-fix-race-condition.patch +Patch2: 0002-evwatch-fix-race-condition.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool @@ -114,6 +118,8 @@ %prep %setup -q -n %{name}-%{version}-%{version_suffix} %patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build %global _lto_cflags %{_lto_cflags} -ffat-lto-objects ++++++ 0001-evwatch-Add-prepare-and-check-watchers.patch ++++++ ++++ 1150 lines (skipped) ++++++ 0002-evwatch-fix-race-condition.patch ++++++ >From 1eefbe38f6a7266e1489765317f4e89489856fc1 Mon Sep 17 00:00:00 2001 From: Dan Rosen <[email protected]> Date: Wed, 17 Apr 2019 15:44:59 -0400 Subject: [PATCH 2/2] evwatch: fix race condition There was a race between event_base_loop and evwatch_new (adding a prepare/check watcher while iterating over the watcher list). Only release the mutex immediately before invoking each watcher callback, and reacquire it immediately afterwards (same as is done for normal event handlers). --- event.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/event.c b/event.c index 5e41ae04..c6eb175c 100644 --- a/event.c +++ b/event.c @@ -2012,11 +2012,12 @@ event_base_loop(struct event_base *base, int flags) event_queue_make_later_events_active(base); /* Invoke prepare watchers before polling for events */ - EVBASE_RELEASE_LOCK(base, th_base_lock); prepare_info.timeout = tv_p; - TAILQ_FOREACH(watcher, &base->watchers[EVWATCH_PREPARE], next) + TAILQ_FOREACH(watcher, &base->watchers[EVWATCH_PREPARE], next) { + EVBASE_RELEASE_LOCK(base, th_base_lock); (*watcher->callback.prepare)(watcher, &prepare_info, watcher->arg); - EVBASE_ACQUIRE_LOCK(base, th_base_lock); + EVBASE_ACQUIRE_LOCK(base, th_base_lock); + } clear_time_cache(base); @@ -2033,10 +2034,11 @@ event_base_loop(struct event_base *base, int flags) /* Invoke check watchers after polling for events, and before * processing them */ - EVBASE_RELEASE_LOCK(base, th_base_lock); - TAILQ_FOREACH(watcher, &base->watchers[EVWATCH_CHECK], next) + TAILQ_FOREACH(watcher, &base->watchers[EVWATCH_CHECK], next) { + EVBASE_RELEASE_LOCK(base, th_base_lock); (*watcher->callback.check)(watcher, &check_info, watcher->arg); - EVBASE_ACQUIRE_LOCK(base, th_base_lock); + EVBASE_ACQUIRE_LOCK(base, th_base_lock); + } timeout_process(base); -- 2.23.0
