]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
hs_pow: fix error path with outdated assumption
authorMicah Elizabeth Scott <beth@torproject.org>
Tue, 25 Apr 2023 16:02:45 +0000 (09:02 -0700)
committerMicah Elizabeth Scott <beth@torproject.org>
Wed, 10 May 2023 14:41:37 +0000 (07:41 -0700)
This error path with the "PoW cpuworker returned with no solution.
Will retry soon." message was usually lying. It's concerning
now because we expect to always find a solution no matter how
long it takes, rather than re-enter the solver repeatedly, so any
exit without a solution is a sign of a problem.

In fact when this error path gets hit, we are usually missing a
circuit instead because the request is quite old and the circuits
have been destroyed. This is not an emergency, it's just a sign
of client-side overload.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
src/feature/hs/hs_pow.c

index 15152bc6490aa80f525889ae7a1ef770c0f706f9..4f662b58d9e669e779ae948a27ae4d020f0ccd4d 100644 (file)
@@ -436,9 +436,11 @@ pow_worker_replyfn(void *work_)
     ip = find_desc_intro_point_by_ident(intro_circ->hs_ident, desc);
 
   if (intro_circ && rend_circ && service_identity_pk && desc && ip &&
-      job->pow_solution_out) { /* successful pow solve, and circs still here */
+      job->pow_solution_out) {
 
+    /* successful pow solve, and circs still here */
     log_info(LD_REND, "Got a PoW solution we like! Shipping it!");
+
     /* Set flag to reflect that the HS we are attempting to rendezvous has PoW
      * defenses enabled, and as such we will need to be more lenient with
      * timing out while waiting for the service-side circuit to be built. */
@@ -451,18 +453,16 @@ pow_worker_replyfn(void *work_)
       intro_circ->hs_currently_solving_pow = 0;
     }
 
-  } else { /* unsuccessful pow solve. put it back on the queue. */
-    log_notice(LD_REND,
-               "PoW cpuworker returned with no solution. Will retry soon.");
+  } else {
+    if (!job->pow_solution_out) {
+      log_warn(LD_REND, "PoW cpuworker returned with no solution");
+    } else {
+      log_info(LD_REND, "PoW solution completed but we can "
+                        "no longer locate its circuit");
+    }
     if (intro_circ) {
       intro_circ->hs_currently_solving_pow = 0;
     }
-    /* We could imagine immediately re-launching a follow-up worker
-     * here too, but for now just let the main intro loop find the
-     * not-being-serviced request and it can start everything again. For
-     * the sake of complexity, maybe that's the best long-term solution
-     * too, and we can tune the cpuworker job to try for longer if we want
-     * to improve efficiency. */
   }
 
   pow_worker_job_free(job);