Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#2230 closed defect (fixed)

microdescs never purged from authority cache

Reported by: arma Owned by: nickm
Priority: High Milestone: Tor: 0.2.3.1-alpha
Component: Core Tor/Tor Version: Tor: unspecified
Severity: Keywords: tor-auth
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

moria1 (a directory authority) has 248440 microdescs cached:

-rw-------  1 tord tord 33876363 2010-04-09 18:50 cached-microdescs
-rw-------  1 tord tord 52401111 2010-11-30 15:42 cached-microdescs.new

The first starts at

@last-listed 2009-12-21 01:50:01

nickm says they're supposed to get removed in microdesc_cache_clean/microdesc_cache_rebuild(), but it would seem they don't.

moria1 is currently running Tor 0.2.3.0-alpha-dev (git-19019f26b08b5222), but this has clearly been a problem longer than that.

Child Tickets

Change History (16)

comment:1 Changed 9 years ago by nickm

Owner: set to nickm
Status: newassigned

comment:2 Changed 9 years ago by cypherpunks

Nothing updates cache->journal_len while journal (cached-microdescs.new) reloaded from disk.

comment:3 Changed 9 years ago by cypherpunks

--- microdesc.c.orig	Mon Jan  3 22:25:30 2011
+++ microdesc.c	Mon Jan 10 16:28:12 2011
@@ -305,6 +305,7 @@
   journal_content = read_file_to_str(cache->journal_fname,
                                      RFTS_IGNORE_MISSING, &st);
   if (journal_content) {
+    cache->journal_len = st.st_size;
     added = microdescs_add_to_cache(cache, journal_content,
                                     journal_content+st.st_size,
                                     SAVED_IN_JOURNAL, 0, -1, NULL);

comment:4 Changed 9 years ago by cypherpunks

must be "cache->journal_len = (size_t) st.st_size;" instead.

btw, some version of tor_mmap_file() (#if not def HAVE_SYS_MMAN_H and non windows case, obviuosly non used in most case) missed explicit conversion to size_t.

comment:5 Changed 9 years ago by cypherpunks

microdesc_cache_rebuild() tries to replace cached-microdescs while it's still mapped.

comment:6 Changed 9 years ago by cypherpunks

x > y + C, x > y/2, for non empty y the last condition is redudant.

comment:7 Changed 9 years ago by cypherpunks

    if ((cache->journal_len > 16384 + old_content_len &&
         cache->journal_len > old_content_len / 2))

is wrong.

comment:8 Changed 9 years ago by nickm

Milestone: Tor: 0.2.3.x-final
Status: assignedaccepted

comment:9 Changed 8 years ago by rransom

Component: Tor RelayTor Directory Authority

comment:10 Changed 8 years ago by nickm

Milestone: Tor: 0.2.3.x-finalTor: 0.2.3.1-alpha

comment:11 Changed 8 years ago by nickm

Status: acceptedneeds_review

Merged some small fixes to the above-mentioned code, and backported the clean_cache function.

It looks like we also never looked at bytes_dropped when deciding to rebuild the cache. I made some changes related to that in a branch bug2230_part3 that should get merged onto 0.2.3.x and 0.2.2.x .

comment:12 Changed 8 years ago by nickm

Priority: normalmajor

comment:13 Changed 8 years ago by arma

-rw------- 1 tord tord 1739360 2011-05-03 18:14 cached-microdescs
-rw------- 1 tord tord   68003 2011-05-04 00:50 cached-microdescs.new

Looks good to me.

comment:14 Changed 8 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Calling it fixed then. Thanks!

comment:15 Changed 7 years ago by nickm

Keywords: tor-auth added

comment:16 Changed 7 years ago by nickm

Component: Tor Directory AuthorityTor
Note: See TracTickets for help on using tickets.