gdp_gcl_close() raises assertion failure with active subscriptions
If there are active subscription on a GCL, a call to
gdp_gcl_close() causes assertion failures (see relevant output below). The expected behavior is that if the
gcl is not being referenced elsewhere (other than subscriptions, multireads, etc), it should be freed cleanly and any active subscriptions be terminated. (source:gdp/gdp_gcl_ops.c#L522)
*** Processing ack/nak 128=ACK_SUCCESS from socket 7 gdp_pdu_proc_resp(0x7fc128000f90 ACK_SUCCESS) gcl 0x215b900 _gdp_req_dispatch >>> ACK_SUCCESS (128) [gcl->refcnt 1] ack_success: received ACK_SUCCESS for CMD_CLOSE _gdp_req_dispatch <<< ACK_SUCCESS [gcl->refcnt 1] OK [200 = 0xc8] <<< _gdp_invoke(0x215cc40 rid=0) CMD_CLOSE: OK [200 = 0xc8] Assertion failed at gdp-reader:gdp_req.c:282: mutex &req->gcl->mutex (0x215b900) is not locked (should be 836)
A quick way to reproduce this behavior is
- Apply the attached patch to
apps/gdp-reader.c, which intentionally calls
gdp_gcl_close()with an active subscription.
- Invoke something like
gdp-reader -D *=20 -s -f 0 -n 5 LOGNAME.
- Start appending data to
#1 Updated by Eric Allman about 3 years ago
- Status changed from New to Feedback
I believe this to be fixed in commit:c89b74ec, but with the network problems today I haven't been able to push the changes to the repo yet. Please check it and verify when I can push it out, probably tomorrow. Or you can apply the patch manually (below). Thanks.
------------------------------ gdp/gdp_gcl_ops.c ------------------------------ index afcd038..d195777 100644 @@ -154,12 +154,12 @@ _gdp_gcl_freehandle(gdp_gcl_t *gcl) // drop it from the name -> handle cache _gdp_gcl_cache_drop(gcl); - // should be inacessible now - _gdp_gcl_unlock(gcl); - // release any remaining requests _gdp_req_freeall(&gcl->reqs, NULL); + // should be inacessible now + _gdp_gcl_unlock(gcl); + // free any additional per-GCL resources if (gcl->freefunc != NULL) (*gcl->freefunc)(gcl);
(Hmm, I guess I forgot to correct the spelling on "inaccessible".)