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

Fluffy uTP doesn't acknownledge peer's fin packet, closes before it sends an ack back #1778

Closed
KolbyML opened this issue Sep 26, 2023 · 5 comments
Labels

Comments

@KolbyML
Copy link

KolbyML commented Sep 26, 2023

I can only find this happening on Fluffy? After we send our Fin we should recieve an ack to acknowledge fluffy got our fin I believe.

image

This is a picture I took off geeksforgeeks for TCP, but I believe it should be a similar idea?

2023-09-23T23:24:13.777799Z TRACE uTP{send=23953 recv=23952}: utp_rs::conn: Received packet cid=23952 packetType=ST_DATA seqNr=47990 ackNr=44195 timestamp=2613482883 timestampDiff=0 remoteWindow=1048576
2023-09-23T23:24:13.789281Z TRACE uTP{send=23953 recv=23952}: utp_rs::conn: Received packet cid=23952 packetType=ST_FIN seqNr=47991 ackNr=44195 timestamp=2613482983 timestampDiff=0 remoteWindow=1048576
2023-09-23T23:24:13.789337Z DEBUG uTP{send=23953 recv=23952}: utp_rs::conn: received FIN seq=47991
2023-09-23T23:24:14.070331Z DEBUG uTP{send=23953 recv=23952}: utp_rs::conn: uTP conn initiating shutdown...
2023-09-23T23:24:14.070377Z DEBUG uTP{send=23953 recv=23952}: utp_rs::conn: transmitting FIN seq=44196
2023-09-23T23:24:14.070395Z TRACE uTP{send=23953 recv=23952}: utp_rs::conn: Write data cid=23953 packetType=ST_FIN pkSeqNr=44196 pkAckNr=47991 length=20
2023-09-23T23:24:15.071640Z DEBUG uTP{send=23953 recv=23952}: utp_rs::conn: timeout seq=44196 ack=47991 packet=Fin
2023-09-23T23:24:15.071724Z TRACE uTP{send=23953 recv=23952}: utp_rs::conn: Write data cid=23953 packetType=ST_FIN pkSeqNr=44196 pkAckNr=47991 length=20
2023-09-23T23:24:15.302863Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=23953 packet=Reset seq=27559 ack=44196 init_cid=ConnectionId { send: 23954, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 23952, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:24:17.073285Z DEBUG uTP{send=23953 recv=23952}: utp_rs::conn: timeout seq=44196 ack=47991 packet=Fin
2023-09-23T23:24:17.073387Z TRACE uTP{send=23953 recv=23952}: utp_rs::conn: Write data cid=23953 packetType=ST_FIN pkSeqNr=44196 pkAckNr=47991 length=20
2023-09-23T23:24:17.325014Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=23953 packet=Reset seq=12933 ack=44196 init_cid=ConnectionId { send: 23954, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 23952, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:24:21.075743Z DEBUG uTP{send=23953 recv=23952}: utp_rs::conn: timeout seq=44196 ack=47991 packet=Fin
2023-09-23T23:24:21.075882Z TRACE uTP{send=23953 recv=23952}: utp_rs::conn: Write data cid=23953 packetType=ST_FIN pkSeqNr=44196 pkAckNr=47991 length=20
2023-09-23T23:24:21.322014Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=23953 packet=Reset seq=1554 ack=44196 init_cid=ConnectionId { send: 23954, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 23952, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:24:23.530702Z TRACE uTP{send=57286 recv=57285}: utp_rs::conn: Received packet cid=57285 packetType=ST_DATA seqNr=46010 ackNr=13414 timestamp=2623239535 timestampDiff=0 remoteWindow=1048576
2023-09-23T23:24:29.076626Z DEBUG uTP{send=23953 recv=23952}: utp_rs::conn: timeout seq=44196 ack=47991 packet=Fin
2023-09-23T23:24:29.076670Z TRACE uTP{send=23953 recv=23952}: utp_rs::conn: Write data cid=23953 packetType=ST_FIN pkSeqNr=44196 pkAckNr=47991 length=20
2023-09-23T23:24:29.344020Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=23953 packet=Reset seq=9775 ack=44196 init_cid=ConnectionId { send: 23954, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 23952, recv: 23953, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:36:43.908957Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Received packet cid=34135 packetType=ST_DATA seqNr=49522 ackNr=19928 timestamp=3363663408 timestampDiff=0 remoteWindow=1048576
2023-09-23T23:36:43.909073Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Received packet cid=34135 packetType=ST_FIN seqNr=49523 ackNr=19928 timestamp=3363663526 timestampDiff=0 remoteWindow=1048576
2023-09-23T23:36:43.909140Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: received FIN seq=49523
2023-09-23T23:36:44.248196Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: uTP conn initiating shutdown...
2023-09-23T23:36:44.248280Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: transmitting FIN seq=19929
2023-09-23T23:36:44.248303Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Write data cid=34136 packetType=ST_FIN pkSeqNr=19929 pkAckNr=49523 length=20
2023-09-23T23:36:44.478840Z TRACE uTP{send=34137 recv=34136}: utp_rs::conn: Received packet cid=34136 packetType=ST_RESET seqNr=63730 ackNr=19929 timestamp=3364252127 timestampDiff=0 remoteWindow=0
2023-09-23T23:36:44.478940Z  WARN uTP{send=34137 recv=34136}: utp_rs::conn: RESET from remote
2023-09-23T23:36:44.478965Z  WARN uTP{send=34137 recv=34136}: utp_rs::conn: resetting connection: received RESET packet from remote peer err=Reset
2023-09-23T23:36:44.479008Z DEBUG uTP{send=34137 recv=34136}: utp_rs::conn: uTP conn closing... err=Some(Reset)
2023-09-23T23:36:44.479097Z DEBUG utp_rs::socket: uTP conn shutdown cid.send=34137 cid.recv=34136
2023-09-23T23:36:45.249938Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: timeout seq=19929 ack=49523 packet=Fin
2023-09-23T23:36:45.250040Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Write data cid=34136 packetType=ST_FIN pkSeqNr=19929 pkAckNr=49523 length=20
2023-09-23T23:36:45.479666Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=34136 packet=Reset seq=4992 ack=19929 init_cid=ConnectionId { send: 34137, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 34135, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:36:47.251776Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: timeout seq=19929 ack=49523 packet=Fin
2023-09-23T23:36:47.251844Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Write data cid=34136 packetType=ST_FIN pkSeqNr=19929 pkAckNr=49523 length=20
2023-09-23T23:36:47.477114Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=34136 packet=Reset seq=21789 ack=19929 init_cid=ConnectionId { send: 34137, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 34135, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:36:51.254051Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: timeout seq=19929 ack=49523 packet=Fin
2023-09-23T23:36:51.254245Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Write data cid=34136 packetType=ST_FIN pkSeqNr=19929 pkAckNr=49523 length=20
2023-09-23T23:36:51.453865Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=34136 packet=Reset seq=45479 ack=19929 init_cid=ConnectionId { send: 34137, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 34135, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:36:59.256581Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: timeout seq=19929 ack=49523 packet=Fin
2023-09-23T23:36:59.256694Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Write data cid=34136 packetType=ST_FIN pkSeqNr=19929 pkAckNr=49523 length=20
2023-09-23T23:36:59.473100Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=34136 packet=Reset seq=16898 ack=19929 init_cid=ConnectionId { send: 34137, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 34135, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:37:14.258898Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: timeout seq=19929 ack=49523 packet=Fin
2023-09-23T23:37:14.258995Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Write data cid=34136 packetType=ST_FIN pkSeqNr=19929 pkAckNr=49523 length=20
2023-09-23T23:37:14.464942Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=34136 packet=Reset seq=63757 ack=19929 init_cid=ConnectionId { send: 34137, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 34135, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
2023-09-23T23:37:29.261297Z DEBUG uTP{send=34136 recv=34135}: utp_rs::conn: timeout seq=19929 ack=49523 packet=Fin
2023-09-23T23:37:29.261521Z TRACE uTP{send=34136 recv=34135}: utp_rs::conn: Write data cid=34136 packetType=ST_FIN pkSeqNr=19929 pkAckNr=49523 length=20
2023-09-23T23:37:29.499766Z DEBUG utp_rs::socket: received uTP packet for non-existing conn cid=34136 packet=Reset seq=20156 ack=19929 init_cid=ConnectionId { send: 34137, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) } acc_cid=ConnectionId { send: 34135, recv: 34136, peer: UtpEnr(Enr { id: Some("v4"), seq: 1, NodeId: 0xd07753ecb594a78065cceb98201ac3b3cf0bc6587f291a45efc0fee235f3f553, signature: "de09e16b6daa815037b663c17bb47ae9b9242d690de3766371d5777ef699e4e743eb291278644bcb92f9811789c1918eb394e91eb60340701b4b3664a8556fa5", IpV4 UDP Socket: Some(194.33.40.239:9110), IpV6 UDP Socket: None, IpV4 TCP Socket: None, IpV6 TCP Socket: None, Other Pairs: [("c", "66"), ("secp256k1", "a10212624e17b93b265638cfa7712c37dee9a789887ad6f5f4795d00a070236666ff")] }) }
@KolbyML
Copy link
Author

KolbyML commented Sep 26, 2023

@kdeme ping for review

@kdeme kdeme added the Fluffy label Sep 26, 2023
@kdeme
Copy link
Contributor

kdeme commented Sep 26, 2023

The logs makes perfect sense for how it is implemented in Fluffy.

After a ST_FIN gets ACK'ed, the socket moves into destroy state. So the ST_FIN that Trin still sends at that point is considered a packet for a no longer known/open connection and thus a ST_RESET is being send, which you can also see in the logs several times. In the first log Trin seems to completely ignore that. In the second log it seems to acknowledge it but eventually still ignore it.

Regarding the ST_FIN: Sadly enough the uTP specifications do not explicitly state whether this should be a two-way FIN or one-way FIN. It does state This is the last packet.. This, combined with the way the reference implementation does this, made us implement it like above. Basically, Fluffy sends a ST_FIN and when an ACK is received, the socket gets destroyed. No other FIN is send. But sure, this is definitely not super clear from the specifications and could be disputed. We might want to verify other implementations. Perhaps it would be of more importance if we were to actually send data in two ways over the same connection.

Regarding the ST_RESET: This seems like a bug in Trin. I don't think there is an ambiguity here. When a ST_RESET is received, any further data transfer (the ST_FIN in this case) should be stopped and the connection on your side should get destroyed.

@KolbyML
Copy link
Author

KolbyML commented Sep 26, 2023

How we handle ST_RESET in Trin for sure should be changed

Basically, Fluffy sends a ST_FIN and when an ACK is received, the socket gets destroyed

My issue with this is your ST_FIN is being ACKED by our ST_FIN, not an ST_STATE packet, I think in that case our ST_FIN should also be acked.

Also uTP is a 2 way stream protocol like TCP meaning both sides could be sending data, which is why a one sided fin close doesn't make sense, because if both sides can send/recieve data, both would want to confirmed they recieved it all so they could send resends if they didn't get some. So both would want to confirmed they are finished.

In our usecase we use it only as a one way stream though. But if we were doing a 2 way stream, what if you sent your fin because you were still sending data, but we had more data to send, we would finish sending our data send our fin then you would ack it and the connection would close. Which is why I think us sending a fin back is the right move. Also the spec says ST_FIN is a TCP like flag. (Well uTP is basically TCP anyways)

@kdeme
Copy link
Contributor

kdeme commented Sep 26, 2023

I don't disagree with the reasoning regarding the two-way FIN. But I do put higher value currently in following the reference implementation (considering the spec is not clear about this).

This part of the code is why I think the ref. implementation also works with only 1-way FIN: https://github.com/bittorrent/libutp/blob/master/utp_internal.cpp#L3372-L3381 and also some references in our code regarding this such as: https://github.com/status-im/nim-eth/blob/master/eth/utp/utp_socket.nim#L1462

It basically looks that as soon as the FIN gets ACK'ed, the socket goes into destroy state. Which basically means, that a FIN send at that point, is no longer ACK'ed on anyhow.

And I've actually undone similar behaviour to what you expect in the past, which would still send an FIN after receiving FIN (application reading EOF) because it wouldn't matter due that implementation: 3909675

@KolbyML
Copy link
Author

KolbyML commented Sep 26, 2023

Fair enough, I will look into resolving our reset issue. As that alone should stop wasted packets from being sent.

@KolbyML KolbyML closed this as completed Sep 26, 2023
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

2 participants