Merge branches 'bug8185_031' and 'bug8185_diagnostic_032'

This commit is contained in:
Nick Mathewson 2017-09-29 17:26:40 -04:00
commit ca2e7eabc2
3 changed files with 30 additions and 1 deletions

4
changes/8185_diagnostic Normal file
View File

@ -0,0 +1,4 @@
o Minor features (logging diagnostic):
- Log more circuit information whenever we are about to try to
package a relay cell on a circuit with a nonexistent n_chan.
Attempt to diagnose bug 8185.

6
changes/bug8185_025 Normal file
View File

@ -0,0 +1,6 @@
o Minor bugfixes (logging, relay shutdown, annoyance):
- When a circuit is marked for close, do not attempt to package any cells
for channels on that circuit. Previously, we would detect this
condition lower in the call stack, when we noticed that the circuit had
no attached channel, and log an annoying message. Fixes bug 8185;
bugfix on 0.2.5.4-alpha.

View File

@ -495,12 +495,25 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
{ {
channel_t *chan; /* where to send the cell */ channel_t *chan; /* where to send the cell */
if (circ->marked_for_close) {
/* Circuit is marked; send nothing. */
return 0;
}
if (cell_direction == CELL_DIRECTION_OUT) { if (cell_direction == CELL_DIRECTION_OUT) {
crypt_path_t *thishop; /* counter for repeated crypts */ crypt_path_t *thishop; /* counter for repeated crypts */
chan = circ->n_chan; chan = circ->n_chan;
if (!chan) { if (!chan) {
log_warn(LD_BUG,"outgoing relay cell sent from %s:%d has n_chan==NULL." log_warn(LD_BUG,"outgoing relay cell sent from %s:%d has n_chan==NULL."
" Dropping.", filename, lineno); " Dropping. Circuit is in state %s (%d), and is "
"%smarked for close. (%s:%d, %d)", filename, lineno,
circuit_state_to_string(circ->state), circ->state,
circ->marked_for_close ? "" : "not ",
circ->marked_for_close_file?circ->marked_for_close_file:"",
circ->marked_for_close, circ->marked_for_close_reason);
if (CIRCUIT_IS_ORIGIN(circ)) {
circuit_log_path(LOG_WARN, LD_BUG, TO_ORIGIN_CIRCUIT(circ));
}
log_backtrace(LOG_WARN,LD_BUG,""); log_backtrace(LOG_WARN,LD_BUG,"");
return 0; /* just drop it */ return 0; /* just drop it */
} }
@ -810,6 +823,12 @@ connection_edge_send_command(edge_connection_t *fromconn,
return -1; return -1;
} }
if (circ->marked_for_close) {
/* The circuit has been marked, but not freed yet. When it's freed, it
* will mark this connection for close. */
return -1;
}
#ifdef MEASUREMENTS_21206 #ifdef MEASUREMENTS_21206
/* Keep track of the number of RELAY_DATA cells sent for directory /* Keep track of the number of RELAY_DATA cells sent for directory
* connections. */ * connections. */