Bug 747

Summary: log_assert in outnet_serviced_query_stop
Product: unbound Reporter: Charles Walker <chwalker>
Component: serverAssignee: unbound team <unbound-team>
Status: RESOLVED FIXED    
Severity: major CC: cathya, wouter
Priority: P5    
Version: 1.5.6   
Hardware: x86_64   
OS: Linux   

Description Charles Walker 2016-03-04 20:09:48 CET
Running some load tests against unbound, we are sporadically seeing an issue in which outnet_serviced_query_stop is trying to remove a serviced_query from the rb tree, and asserting because the serviced_query was not found in the rb tree.  It calls log_assert to verify that the element was removed from the rb tree and since it was not in the rb tree, the process exits.

We thought that it might have been triggered by setting so_reuseport to yes because we were seeing with so_reuseport set to yes, but we have subsequently seen it without so_reuseport set to yes.

The snippet of code where this is happening is shown below.  

void outnet_serviced_query_stop(struct serviced_query* sq, void* cb_arg)
{
        if(!sq)
                return;
        callback_list_remove(sq, cb_arg);
        /* if callbacks() routine scheduled deletion, let it do that */
        if(!sq->cblist && !sq->to_be_deleted) {
#ifdef UNBOUND_DEBUG
                rbnode_t* rem =
#else
                (void)
#endif
                rbtree_delete(sq->outnet->serviced, sq);
                log_assert(rem); /* should be present */
                serviced_delete(sq);
        }
}

Thanks,
Charles Walker
Comment 1 Wouter Wijngaards 2016-03-07 11:01:56 CET
Hi Charles,

Thank you for the report.

I have removed the assert, because, it should be harmless to continue.  And downtime is not good.

If you have more details, eg. queries that are in progress or exceptional matters at the time, that would be very useful.

Best regards, Wouter