You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for fd in range(3, resource.getrlimit(resource.RLIMIT_NOFILE)[0]):
It's not very wise to use RLIMIT_NOFILE for this purpose. In real-world production servers this value may be as high as few tens of millions. In which case, daemonization will spam the system with useless syscalls and be delayed up to tens of seconds because of that.
It's not reasonable to attempt to close more that few thousands of descriptors. After all, daemonization, almost exclusively takes place immediately after the start of application. There's no way that a normal app is going to have this many open descriptors during that time.
The text was updated successfully, but these errors were encountered:
@miigotu As an option - definitely. But i would suggest adding an optional function parameter (callback) that should handle the closing, to override the built-in logic.
Moreover, the closing should definitely be handled by the child side of the post-fork pair. Imagine a scenario, when the pipe is created. One side (descriptor) belongs to a parent and the other side to the child (now daemon). Parent process can't close any of them before doing the fork. It's the child's responsibility to close the parent's side and vice versa. But both must do it post-fork.
Currently, at daemonize.py#L137:
for fd in range(3, resource.getrlimit(resource.RLIMIT_NOFILE)[0]):
It's not very wise to use
RLIMIT_NOFILE
for this purpose. In real-world production servers this value may be as high as few tens of millions. In which case, daemonization will spam the system with useless syscalls and be delayed up to tens of seconds because of that.It's not reasonable to attempt to close more that few thousands of descriptors. After all, daemonization, almost exclusively takes place immediately after the start of application. There's no way that a normal app is going to have this many open descriptors during that time.
The text was updated successfully, but these errors were encountered: