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

fix: prevent new workers from writing to closed pool #95

Merged

Conversation

AriPerkkio
Copy link
Member

@AriPerkkio AriPerkkio commented May 22, 2024

@AriPerkkio AriPerkkio force-pushed the fix/process-workers-closing-pool branch from cb7ce9f to 3f11d7b Compare May 22, 2024 15:26
@AriPerkkio AriPerkkio force-pushed the fix/process-workers-closing-pool branch from 3f11d7b to 5796e7a Compare May 22, 2024 15:28
Comment on lines +42 to +51
send!(
<OutgoingMessage>{
ready: true,
source: 'pool',
__tinypool_worker_message__: true,
},
() => {
// Ignore errors coming from closed channel
}
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another approach is to check process.channel here. Though now new Error: write EPIPE errors come up randomly when pool is closing. 🤔

@AriPerkkio AriPerkkio marked this pull request as ready for review June 1, 2024 05:22
@AriPerkkio AriPerkkio merged commit 0e870ad into tinylibs:main Jun 1, 2024
6 checks passed
@AriPerkkio AriPerkkio deleted the fix/process-workers-closing-pool branch June 1, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERR_IPC_CHANNEL_CLOSED: Channel closed
1 participant