Skip to content

fix: Gracefully handle large number of paths returned by pip show - #193

Merged
varungandhi-src merged 1 commit into
scipfrom
vg/buf-size
Sep 1, 2025
Merged

varungandhi-src merged 1 commit into
scipfrom
vg/buf-size

Conversation

@varungandhi-src

Copy link
Copy Markdown
Contributor

execSync in NodeJS takes a maxBuffer argument; it will not dynamically allocate
the output. When doing pip show, we could run into an ENOBUFS error if the buffer
size was too small, as a part of path listing. This means there are two options:

  1. Use exec (or spawn): This requires CPS-ing the code all the way up to main.
  2. Use a bigger buffer.

We go with option 2 because it's not worth changing everything to callbacks
just for this. All the other I/O uses sync operations anyway.

For the bigger buffer case, we put in retry logic because that is 'free';
it doesn't make sense to provide a CLI flag for the user to customize this,
because what they'll do is look at the error and increase the value;
so we just do it for them.

Fixes #151

execSync in NodeJS takes a maxBuffer argument; it will not dynamically allocate
the output. When doing `pip show`, we could run into an ENOBUFS error if the buffer
size was too small, as a part of path listing. This means there are two options:

1. Use exec (or spawn): This requires CPS-ing the code all the way up to main.
2. Use a bigger buffer.

We go with option 2 because it's not worth changing everything to callbacks
just for this. All the other I/O uses sync operations anyway.

For the bigger buffer case, we put in retry logic because that is 'free';
it doesn't make sense to provide a CLI flag for the user to customize this,
because what they'll do is look at the error and increase the value;
so we just do it for them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant