uProxy-p2p icon indicating copy to clipboard operation
uProxy-p2p copied to clipboard

User can not detect if their peer disconnects.

Open lucyhe opened this issue 12 years ago • 24 comments

After a proxy/client connection is set up, neither peer can detect if the other disconnects. For example, closing the giver's RtcToNet instance does not trigger the getter's corresponding SocksToRtc instance to close (but it should).

lucyhe avatar Sep 30 '14 20:09 lucyhe

What version of Chrome is this happening on?

iislucas avatar Oct 01 '14 03:10 iislucas

I guess the ping ping mechanism that the SOCKS server used to have would help here. However, we should better understand why notifications are not happening in the first place.

Since that might take a while, we might want to reconsider adding the ping pong. I would hate to do that but it does provide a pretty failsafe way of detecting disconnection.

trevj avatar Oct 02 '14 15:10 trevj

I think ping-pong is still a good idea, because this is the worst type of failure, browser being stuck with proxy settings, when you're not connected.

On Thu, Oct 2, 2014 at 11:53 AM, trevj [email protected] wrote:

I guess the ping ping mechanism that the SOCKS server used to have would help here. However, we should better understand why notifications are not happening in the first place.

Since that might take a while, we might want to reconsider adding the ping pong. I would hate to do that but it does provide a pretty failsafe way of detecting disconnection.

— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/408#issuecomment-57651487.

salomegeo avatar Oct 03 '14 01:10 salomegeo

Ping-pong is important when the underlying peer-connection and data-channel connection information is unreliable. There's been a lot of work to make it more reliable. @mollyling : do you think data-channel connection/peer-connection state is reliable enough that we can rely on it without having to build our own ping on top of the over layers of pinging?

iislucas avatar Oct 07 '14 20:10 iislucas

I was running 36 at the time.

This is blocking https://github.com/uProxy/uproxy/pull/452 from working correctly.

lucyhe avatar Oct 08 '14 15:10 lucyhe

TODO: check if it's fixed in Chrome 38+

iislucas avatar Oct 13 '14 15:10 iislucas

Just checked -- clicking "stop" on the getter side doesn't cause the rtcToNet to close on the giver side (there should be a UI notification). Also, exiting the giver's Chrome doesn't affect the getter side either. Getter still tries to proxy when I type in a URL.

lucyhe avatar Oct 13 '14 15:10 lucyhe

I'm thinking we should re-add the ping-pong in uproxy-networking. Like Salome said above, when proxying fails, it cause the getter's browser to break completely, so we should have extra safeguards against this in uProxy, even if in theory it should be the WebRTC implementations responsibility.

On Mon, Oct 13, 2014 at 11:42 AM, lucyhe [email protected] wrote:

Just checked -- clicking "stop" on the getter side doesn't cause the rtcToNet to close on the giver side (there should be a UI notification). Also, exiting the giver's Chrome doesn't affect the getter side either. Getter still tries to proxy when I type in a URL.

— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/408#issuecomment-58910744.

dborkan avatar Oct 13 '14 17:10 dborkan

I just realized this from leaving my test chrome open: around 50 minutes after I closed the giver's Chrome, the remote-instance (of the giver) that existed on the getter side is gone and stopUsingProxy() was called (it's message "Reverting Chrome proxy settings" was logged in the console). Did it time out? Did it realize the giver went offline and/or did it realize the rtcToNet instance was closed?

lucyhe avatar Oct 13 '14 20:10 lucyhe

In other words, after waiting long enough, I saw the correct effects of disconnecting the giver. But I'm not sure if it was for the correct reason.

lucyhe avatar Oct 13 '14 20:10 lucyhe

This was all with Chrome v38 right? It might be good to try a few more tests and figure out just how long it takes for the disconnect notification to occur (so that we can create a detailed bug report for the Chrome WebRTC team), but if we aren't notified within ~10 seconds of disconnect I think we should re-add the ping-pong messages between peers.

dborkan avatar Oct 13 '14 22:10 dborkan

Lets confirm we have a problem first, and where the problem is. We should test with the simple-socks demo. You can directly close one side independently of the other by using the socksRtc and rtcNet objects from the console and calling close on them. We should make an integration test for this using our sample app... https://github.com/uProxy/uproxy/issues/462

