testing: Fix route-based/net2net-xfrmi-ike scenario
On newer systems, the upper hard limit for open file descriptors (see `ulimit -H -n`) was increased from 4096 to 524288. Due to how python-daemon closes potentially open file descriptors (basically stores them in a set, removes those excluded by config, and loops through all of them), the updown script was either killed immediately (by the OOM killer) or not ready yet when updown events occurred.
This commit is contained in:
@@ -6,6 +6,7 @@ import daemon
|
||||
import logging
|
||||
from logging.handlers import SysLogHandler
|
||||
import subprocess
|
||||
import resource
|
||||
|
||||
|
||||
logger = logging.getLogger('updownLogger')
|
||||
@@ -54,6 +55,13 @@ def install_routes(ike_sa):
|
||||
subprocess.call(["ip", "route", "add", ts, "dev", ifname_out])
|
||||
|
||||
|
||||
# the hard limit (second number) is the value used by python-daemon when closing
|
||||
# potentially open file descriptors while daemonizing. since the default is
|
||||
# 524288 on newer systems, this can take quite a while, and due to how this
|
||||
# range of FDs is handled internally (as set) it can even trigger the OOM killer
|
||||
resource.setrlimit(resource.RLIMIT_NOFILE, (256, 256))
|
||||
|
||||
|
||||
# daemonize and run parallel to the IKE daemon
|
||||
with daemon.DaemonContext():
|
||||
logger.debug("starting Python updown listener")
|
||||
|
||||
Reference in New Issue
Block a user