-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Do not reuse global worker pool for files #84
Conversation
de1f855
to
4066656
Compare
if (\defined("AMP_WORKER")) { // Prevent spawning infinite workers. | ||
return new BlockingFilesystemDriver; | ||
} | ||
|
||
return new ParallelFilesystemDriver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we prevent infinite ParallelFilesystemDriver instances now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't, so tasks can use async file access. @azjezz mentioned this was an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But inside the worker we'll spawn another worker now and so on and never actually handle filesystem calls, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No no, FileTask which handles file system calls will use the blocking driver for the call. If the worker executes a user task, then another pool of workers might be spawned. I don't see infinite workers being likely (unless someone executes a Task within a Task, but that would be strange), but each worker having its own set of workers would be a possibility. Since by default we limit the number of workers to 8, the resource usage should still be within reason even on systems without eio or uv.
cd68fe8
to
dbb8ac1
Compare
This modifies the parallel driver to create its own internal pool by default, rather than reuse the global worker pool. A specific pool can still be passed to the constructor (though I assume this use is rather rare).
The
AMP_WORKER
constant is no longer used to prevent the blocking driver from being used. This way, aTask
may still use async file access and get the behavior expected./cc @azjezz