Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to not create 64 threads when booting vapor. #3003

Closed
John-Connolly opened this issue Apr 21, 2023 · 3 comments
Closed

Ability to not create 64 threads when booting vapor. #3003

John-Connolly opened this issue Apr 21, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@John-Connolly
Copy link
Contributor

Describe the bug

On iOS platforms the default threadpool size of 64 is a bit aggressive. Sometimes iOS will not want to create that many threads leading to a crash in ThreadOpsPosix.run (ThreadPosix.swift:109). Even when swapping the NIOThreadPool to one with only one thread doesn't prevent the default one from creating 64 threads.

To Reproduce

Boot a vapor app.

Steps to reproduce the behavior:
n/a this is the default behaviour.

Expected behavior

app.threadPool = NIOThreadPool(numberOfThreads: 1) should replace the default threadpool before it's started.

Environment

  • Vapor Framework version: 4.76.0
  • Vapor Toolbox version: N/A
  • OS version: N/A

Additional context

I'm happy to provide a patch for this.

@John-Connolly John-Connolly added the bug Something isn't working label Apr 21, 2023
@0xTim
Copy link
Member

0xTim commented Apr 24, 2023

Yes this seems sensible and has come up in the past - happy to accept a patch for this change in behaviour

@dfed
Copy link
Contributor

dfed commented Oct 24, 2023

Adding a +1 to this. When deploying Vapor on iOS we're creating way too many threads. Would love to be able to cap this in the initializer.

@gwynne
Copy link
Member

gwynne commented Nov 7, 2023

Addressed by #3092 and the preexisting ability to replace the default thread pool.

@gwynne gwynne closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants