Skip to content

fix: introduce lock around deno info calls to fix OOM (#50) #61

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lbsal
Copy link

@lbsal lbsal commented Apr 14, 2025

This fix builds on the insight in #55 but does so by performing the minimal change required to fix the underlying issue. The reason for this departure from #55 is due to our project's build failing when executed using the proof of concept's plugin, presumably due to some unknown change introduced on part of the proof of concept's extensive revision.

The fix reuses @notcome's lock component and threads said lock through the codebase to ultimately place it around the deno info --json ${id} calls.

When building our project using this patch of the plugin, my CPU utilization never goes about ~30% and the memory usage stays more or less constant. This is compare to before, where CPU utilization hit 100% and I ran out of memory and my system froze.

Fixes #50 and closes masslbs/Tennessine#330


For reviewers:

  • I license the changes I've introduced under the same license as deno-vite-plugin itself i.e. MIT; @notcome could you let me know whether you license my usage of your Lock class under MIT as well?
  • I'm open to introducing a semaphore to allow for a configurable degree of parallelism. In that case I would import https://www.npmjs.com/package/async-mutex and use its semaphore implementation.

This fix builds on the insight in denoland#55 but does so by performing the
minimal change required to fix the underlying issue. The reason for this
departure from denoland#55 is due to our project's build failing when executed
using the proof of concept's plugin, presumably due to some unknown
change introduced on part of the proof of concept's extensive revision.

The fix reuses @notcome's lock component and threads said lock through
the codebase to ultimately place it around the `deno info --json ${id}`
calls.
@lbsal
Copy link
Author

lbsal commented Apr 22, 2025

ping @marvinhagemeister: any thoughts on this fix for the plugin to enable its use by bounding the concurrency of deno info calls without eating all RAM on machines with ~16GB & less?

Happy to iterate and make changes!

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.

vite build causes OOMs due to spawning deno info with unbounded concurrency. Get a handle on vite+deno memory overhead
1 participant