Suricata is a network Intrusion Detection System, Intrusion Prevention System and Network Security Monitoring engine developed by the OISF and the Suricata community.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Go to file
Victor Julien 7f8795c756 threading: avoid autofp deadlock
When there are many threads and/or the packet pool (max-pending-packets) is
small, a potential dead lock exists between the packet pool return pool
logic and the capture threads. The autofp workers together can have all the
packets in their return pools, while the capture thread(s) are waiting at an
empty pool. A race between the worker threads and the capture thread, where
the latter signals the former, is lost by the capture thread. Now everyone
is waiting.

To avoid this scenario, this patch makes the previously hardcoded 'return
pool' threshold dynamic based on the number of threads and the packet pool
size.

It sets the threshold to the max pending packets value, divided by the number
of lister threads. The max value hasn't changed. Normally, in the autofp
runmode these are the stream/detect/log worker threads.

The max_pending_return_packets value needs to stay below the packet pool size
of the 'producers' (normally pkt capture threads but also flow timeout
injection) to avoid the deadlock.

As it's quite impossible at this time to learn how many threads will be
created before starting the runmodes, and thus spawning the threads and
already initializing the packet pools, this code sets a global variable
after runmode setup, but before the threads are 'unpaused'.
11 years ago
benches
contrib suri-graphite: add ouput to file option 11 years ago
doc Fix make distcheck on CentOS 5.11 12 years ago
lua output-lua: add SCPacketTimeString 12 years ago
m4
qa docker: add ASAN to pcaps build 11 years ago
rules decode: add ERSPANv1 decoder 11 years ago
scripts app-layer setup scripts: enable new modules on copy 11 years ago
src threading: avoid autofp deadlock 11 years ago
.gitignore
.travis.yml travis: add libjansson and hiredis 11 years ago
COPYING GPL license sync with official gpl-2.0.txt 11 years ago
ChangeLog Update changelog for 2.1beta4 release 11 years ago
LICENSE GPL license sync with official gpl-2.0.txt 11 years ago
Makefile.am Respect DESTDIR in install-conf and install-rules. 12 years ago
Makefile.cvs
acsite.m4
autogen.sh
classification.config
config.rpath
configure.ac output-json: add redis support 11 years ago
doxygen.cfg doxygen: add source browser 12 years ago
reference.config Update reference.config 12 years ago
suricata.yaml.in util-logopenfile: implement redis pipelining 11 years ago
threshold.config