From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 22C0E2DC28 for ; Mon, 29 Apr 2019 19:27:08 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1BAY2zPXZUeq for ; Mon, 29 Apr 2019 19:27:08 -0400 (EDT) Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 7DA492DBA4 for ; Mon, 29 Apr 2019 19:27:07 -0400 (EDT) Received: by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1hLFft-0005gm-4X for tarantool-patches@freelists.org; Tue, 30 Apr 2019 02:27:05 +0300 From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 1/1] test: drop invalid assert from swim test transport Date: Tue, 30 Apr 2019 02:27:04 +0300 Message-Id: <906fb352f231ce3c2f22a176f04d42649d180dda.1556579734.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org The assertion was checking that a next event object is not the same as the previous, but 1) the previous was deleted already to this moment; 2) comparison was done by pointer The first problem would be enough to drop it. The second is already curious - looks like after the old event was deleted, the next event was allocated right on the same memory. This is why their pointers are equal and the assertion fails. For example, swim_timer_event_process() - it deletes the event object and calls ev_invoke() which can generate a new event on the just freed memory. --- test/unit/swim_test_ev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/unit/swim_test_ev.c b/test/unit/swim_test_ev.c index 135f20107..3c2eae039 100644 --- a/test/unit/swim_test_ev.c +++ b/test/unit/swim_test_ev.c @@ -283,7 +283,7 @@ swim_ev_timer_stop(struct ev_loop *loop, struct ev_timer *base) void swim_test_ev_do_loop_step(struct ev_loop *loop) { - struct swim_event *next_e, *e = event_heap_top(&event_heap); + struct swim_event *e = event_heap_top(&event_heap); if (e != NULL) { assert(e->deadline >= watch); /* Multiple events can have the same deadline. */ @@ -291,9 +291,7 @@ swim_test_ev_do_loop_step(struct ev_loop *loop) say_verbose("Loop watch %f", watch); do { e->process(e, loop); - next_e = event_heap_top(&event_heap); - assert(e != next_e); - e = next_e; + e = event_heap_top(&event_heap); } while (e != NULL && e->deadline == watch); } } -- 2.20.1 (Apple Git-117)