Skip to content

Abort Doomed Browser Communications #591

Closed
@dnwiebe

Description

@dnwiebe

The ProxyServer keeps a map called stream_key_ttl that contains stream keys that are waiting to die: that is, the browser has cut off the TCP stream to the Node for these keys, but the server may not know about that yet and might continue to send data for a short time, which will have to be discarded (since the stream to the browser is broken), but will still need to be paid for, since the exit and relay Nodes are still operating in good faith.

Currently, when this doomed data arrives at the ProxyServer, it is sent to the StreamHandlerPool on its way to the browser, and the StreamHandlerPool notices that the corresponding StreamWriter has been destroyed; it discards the data and logs an error message.

Since this is a frequent occurrence, we get lots of errors in the log for conditions that really aren't errors at all. Furthermore, in order to get to the StreamHandlerPool and be thrown away, the data has to pass through the ProxyServer, right next to that stream_key_ttl map that could easily tell the ProxyServer that the stream no longer exists, and sending the data on to the StreamHandlerPool is a fool's errand.

Modify the code so that whenever the ProxyServer receives data on the way to the browser, it looks up that data's stream in stream_key_ttl to make sure it's not there. If it is, the ProxyServer should refrain from sending the data to the StreamHandlerPool, discard it, and write a DEBUG log about it. The ERROR log in the StreamHandlerPool should remain, but it should now be hit much less often.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status

    ✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions