Skip to content

minfds is not be set as the soft RLIMIT_NOFILE when system soft RLIMIT_NOFILE greater than minds #690

@xiezhenye

Description

@xiezhenye

in options.py 1392:1414
ServerOptions.set_rlimits

    for limit in limits:

        min = limit['min']
        res = limit['resource']
        msg = limit['msg']
        name = limit['name']
        name = name # name is used below by locals()

        soft, hard = resource.getrlimit(res)

        if (soft < min) and (soft != -1): # -1 means unlimited
            if (hard < min) and (hard != -1):
                # setrlimit should increase the hard limit if we are
                # root, if not then setrlimit raises and we print usage
                hard = min

            try:
                resource.setrlimit(res, (min, hard))
                msgs.append('Increased %(name)s limit to %(min)s' %
                            locals())
            except (resource.error, ValueError):
                self.usage(msg % locals())
    return msgs

line 1402: if (soft < min) and (soft != -1): should not be present.

minfds is used to cleanup opened fd in Subprocess._prepare_child_fds. if system soft RLIMIT_NOFILE is greater than minds, some fd will not be closed properly, so minfds should always be set as the soft RLIMIT_NOFILE of the supervisors process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions