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

flow: Add cfg for optional flow reuse during low memory #10232

Closed

Conversation

coledishington
Copy link
Contributor

By default, force flow reuse to reuse an existing flows no matter the state of the flow.

Add a configuration option flow.force-reuse, enabled by default, that can turn off the above behavior.

Ticket: #6293

Make sure these boxes are signed before submitting your Pull Request -- thank you.

Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/6293

Describe changes:
Add a configuration option flow.force-reuse, enabled by default, that can turn off flow reuse in low memory situations.

Provide values to any of the below to override the defaults.

SV_BRANCH=pr/1607

By default, force flow reuse to reuse an existing flows no matter
the state of the flow.

Add a configuration option flow.force-reuse, enabled by default, that
can turn off the above behaviour.

Ticket: OISF#6293
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3cb7112) 82.18% compared to head (5adda28) 82.24%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10232      +/-   ##
==========================================
+ Coverage   82.18%   82.24%   +0.05%     
==========================================
  Files         977      977              
  Lines      271894   271900       +6     
==========================================
+ Hits       223465   223617     +152     
+ Misses      48429    48283     -146     
Flag Coverage Δ
fuzzcorpus 63.21% <62.50%> (+0.23%) ⬆️
suricata-verify 61.56% <100.00%> (+0.07%) ⬆️
unittests 62.81% <75.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@victorjulien victorjulien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments.

Additionally:

  • formatting needs fixing up
  • documentation in userguide needs to be added

Thanks!

@@ -687,6 +687,10 @@ static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p)
FlowWakeupFlowManagerThread();
}

if (!flow_config.force_reuse) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how should this behave in IPS mode? We don't call NoFlowHandleIPS() here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also enforce this option at the start of FlowGetUsedFlow

@@ -286,6 +286,7 @@ typedef struct FlowCnf_
uint32_t hash_rand;
uint32_t hash_size;
uint32_t prealloc;
int force_reuse;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, please add a line to document the field

@@ -1424,6 +1424,7 @@ flow:
emergency-recovery: 30
#managers: 1 # default to one flow manager
#recyclers: 1 # default to one flow recycler thread
force-reuse: 1 # Default to forcing flow reuse in low memory conditions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can enable it by default in the code, and leave it commented out here

additionally, it should use true/false instead of suggesting it is a numeric value

@coledishington
Copy link
Contributor Author

Updated in #10257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants