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

systemd Socket activation: EOPNOTSUPP #1241

Closed
renchap opened this issue Mar 12, 2017 · 9 comments
Closed

systemd Socket activation: EOPNOTSUPP #1241

renchap opened this issue Mar 12, 2017 · 9 comments

Comments

@renchap
Copy link

renchap commented Mar 12, 2017

Steps to reproduce

[Unit]
Description=Puma application server for App
Requires=puma-app.socket
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
ExecStart=/usr/local/rbenv/shims/bundle exec --keep-file-descriptors puma -b unix:///home/app/www/shared/tmp/sockets/puma.sock -C config/puma.rb -e production -S /home/app/www/shared/tmp/pids/puma.state --dir /home/app/www/current
Type=simple
User=app
SyslogIdentifier=puma-app
WorkingDirectory=/home/app/www/current
Environment="PUMA_DEBUG=1"
Restart=always
  • start the service

Expected behavior

Puma runs and activate the socket pre-created by systemd. Works fine with Puma 3.7.1 (worked before, works again when changing the version in out bundle).

Actual behavior

% Registered unix:/home/app/www/shared/tmp/sockets/puma.sock for activation from LISTEN_FDS
Puma starting in single mode...
* Version 3.8.1 (ruby 2.4.0-p0), codename: Sassy Salamander
* Min threads: 5, max threads: 5
* Environment: production
* Activated unix:///home/app/www/shared/tmp/sockets/puma.sock
Use Ctrl-C to stop
2017-03-12 15:04:30 +0000: Read error: #<Errno::EOPNOTSUPP: Operation not supported - getsockopt(2)>
/home/app/www/shared/bundle/ruby/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:124:in `getsockopt'
/home/app/www/shared/bundle/ruby/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:124:in `closed_socket?'
/home/app/www/shared/bundle/ruby/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:563:in `handle_request'
/home/app/www/shared/bundle/ruby/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:425:in `process_client'
/home/app/www/shared/bundle/ruby/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:289:in `block in run'
/home/app/www/shared/bundle/ruby/2.4.0/gems/puma-3.8.1/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

System configuration

Ruby version: 2.4.0
Rails version: 5.1-master
Puma version: 3.8.1

@nateberkopec
Copy link
Member

Are you running on Windows a la #1240 ?

@renchap
Copy link
Author

renchap commented Mar 12, 2017

No, this is a Debian Jessie. Nothing special done on it except upgrading Puma from 3.7.1 (working fine) to 3.8.1.

@corny
Copy link

corny commented Mar 12, 2017

I have the same issue on Ubuntu 16.04 with Ruby 2.3.1p112.

@rromanchuk
Copy link

rromanchuk commented Mar 14, 2017

when deploying after updating, haven't done any real investigation yet. Ubuntu 16.04.2 LTS

:  2017-03-14 01:05:09 +0000: Read error: #<Errno::EOPNOTSUPP: Operation not supported - getsockopt(2)>
Mar 13 18:05:09  puma:  /var/www/[redact]//shared/bundle/ruby/2.3.0/gems/puma-3.8.1/lib/puma/server.rb:124:in `getsockopt'
Mar 13 18:05:09  puma:  /var/www/[redact]//shared/bundle/ruby/2.3.0/gems/puma-3.8.1/lib/puma/server.rb:124:in `closed_socket?'
Mar 13 18:05:09 puma:  /var/www/[redact]//shared/bundle/ruby/2.3.0/gems/puma-3.8.1/lib/puma/server.rb:563:in `handle_request'
Mar 13 18:05:09  puma:  /var/www/[redact]//shared/bundle/ruby/2.3.0/gems/puma-3.8.1/lib/puma/server.rb:425:in `process_client'
Mar 13 18:05:09  puma:  /var/www/[redact]//shared/bundle/ruby/2.3.0/gems/puma-3.8.1/lib/puma/server.rb:289:in `block in run'
Mar 13 18:05:09  puma:  /var/www/[redact]/shared/bundle/ruby/2.3.0/gems/puma-3.8.1/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

@kassiansun
Copy link

seems related to this commit: baccf80#diff-ef4c610f0ce605eb90f2810856394fd5

@nateberkopec
Copy link
Member

It looks like sockopts vary between distros then. We should at least rescue a failure here, though finding a more cross-distro way to deal with this would be ideal.

@nateberkopec
Copy link
Member

paging @sirupsen

@evanphx
Copy link
Member

evanphx commented Mar 14, 2017

That code should only be being run on linux..... Weird that some linuxes (linuxi?) don't support it...

Basically we'd need to rescue any error seen by this and disable it for the process. I'll go ahead and make that change since this is a breaking issue.

@sirupsen
Copy link
Contributor

Wow, that's very unexpected. Thanks @evanphx for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants