-
Notifications
You must be signed in to change notification settings - Fork 386
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
[Bug fix]Connections are not deleted properly in Flow Exporter when they are not exported #2516
Conversation
8eb9025
to
3c2956b
Compare
Codecov Report
@@ Coverage Diff @@
## main #2516 +/- ##
==========================================
+ Coverage 59.78% 64.98% +5.19%
==========================================
Files 284 281 -3
Lines 22265 25501 +3236
==========================================
+ Hits 13312 16571 +3259
+ Misses 7535 7387 -148
- Partials 1418 1543 +125
Flags with carried forward coverage won't be shown. Click here to find out more.
|
3c2956b
to
d7cc0c6
Compare
fb9eb3b
to
5d66f06
Compare
cmd/antrea-agent/options.go
Outdated
if o.idleFlowTimeout > connections.StaleConnectionTimeout { | ||
connections.StaleConnectionTimeout = 2 * o.idleFlowTimeout | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a bit of an asymmetry here: if idleFlowTimeout
is 3m and activeFlowTimeout
is 2m, the StaleConnectionTimeout
will be set to 4m
. A symmetric solution would set it to 2*max(idleFlowTimeout, activeFlowTimeout)
. or 5 minutes, whichever is larger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I saw that. I assumed idleFlowTimeout
to be always smaller than activeFlowTimeout
, but I see that we do not have any check in the config options to make sure of that.
Will have a combined check to resolve that.
eec9202
to
9629ec0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
) | ||
|
||
var ( | ||
StaleConnectionTimeout = 5 * time.Minute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it may be a better pattern to have const DefaultStaleConnectionTimeout = 5 * time.Minute
and pass the actual value as a parameter to the connection store when instantiating it, but I'll let you make that call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the same pattern as active and idle timeouts make sense. I changed it. PTAL.
9629ec0
to
95ab039
Compare
@antoninbas Would like to cherrypick this on to release-1.2 branch once it is merged as it is a critical bug. Thanks. |
95ab039
to
022a402
Compare
/test-e2e |
If flows are not exported to any collector, we do not clear the connections in the connection store. This is applicable to both conntrack and deny connections. This will increase the memory usage unnecessarily in Antrea agent. Signed-off-by: Srikar Tati <[email protected]>
022a402
to
a0cbb1f
Compare
/test-all /test-ipv6-e2e /test-ipv6-only-e2e |
@antoninbas This is ready to be merged. Dual stack e2e tests failed because of an unrelated test: |
If flows are not exported to any collector, we do not clear the connections
in the connection store. This is applicable to both conntrack and deny
connections. This will increase the memory usage in the Antrea agent linearly.
Added goroutines that clean up connections if they are stale for more than 5 minutes (stale timeout)
after the last export. We also error out if
activeTimeout
andidleTimeout
are more than stale connection timeout (constant 5 mins. value).