Erik Fears
2014-08-09 01:53:18 UTC
Hello,
I've run into an issue in my codebase where it appears evdns is calling
a callback on a request that I've canceled.
This is an issue for me, because once I call evdns_cancel_request, I've
also freed my own context associated with the request (i.e. the
void* passed back by libevent to the callback).
If the result was always DNS_ERR_CANCEL on a cancelled request,
this wouldn't be a problem, because I could abort. It seems that in some
cases the result could be DNS_ERR_NONE if the callback was
already pending
I believe this code may be to blame?
void
evdns_cancel_request(struct evdns_base *base, struct evdns_request *handle)
{
...
EVDNS_LOCK(base);
if (handle->pending_cb) {
EVDNS_UNLOCK(base);
return;
}
...
}
Is this expected?
Thanks!
Erik
I've run into an issue in my codebase where it appears evdns is calling
a callback on a request that I've canceled.
This is an issue for me, because once I call evdns_cancel_request, I've
also freed my own context associated with the request (i.e. the
void* passed back by libevent to the callback).
If the result was always DNS_ERR_CANCEL on a cancelled request,
this wouldn't be a problem, because I could abort. It seems that in some
cases the result could be DNS_ERR_NONE if the callback was
already pending
I believe this code may be to blame?
void
evdns_cancel_request(struct evdns_base *base, struct evdns_request *handle)
{
...
EVDNS_LOCK(base);
if (handle->pending_cb) {
EVDNS_UNLOCK(base);
return;
}
...
}
Is this expected?
Thanks!
Erik