circuit_free only circuit number 0

Hi everybody

Tor 0.3.2.4-alpha (git-940308f493edd10f) running on FreeBSD with Libevent 2.1.8-stable, OpenSSL LibreSSL 2.5.4, Zlib 1.2.8, Liblzma 5.2.2, and Libzstd 1.3.2.

The following output can be observed:

Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 0 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 287478585 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 1674209475 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 1882566763 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 361115214 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 1845079337 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 341507119 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
Nov 12 09:51:20.000 [info] circuit_mark_for_close_: Circuit 270872991 (id: 0) marked for close at src/or/command.c:585 (orig reason: 512, new reason: 0)
...
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
Nov 12 09:51:20.000 [info] circuit_free: Circuit 0 (id: 0) has been freed.
...

I look at a some minutes snap and count the _mark vs _free messages:

# cat torlog | grep "has been freed" | awk '{print $6}' | uniq -c
24144 Circuit
# cat torlog | grep "circuit_mark_for_close_" | awk '{print $6}' | uniq -c
24143 Circuit

It looks like each _mark has a corresponding _free (with a difference of one). But all _free reporting the same number n_circ_id. Especially this should be (IMHO) avoided by:

circuitlist.c
...
circuit_free(circuit_t *circ)
...
  /* We keep a copy of this so we can log its value before it gets unset. */
  n_circ_id = circ->n_circ_id;
...
  log_info(LD_CIRC, "Circuit %u (id: %" PRIu32 ") has been freed.",
           n_circ_id,
           CIRCUIT_IS_ORIGIN(circ) ?
              TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0);

Well, the circuits are not effectively freed ? Am I missing something ?

Cheers!

Trac:
Username: Felixix