mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Merge remote-tracking branch 'public/bug7164_diagnostic' into maint-0.2.4
This commit is contained in:
commit
323cb655be
4
changes/bug7164_diagnostic
Normal file
4
changes/bug7164_diagnostic
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor features (bug diagnostic):
|
||||||
|
- If we fail to free a microdescriptor because of bug #7164, log
|
||||||
|
the filename and line number from which we tried to free it.
|
||||||
|
This should help us finally fix #7164.
|
@ -550,7 +550,7 @@ microdesc_check_counts(void)
|
|||||||
/** Deallocate a single microdescriptor. Note: the microdescriptor MUST have
|
/** Deallocate a single microdescriptor. Note: the microdescriptor MUST have
|
||||||
* previously been removed from the cache if it had ever been inserted. */
|
* previously been removed from the cache if it had ever been inserted. */
|
||||||
void
|
void
|
||||||
microdesc_free(microdesc_t *md)
|
microdesc_free_(microdesc_t *md, const char *fname, int lineno)
|
||||||
{
|
{
|
||||||
if (!md)
|
if (!md)
|
||||||
return;
|
return;
|
||||||
@ -561,12 +561,12 @@ microdesc_free(microdesc_t *md)
|
|||||||
microdesc_cache_t *cache = get_microdesc_cache();
|
microdesc_cache_t *cache = get_microdesc_cache();
|
||||||
microdesc_t *md2 = HT_FIND(microdesc_map, &cache->map, md);
|
microdesc_t *md2 = HT_FIND(microdesc_map, &cache->map, md);
|
||||||
if (md2 == md) {
|
if (md2 == md) {
|
||||||
log_warn(LD_BUG, "microdesc_free() called, but md was still in "
|
log_warn(LD_BUG, "microdesc_free() called from %s:%d, but md was still "
|
||||||
"microdesc_map");
|
"in microdesc_map", fname, lineno);
|
||||||
HT_REMOVE(microdesc_map, &cache->map, md);
|
HT_REMOVE(microdesc_map, &cache->map, md);
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_BUG, "microdesc_free() called with held_in_map set, but "
|
log_warn(LD_BUG, "microdesc_free() called from %s:%d with held_in_map "
|
||||||
"microdesc was not in the map.");
|
"set, but microdesc was not in the map.", fname, lineno);
|
||||||
}
|
}
|
||||||
tor_fragile_assert();
|
tor_fragile_assert();
|
||||||
}
|
}
|
||||||
@ -580,11 +580,13 @@ microdesc_free(microdesc_t *md)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (found) {
|
if (found) {
|
||||||
log_warn(LD_BUG, "microdesc_free() called, but md was still referenced "
|
log_warn(LD_BUG, "microdesc_free() called from %s:%d, but md was still "
|
||||||
"%d node(s); held_by_nodes == %u", found, md->held_by_nodes);
|
"referenced %d node(s); held_by_nodes == %u",
|
||||||
|
fname, lineno, found, md->held_by_nodes);
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_BUG, "microdesc_free() called with held_by_nodes set to %u, "
|
log_warn(LD_BUG, "microdesc_free() called from %s:%d with held_by_nodes "
|
||||||
"but md was not referenced by any nodes", md->held_by_nodes);
|
"set to %u, but md was not referenced by any nodes",
|
||||||
|
fname, lineno, md->held_by_nodes);
|
||||||
}
|
}
|
||||||
tor_fragile_assert();
|
tor_fragile_assert();
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,9 @@ smartlist_t *microdesc_list_missing_digest256(networkstatus_t *ns,
|
|||||||
int downloadable_only,
|
int downloadable_only,
|
||||||
digestmap_t *skip);
|
digestmap_t *skip);
|
||||||
|
|
||||||
void microdesc_free(microdesc_t *md);
|
void microdesc_free_(microdesc_t *md, const char *fname, int line);
|
||||||
|
#define microdesc_free(md) \
|
||||||
|
microdesc_free_((md), __FILE__, __LINE__)
|
||||||
void microdesc_free_all(void);
|
void microdesc_free_all(void);
|
||||||
|
|
||||||
void update_microdesc_downloads(time_t now);
|
void update_microdesc_downloads(time_t now);
|
||||||
|
Loading…
Reference in New Issue
Block a user