Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#3814 closed defect (fixed)

Duplicate mark_for_close when running server with bufferevents

Reported by: nickm Owned by:
Priority: Medium Milestone: Tor: 0.2.3.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-relay
Cc: Actual Points:
Parent ID: #3561 Points:
Reviewer: Sponsor:

Description

It looks like there's a double-close going on when running a server with bufferevents:

[warn] Bug: Duplicate call to connection_mark_for_close at directory.c:3549 (first at directory.c:3549)

This is in connection_dir_finished_flushing(), in the DIR_CONN_STATE_SERVER_WRITING code. So that implies that connection_dir_finished_flushing() is getting called twice for a directory connection. That shouldn't happen: we should only call that from connection_handle_write_cb(). This could be a real bug, and imply premature closing of a directory connection.

Perhaps this has something to do with the fact that the directory connections here are implemented with a bufferevent_pair in typical use.

Child Tickets

Change History (4)

comment:1 Changed 8 years ago by nickm

Status: newneeds_review

Yes; this is almost certainly causing lossage in linked connections. The issue is that writing to a paired bufferevent can cause the data to get transferred immediately, so that checking right after to see if anything is sitting on the buffer won't actually do you any good.

I think we can fix this one by checking dir_spool_src in connection_dir_finished_flushing(). See branch bug3814 in my public repository.

comment:2 Changed 8 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Sebastian says it looks ok. Merged.

comment:3 Changed 7 years ago by nickm

Keywords: tor-relay added

comment:4 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.