Skip to content

Increase file descriptor limit in NativeAOT app process #82719

Closed

Description

@akoeplinger

CoreCLR and soon Mono (after #82429) call a function that will increase the maximum open file descriptors via a function like this, should NativeAOT do the same?

/*++
Function:
INIT_IncreaseDescriptorLimit [internal]
Abstract:
Calls setrlimit(2) to increase the maximum number of file descriptors
this process can open.

/cc @dotnet/ilc-contrib

Activity

  1. ghost added
    untriaged
    on Feb 27, 2023
  2. VSadov commented on Feb 27, 2023

    @VSadov
    Member

    It probably makes sense, just for parity purposes.
    I am curious - are there specific reasons for this in CoreCLR/Mono or is it "just in case"? Any interesting history for why the call was introduced?

  3. jkotas commented on Feb 27, 2023

    @jkotas
    Member

    FWIW, this is disabled on Alpine and nobody ever complained about it there:

    # Setting RLIMIT_NOFILE breaks debugging of coreclr on Alpine Linux for some reason
    add_definitions(-DDONT_SET_RLIMIT_NOFILE)

  4. akoeplinger commented on Feb 27, 2023

    @akoeplinger
    MemberAuthor

    I don't know about the historical context (the function was already part of the initial CoreCLR github commit) but we recently saw issues if this isn't done during NuGet restore: #82428

  5. VSadov commented on Feb 27, 2023

    @VSadov
    Member

    I remember there was a bug fix for when we could temporarily have too many fd's. I'll try finding details.

  6. VSadov commented on Feb 27, 2023

    @VSadov
    Member

    Maybe it was to compensate for #47859 ?
    (Assembly.Load opens /dev/zero in linux and does not close it)

    It was fixed in #48140

  7. VSadov commented on Feb 27, 2023

    @VSadov
    Member

    At the time of Rotor using /dev/zero for anonymous memory mapping was likely the "right" way.

  8. akoeplinger commented on Feb 27, 2023

    @akoeplinger
    MemberAuthor

    Given we're seeing #82428 when the limit is not increased I think it still makes sense to have it, though you could argue that with NativeAOT in library mode maybe the embedding application should have the final say.

  9. VSadov commented on Feb 27, 2023

    @VSadov
    Member

    The scenario with NuGet looks real. The app has a scenario that may open 1K+ files and gets away with that on CorCLR, making this a compat issue.

    I think we should increase the limit on NativeAOT and perhaps on Alpine too, unless the reason (debugging is broken) is still there.

  10. VSadov commented on Feb 27, 2023

    @VSadov
    Member

    NativeAOT in library mode maybe the embedding application should have the final say.

    No compat concerns in this case.
    It might be strange if library does this, especially if dynamically loaded.

  11. agocke commented on Feb 27, 2023

    @agocke
    Member

    It seems reasonable to match the CoreCLR behavior here.

  12. added this to the Future milestone on Feb 27, 2023
  13. removed
    untriaged
    on Feb 27, 2023
  14. changed the title [-]Investigate whether to increase file descriptor limit in NativeAOT process[/-] [+]Increase file descriptor limit in NativeAOT app process[/+] on Mar 1, 2023
  15. added a commit that references this issue on Aug 22, 2025
    08ad384
  16. added
    in-pr
    on Aug 22, 2025
  17. added a commit that references this issue on Aug 23, 2025
    556cd52
  18. locked and limited conversation to collaborators on Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrin-pr

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions