I’ve left my Tor relay (run on an AWS EC2 instance, Xenial Xerius Ubuntu) alone for a few days, and it operated for a few days. The relay then started counting downtime, and the “last seen” timestamp on the Tor metrics website said it was last seen a few days ago. I was poking around with the command line, and I got a message with log level warn saying “It looks like another Tor process is running with the same data directory. Waiting 5 seconds to see if it goes away.”. Then a message with log level info appeared saying “tor_lockfile_lock(): Locking “/home/ubuntu/.tor/lock”, then an err message saying “No, it’s still there. Exiting”. Another err message followed saying “set_options(): Bug: acting on config options left us in a broken state. Dying. (on Tor 0.3.3.7 )”, then a final err message saying “Reading config failed—see warnings above.”. I looked at the source code, and I found this code block:
static tor_lockfile_t *lockfile = NULL;
int
try_locking(or_options_t *options, int err_if_locked)
{
if (lockfile)
return 0;
else {
char *fname = options_get_datadir_fname2_suffix(options, "lock",NULL,NULL);
int already_locked = 0;
tor_lockfile_t *lf = tor_lockfile_lock(fname, 0, &already_locked);
tor_free(fname);
if (!lf) {
if (err_if_locked && already_locked) {
int r;
log_warn(LD_GENERAL, "It looks like another Tor process is running "
"with the same data directory. Waiting 5 seconds to see "
"if it goes away.");
#ifndef WIN32
sleep(5);
#else
Sleep(5000);
#endif
r = try_locking(options, 0);
if (r<0) {
log_err(LD_GENERAL, "No, it's still there. Exiting.");
exit(0);
}
return r;
}
return -1;
}
lockfile = lf;
return 0;
}
}
Here's the Tor metrics page link for my relay: https://metrics.torproject.org/rs.html#details/B169906909476519CF94B87812C231516FBA2D95
What's going on?