iislucas avatar Oct 15 '14 00:10 iislucas

OK, just tested this. A curious answer to this one: peer-connections are not closed on the other side; but data channels are.

The fix needed: when the control channel in the socks-rtc or rtc-net peer-connection is closed (https://github.com/uProxy/uproxy-networking/blob/dev/src/socks-to-rtc/socks-to-rtc.ts#L144), the corresponding peer-connection should be closed.

@mollyling @bemasc : can you check that the webrtc spec says: should peer-connections close when the other side closes their end? If so, then we have a peer-connection bug to fix in WebRTC.

iislucas avatar Oct 15 '14 01:10 iislucas

Does anyone strongly object to re-adding the ping-pong? I agree this should all be fixed in WebRTC, but when the peer connection breaks the user experience is so bad (no pages can be loaded without any clear error message) that it seems worth the small amount of extra code in uproxy-networking to ensure this doesn't happen.

On Tue, Oct 14, 2014 at 9:02 PM, Lucas Dixon [email protected] wrote:

OK, just tested this. A curious answer to this one: peer-connections are not closed on the other side; but data channels are.

The fix needed: when the control channel in the socks-rtc or rtc-net peer-connection is closed ( https://github.com/uProxy/uproxy-networking/blob/dev/src/socks-to-rtc/socks-to-rtc.ts#L144), the corresponding peer-connection should be closed.

@mollyling https://github.com/mollyling @bemasc https://github.com/bemasc : can you check that the webrtc spec says: should peer-connections close when the other side closes their end? If so, then we have a peer-connection bug to fix in WebRTC.

— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/408#issuecomment-59143506.

dborkan avatar Oct 15 '14 15:10 dborkan

I don't strongly object. How urgent is it?

Integration tests for close events are the real solution here, I think. They won't arrive tomorrow but it seems the necessary infrastructure is becoming available.

trevj avatar Oct 15 '14 17:10 trevj

I think this should be resolved at least within a few weeks, as we depend on being able to detect disconnects for a few other things in uProxy, which are all needed for our web store launch:

  • Prompting the user that they are disconnected and requiring them to confirm (https://github.com/uProxy/uproxy/issues/249)
  • Updating the UX to show what users are currently proxying through you
  • Resetting bytes sent/received after disconnect

Also I think adding the ping-pong back should only be ~20 lines of code, most of which can be copied from the original implementation we did of this in June (in https://github.com/uProxy/uproxy-networking/pull/89 and https://github.com/uProxy/uproxy-networking/pull/90)

On Wed, Oct 15, 2014 at 1:28 PM, trevj [email protected] wrote:

I don't strongly object. How urgent is it?

Integration tests for close events are the real solution here, I think. They won't arrive tomorrow but it seems the necessary infrastructure is becoming available.

— Reply to this email directly or view it on GitHub https://github.com/uProxy/uproxy/issues/408#issuecomment-59243339.

dborkan avatar Oct 15 '14 18:10 dborkan

The main work here will be covered by this issue: https://github.com/uProxy/uproxy/issues/462

trevj avatar Oct 15 '14 18:10 trevj

Regarding ping pong, I don't want to jump on this today or tomorrow but if within a couple of weeks we don't have a solid test for termination or we run into unsolveable issues, let's re-add it.

trevj avatar Oct 15 '14 18:10 trevj

There's a 2 line fix that is much simpler than an extra ping-pong: close the socks-rtc or rtc-net when the control channel closes; WebRTC does a ping-pong internally and I'm told that is now robust - we're just not using it (peer-connections, according to spec which I just explored again, are not guaranteed to close remotely, but data channels are supposed to).

I'd suggest trying the super-simple thing first of close on control channel close. But either way, we want to have the integration tests that Trevor is suggesting.

iislucas avatar Oct 16 '14 03:10 iislucas

This is very helpful information. I copied it into the relevant integration test issue: https://github.com/uProxy/uproxy/issues/462

Nothing stopping us experimenting with this simple approach in the meantime.

trevj avatar Oct 16 '14 13:10 trevj