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

spring doubles the env size, sometimes causing "Argument list too long" error #626

Open
michaelglass opened this issue Oct 6, 2020 · 1 comment

Comments

@michaelglass
Copy link

michaelglass commented Oct 6, 2020

Spring is great! You are great!

When spring spawns new processes, it passes in a copy of the original spring env, SPRING_ORIGINAL_ENV as an environmental variable.

"SPRING_ORIGINAL_ENV" => JSON.dump(Spring::ORIGINAL_ENV),

If the environment size is greater than half of ARG_MAX, the spring server, as well as other processes will spawn without spring but fail with spring because of an Argument list too long error.

Potential solutions:

  • have specific environmental variables to watch rather than everything
  • pass SPRING_ORIGINAL_ENV via a tempfile rather than another environmental variable
  • fail gracefully / loudly if SPRING_ORIGINAL_ENV > 1/2 ARG_MAX (perhaps suggesting user increases ulimit) (ARG_MAX is hard-coded in OS X)
@jeremy
Copy link
Member

jeremy commented Oct 6, 2020

have specific environmental variables to watch rather than everything

The idea is to be agnostic to the existing environment, so everything Just Works from Spring users' point of view.

Some additional possibilities to pursue:

  • Spawned processes inherit the environment by default, so perhaps passing the original env is not strictly necessary. If we can deduce the original env from the inherited env.
  • Process.spawn can wipe the environment as well, with the unsetenv_others: true option. That'd limit env size. Not sure about support in older Ruby versions.
  • Spring::ApplicationManager and Spring::Application could pass the original environment over their UNIX socket pair after the process is spawned, sidestepping the environment entirely.

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

No branches or pull requests

2 participants