Skip to content

3.1.1 started breaking with getpid or cache_classes #664

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

Closed
thebravoman opened this issue Dec 14, 2021 · 12 comments
Closed

3.1.1 started breaking with getpid or cache_classes #664

thebravoman opened this issue Dec 14, 2021 · 12 comments

Comments

@thebravoman
Copy link

thebravoman commented Dec 14, 2021

On December 01 we've update to Spring 3.1.1

-    spring (3.1.0)
+    spring (3.1.1)

Since then one of two errors occur when we try to run the platform on the CI machine

It is this:

/usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/server.rb:84:in `getpgid': No such process (Errno::ESRCH)
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/server.rb:84:in `set_pgid'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/server.rb:39:in `boot'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/server.rb:14:in `boot'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/client/server.rb:10:in `call'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/client/command.rb:7:in `call'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/client.rb:30:in `run'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/bin/spring:49:in `<main>'

or this:

warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.9-compliant syntax, but you are running 2.6.5.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
/usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.1/lib/spring/application.rb:101:in `block in preload': Spring reloads, and therefore needs the application to have reloading enabled.
Please, set config.cache_classes to false in config/environments/production.rb.
 (RuntimeError)
	from /usr/local/rvm/gems/ruby-2.6.5/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'

This happen when we execute

RAILS_ENV=production rails s -d && kill -SIGTERM `cat tmp/pids/server.pid`

We need the last step of the process just to make sure the platform could start and we've not made a stupid configuration error in some of the production config files which has happened before

@thebravoman
Copy link
Author

Downgraded to 3.1.0 - did not fix the issue

/usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/lib/spring/server.rb:84:in `getpgid': No such process (Errno::ESRCH)
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/lib/spring/server.rb:84:in `set_pgid'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/lib/spring/server.rb:39:in `boot'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/lib/spring/server.rb:14:in `boot'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/lib/spring/client/server.rb:10:in `call'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/lib/spring/client/command.rb:7:in `call'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/lib/spring/client.rb:30:in `run'
	from /usr/local/rvm/gems/ruby-2.6.5/gems/spring-3.1.0/bin/spring:49:in `<main>'

@thebravoman thebravoman changed the title 3.1.1 started braking with getpid or cache_classes 3.1.1 started breaking with getpid or cache_classes Dec 14, 2021
@rafaelfranca
Copy link
Member

The cache_classes error is legitmate. Your need to fix it. Either you should disable cache classes, or disable spring in production. After you fix that, does the getpgid error still happens?

@thebravoman
Copy link
Author

I guess it is a legitimate error. It surprised me that it started occurring about 2 weeks ago and it was not an issue for 3-4 years.

If I disable spring with DISABLE_SPRING=true then the error does not occur.

@rafaelfranca
Copy link
Member

The getpgid is not legitimate. The cache classes started since 24cc80e

@rafaelfranca
Copy link
Member

Does getpgid error still happens when you have cache_classes set to false in the test environment?

@thebravoman
Copy link
Author

Haven't seen in happen. Only in production.

@rafaelfranca
Copy link
Member

Why is spring being used in production?

@thebravoman
Copy link
Author

thebravoman commented Jan 20, 2022

Durring the years we've had cases where we make a change and an error In config/environments/production.rb

Tests and dev are passing and we only find out about the error when we deploy to production.

What we did then is as last step of the CI, before deploy, we start in production env as a way to check that there are no errors in the config.

We start and then kill the process

RAILS_ENV=production rails s -d && kill -SIGTERM `cat tmp/pids/

@rafaelfranca
Copy link
Member

Ah, got it. Maybe you should disable spring in that command as well, or you will need to disable cache_classes.

DISABLE_SPRING=1 RAILS_ENV=production rails s -d && kill -SIGTERM `cat tmp/pids/

@thebravoman
Copy link
Author

Yes this is exactly what I did In comment #664 (comment)

But I only found out about the env variable after creating the issue

@rafaelfranca
Copy link
Member

Got it. I'm closing this issue since the fix is to either change cache_classes or disable spring. Thanks

@thebravoman
Copy link
Author

Thanks. I think that's fair

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