Opened 9 years ago

Closed 2 years ago

#1523 closed defect (worksforme)

[Error] We couldn't read a descriptor that is supposedly mmaped in our cache

Reported by: gigs440 Owned by:
Priority: Low Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-client
Cc: shondoit@… Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Log of the crash:

Jun 06 13:36:08.654 [Notice] Bootstrapped 56%: Loading relay descriptors.
Jun 06 13:36:08.656 [Notice] I learned some more directory information, but not enough to build a circuit: We have only 96/1699 usable descriptors.
Jun 06 13:36:08.954 [Notice] Bootstrapped 63%: Loading relay descriptors.
Jun 06 13:36:08.955 [Notice] I learned some more directory information, but not enough to build a circuit: We have only 192/1699 usable descriptors.
Jun 06 13:36:09.355 [Notice] Bootstrapped 69%: Loading relay descriptors.
Jun 06 13:36:09.356 [Notice] I learned some more directory information, but not enough to build a circuit: We have only 288/1699 usable descriptors.
Jun 06 13:36:09.469 [Warning] Error replacing old router store: File exists
Jun 06 13:36:09.470 [Notice] Bootstrapped 76%: Loading relay descriptors.
Jun 06 13:36:09.473 [Notice] I learned some more directory information, but not enough to build a circuit: We have only 384/1699 usable descriptors.
Jun 06 13:36:09.473 [Error] We couldn't read a descriptor that is supposedly mmaped in our cache. Is another process running in our data directory? Exiting.

Child Tickets

Change History (21)

comment:1 Changed 9 years ago by gigs440

windows 7 x64
using the portable browser bundle, which was working fine yesterday. anyone got any ideas whats causing this?

comment:2 Changed 9 years ago by nickm

Component: Tor bundles/installationTor Client
Milestone: Tor: 0.2.2.x-final

comment:3 Changed 9 years ago by arma

doorss points out:

http://www.mail-archive.com/or-talk@freehaven.net/msg11924.html

His/its current theory is that some other application, e.g. antivirus, is touching these files as we're writing them, and Tor isn't handling it well. See also the various trac entries we have with errors about the state file on Windows.

comment:4 Changed 9 years ago by arma

Is the original bug reporter still around? What version of Tor was this?

comment:5 Changed 9 years ago by cypherpunks

Some ideas for handle errors while store rebuild:

--- routerlist.c.origin	Mon Jan  3 22:25:30 2011
+++ routerlist.c	Sat Jan  8 09:11:06 2011
@@ -729,6 +729,9 @@
         ++nocache;
         continue;
       }
+      /* We going to move stuff, assume it nowhere saved
+       * until reconstruction stage.*/ 
+      sd->saved_location = SAVED_NOWHERE;
       c = tor_malloc(sizeof(sized_chunk_t));
       c->bytes = body;
       c->len = sd->signed_descriptor_len + sd->annotations_len;
@@ -768,6 +771,9 @@
     } else {
       log_warn(LD_FS, "Unable to mmap new descriptor file at '%s'.",fname);
     }
+    /* Don't try to reconstruct pointers if broken store */
+    if (total_expected_len) 
+      goto done;
   }
 
   log_info(LD_DIR, "Reconstructing pointers into cache");

comment:6 Changed 9 years ago by cypherpunks

It's incomplete. sd->signed_descriptor_body must be restored for mmaped stuff, need to extra mem...

comment:7 Changed 9 years ago by cypherpunks

Another idea for failed replace_file() calls:

--- routerlist.c.origin	Mon Jan  3 22:25:30 2011
+++ routerlist.c	Sat Jan  8 10:49:06 2011
@@ -747,9 +747,24 @@
     store->mmap = NULL;
   }
 
+  /* Ugly idea */
+  if (unlink(fname)) {
+    log_warn(LD_FS, "Error deleting old router store: %s." , strerror(errno));
+    goto done;
+  }
+
   if (replace_file(fname_tmp, fname)<0) {
-    log_warn(LD_FS, "Error replacing old router store: %s", strerror(errno));
-    goto done;
+    char *err_replace = tor_strdup(strerror(errno));
+    if (file_status(fname) == FN_FILE) {
+      log_info(LD_FS, "Error replacing old router store: %s. "
+                      "But seems like %s is valid",
+                       strerror(errno), fname);
+      tor_free(err_replace);
+    } else {
+      log_warn(LD_FS, "Error replacing old router store: %s." , err_replace);
+      tor_free(err_replace);
+      goto done;
+    }
   }
 
   errno = 0;

comment:8 Changed 9 years ago by cypherpunks

No, no and no. Such idea wrongly wrong.

We probably still have a correcty writen fname_tmp if replacing failed and can't using it, something wrong with such mess (do not count OS windows).

comment:9 Changed 8 years ago by nickm

See also #2077.

comment:10 Changed 8 years ago by Shondoit

Cc: shondoit@… added

comment:11 Changed 8 years ago by nickm

Milestone: Tor: 0.2.2.x-finalTor: 0.2.3.x-final

comment:12 Changed 7 years ago by arma

Summary: descriptor error[Error] We couldn't read a descriptor that is supposedly mmaped in our cache

comment:13 Changed 7 years ago by nickm

Status: newneeds_revision

comment:14 Changed 7 years ago by nickm

Keywords: tor-client added

comment:15 Changed 7 years ago by nickm

Component: Tor ClientTor

comment:16 Changed 6 years ago by nickm

Milestone: Tor: 0.2.3.x-finalTor: 0.2.4.x-final

comment:17 Changed 6 years ago by nickm

Closed #7264 and #3186 as duplicates of this.

comment:18 Changed 6 years ago by nickm

Milestone: Tor: 0.2.4.x-finalTor: 0.2.5.x-final

comment:19 Changed 5 years ago by nickm

Milestone: Tor: 0.2.5.x-finalTor: 0.2.6.x-final

Moving nearly all needs_revision tickets into 0.2.6, as now untimely for 0.2.5.

comment:20 Changed 5 years ago by nickm

Milestone: Tor: 0.2.6.x-finalTor: unspecified
Status: needs_revisionneeds_information

I think this one is long-gone. Anybody still encountering it?

comment:21 Changed 2 years ago by nickm

Resolution: worksforme
Severity: Normal
Status: needs_informationclosed
Note: See TracTickets for help on using tickets.