and polish un/lock() context debugging.
virtual int64_t contentLen() const;
/// claim shared ownership of this entry (for use in a given context)
+ /// matching lock() and unlock() contexts eases leak triage but is optional
void lock(const char *context);
/// disclaim shared ownership; may remove entry from store and delete it
/// returns remaning lock level (zero for unlocked and possibly gone entry)
- int unlock(const char *context = "somebody");
+ int unlock(const char *context);
/// returns a local concurrent use counter, for debugging
int locks() const { return static_cast<int>(lock_count); }
debugs(38, 3, "netdbExchangeDone: " << ex->e->url() );
HTTPMSGUNLOCK(ex->r);
storeUnregister(ex->sc, ex->e, ex);
- ex->e->unlock();
+ ex->e->unlock("netdbExchangeDone");
cbdataReferenceDone(ex->p);
cbdataFree(ex);
}
sc = NULL;
}
entry->unregisterAbort();
- entry->unlock();
+ entry->unlock("Mgr::StoreToCommWriter::swanSong");
entry = NULL;
}
close();
e->flush();
e->complete();
e->timestampsSet();
- e->unlock();
+ e->unlock("MimeIcon::created");
memFree(buf, MEM_4K_BUF);
debugs(25, 3, "Loaded icon " << url_);
}
fake->abort(); // sets ENTRY_ABORTED and initiates releated cleanup
HTTPMSGUNLOCK(fake->mem_obj->request);
- fake->unlock();
+ fake->unlock("peerCountMcastPeersDone");
HTTPMSGUNLOCK(psstate->request);
cbdataFree(psstate);
}
if (old_e) {
debugs(72, 5, "peerDigestRequest: found old entry");
- old_e->lock();
+ old_e->lock("peerDigestRequest");
old_e->createMemObject(url, url, req->method);
fetch->old_sc = storeClientListAdd(old_e, fetch);
/* get rid of 304 reply */
storeUnregister(fetch->sc, fetch->entry, fetch);
- fetch->entry->unlock();
+ fetch->entry->unlock("peerDigestFetchReply 304");
fetch->entry = fetch->old_entry;
debugs(72, 3, "peerDigestFetchReply: got new digest, releasing old one");
storeUnregister(fetch->old_sc, fetch->old_entry, fetch);
fetch->old_entry->releaseRequest();
- fetch->old_entry->unlock();
+ fetch->old_entry->unlock("peerDigestFetchReply 200");
fetch->old_entry = NULL;
}
} else {
debugs(72, 3, "peerDigestFetchFinish: deleting old entry");
storeUnregister(fetch->old_sc, fetch->old_entry, fetch);
fetch->old_entry->releaseRequest();
- fetch->old_entry->unlock();
+ fetch->old_entry->unlock("peerDigestFetchFinish old");
fetch->old_entry = NULL;
}
/* unlock everything */
storeUnregister(fetch->sc, fetch->entry, fetch);
- fetch->entry->unlock();
+ fetch->entry->unlock("peerDigestFetchFinish new");
HTTPMSGUNLOCK(fetch->request);
if (entry->locked()) {
- entry->lock();
+ entry->lock("heap_purgeNext");
linklistPush(&heap_walker->locked_entries, entry);
goto try_again;
while ((entry = (StoreEntry *)linklistShift(&heap_walker->locked_entries))) {
heap_node *node = heap_insert(h->theHeap, entry);
h->setPolicyNode(entry, node);
- entry->unlock();
+ entry->unlock("heap_purgeDone");
}
safe_free(walker->_data);
setPrivateKey();
if (swap_filen > -1) {
- /*
- * Fake a call to StoreEntry->lock() When rebuilding is done,
- * we'll just call StoreEntry->unlock() on these.
- */
- lock("StoreEntry::release+rebuilding");
+ // lock the entry until rebuilding is done
+ lock("storeLateRelease");
setReleaseFlag();
LateReleaseStack.push_back(this);
} else {
" (" << std::showpos << (int) (e->expires - squid_curtime) << ")");
/* is this the write order? @?@ */
e->mem_obj->unlinkRequest();
- e->unlock();
+ e->unlock("storeDigestRewriteFinish");
sd_state.rewrite_lock = NULL;
++sd_state.rewrite_count;
eventAdd("storeDigestRewriteStart", storeDigestRewriteStart, NULL, (double)
CPPUNIT_ASSERT_EQUAL(SWAPOUT_DONE, pe->swap_status);
- pe->unlock();
+ pe->unlock("testRock::testRockSwapOut");
}
CPPUNIT_ASSERT_EQUAL((uint64_t)5, store->currentCount());
pe->swapOut();
CPPUNIT_ASSERT_EQUAL(0, pe->swap_dirn);
CPPUNIT_ASSERT_EQUAL(0, pe->swap_filen);
- pe->unlock();
+ pe->unlock("testUfs::testUfsSearch vary");
}
storeDirWriteCleanLogs(0);