google / google/gopacket

Reusing old connection for new connection

Open
#57 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
Go
Stars
6.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. Start assembler while connections are running.
2. Wait for given duration
3. Run FlushOlderThan(now-duration)
4. Begin new connection matching signature of a connection that was established
before start

What is the expected output? What do you see instead?
Existing connection closed at flush, new connection tracked correctly

What version of the product are you using? On what operating system?
master branch at 35960c88f08138235636f33b18236050c9bdbffe
linux

Please provide any additional information below.

debug log:
2015/01/08 11:58:13 [10.3.1.100->172.17.0.24 39530->6379] waiting for start,
storing into connection
2015/01/08 11:58:13 [10.3.1.100->172.17.0.24 39530->6379] waiting for start,
storing into connection
....
2015/01/08 12:45:36 [10.3.1.100->172.17.0.24 39530->6379] saw first SYN packet,
returning immediately, seq=3035267911
2015/01/08 12:45:36 [10.3.1.100->172.17.0.24 39530->6379] adding from conn
(397240757, 3035267912)
2015/01/08 12:45:36 [10.3.1.100->172.17.0.24 39530->6379] adding from conn
(397240761, 3035267912)
2015/01/08 12:45:36 [10.3.1.100->172.17.0.24 39530->6379] closing
2015/01/08 12:45:36 [10.3.1.100->172.17.0.24 39530->6379] waiting for start,
storing into connection
2015/01/08 12:45:36 [10.3.1.100->172.17.0.24 39530->6379] waiting for start,
storing into connection
2015/01/08 12:45:36 [10.3.1.100->172.17.0.24 39530->6379] waiting for start,
storing into connection
...

As you can see, it's quite weird, the new connection starts almost an hour
after the first packets are seen for that port number (enough time for the port
number to wrap around and get reused)

It seems to never close the old connection because I don't think it ever saw it
start, then when it does see it start (albeit a completely new connection) it's
like "Ahha! I can close it now because I've seen it start".

Perfect logic, but the connection it saw open is a different connection to the
one it saw close almost an hour previous.
```

Original issue reported on code.google.com by `norga...@gmail.com` on 8 Jan 2015 at 1:50

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.