Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define behavior when receiving TCP RST packet #2148

Closed
tleyden opened this issue Apr 23, 2018 · 3 comments
Closed

Define behavior when receiving TCP RST packet #2148

tleyden opened this issue Apr 23, 2018 · 3 comments
Labels
Milestone

Comments

@tleyden
Copy link
Contributor

tleyden commented Apr 23, 2018

When receiving a TCP packet with the RST flag set, Couchbase Lite is currently emitting an Unparseable HTTP response from CBLWebSocket.mm

Here is an example packet from Sync Gateway (with a firewall / load balancer in the middle):

Transmission Control Protocol, Src Port: 4984, Dst Port: 57878, Seq: 1999, Len: 0
    Source Port: 4984
    Destination Port: 57878
    [Stream index: 0]
    [TCP Segment Len: 0]
    Sequence number: 1999    (relative sequence number)
    [Next sequence number: 1999    (relative sequence number)]
    Acknowledgment number: 0
    0101 .... = Header Length: 20 bytes (5)
    Flags: 0x004 (RST)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...0 .... = Acknowledgment: Not set
        .... .... 0... = Push: Not set
        .... .... .1.. = Reset: Set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
        [TCP Flags: ·········R··]
    Window size value: 0
    [Calculated window size: 0]
    [Window size scaling factor: 128]
    Checksum: 0xab8c [unverified]
    [Checksum Status: Unverified]
    Urgent pointer: 0
    [Timestamps]

What's the expected behavior in this case? Should it retry the connection in a backoff/retry style?


  • Version: CBL 2.0.1
  • Client OS: iOS 11
  • Server: SG 2.0.0
@pasin
Copy link
Contributor

pasin commented Apr 23, 2018

I think it should covert that (zero bytes with EOF) to a transient error. I will need to check what the error should be.

@snej
Copy link
Contributor

snej commented Apr 27, 2018

RST just means the TCP connection is being aborted, likely by middleware. We should definitely retry. It's unfortunate that CFNetwork isn't treating this as an error.

@djpongh djpongh added this to the 2.1.0 milestone Apr 27, 2018
@pasin pasin closed this as completed in 12d1387 May 4, 2018
@pasin pasin removed the backlog label May 4, 2018
@tleyden
Copy link
Contributor Author

tleyden commented May 4, 2018

Related to #2140

(adding a link so that following the link to ticket #2140 in the comment might lead to this issue, and provide some more context on the change)

pasin added a commit that referenced this issue May 19, 2018
* Refixed #2140 by converting zero data with EOF stream response into ENOTCONN error so that the retry logic could be kicked in.
* Made a speculative fix for #2150 by reverting fa0f920 commit.
pasin added a commit that referenced this issue May 22, 2018
Fixed the issue by converting zero data with EOF stream response into ENOTCONN error so that the retry logic could be kicked in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants