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

touch tmp/restart.txt always leads to connection refused #59

Closed
paulca opened this issue Aug 10, 2016 · 33 comments · Fixed by #274
Closed

touch tmp/restart.txt always leads to connection refused #59

paulca opened this issue Aug 10, 2016 · 33 comments · Fixed by #274
Assignees
Labels

Comments

@paulca
Copy link
Contributor

paulca commented Aug 10, 2016

I haven't been able to use touch/tmp/restart.txt with the latest release...

Here's what happens in the logs:

! App 'billing.tito' booted
! Killing 'billing.tito' (24599)
2016/08/10 12:13:08 http: proxy error: dial unix /Users/paulcampbell/.puma-dev/billing.tito/tmp/puma-dev-24598.sock: connect: connection refused

In the browser, the viewport just goes blank white.

unload/reload via launchctl works and is fast enough for me for now.

@evanphx evanphx added the bug label Aug 10, 2016
@evanphx
Copy link
Member

evanphx commented Aug 12, 2016

@paulca What is happening in the browser when you're restarting? touching tmp/restart.txt seems to work fine in a trivial rack app.

@paulca
Copy link
Contributor Author

paulca commented Aug 16, 2016

@evanphx It just goes white (Chrome anyway). Super weird. I did just try it there and it did eventually restart after coming back to the computer after a while.

@evanphx
Copy link
Member

evanphx commented Aug 17, 2016

@paulca That's odd. Would you be available to a screensharing session sometime so that I could see it in action?

@paulca
Copy link
Contributor Author

paulca commented Aug 17, 2016

Yep. It still seems to be happening with 0.9. Almost brand new Rails 5 apps.

On Wed, Aug 17, 2016 at 1:00 AM Evan Phoenix notifications@github.com
wrote:

@paulca https://github.com/paulca That's odd. Would you be available to
a screensharing session sometime so that I could see it in action?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#59 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAEzboFGSwgvHYQJbnUnEsJkOg2_Kd6ks5qgk8ngaJpZM4JhCSQ
.

@paulca
Copy link
Contributor Author

paulca commented Aug 17, 2016

(can do on screensharing)

@firedev
Copy link

firedev commented Sep 2, 2016

I am using touch tmp/restart.txt && rm tmp/restart.txt it's a bit wonky but it works.

@tamalw
Copy link

tamalw commented Sep 22, 2016

I can replicate this issue.

App is working fine:

$ curl -I myapp.dev
HTTP/1.1 200 OK
…

I restart puma with $ touch tmp/restart.txt

~/Library/Logs/puma-dev.log says ! Killing 'myapp' (8593)

Then I try to hit my app again:

$ curl -I myapp.dev
HTTP/1.1 500 Internal Server Error
Date: Thu, 22 Sep 2016 01:25:15 GMT
Content-Type: text/plain; charset=utf-8

And the logs only state 2016/09/21 20:25:15 http: proxy error: dial unix /Users/myuser/.puma-dev/myapp/tmp/puma-dev-863.sock: connect: connection refused

I then run $ rm tmp/restart.txt according to @firedev and the logs state:

! Killing 'myapp' (8593)
* App 'myapp' shutdown and cleaned up

Then the app restarts as expected. The difference appears to be that the app never "shuts down and cleans up" when it's touched. Only when tmp/restart.txt is removed.

EDIT:

More debugging info from $ curl -H "Host: puma-dev" localhost/events:

touch results in:

{"time":"2016-09-21 20:36:19.608299854 -0500 CDT","event":"killing_app","app":"myapp","pid":8737,"reason":"restart.txt touched"}

Whereas rm results in:

{"time":"2016-09-21 20:36:48.526124566 -0500 CDT","event":"killing_app","app":"myapp","pid":8737,"reason":"detected interval shutdown"}
{"time":"2016-09-21 20:36:48.526288004 -0500 CDT","event":"shutdown","app":"myapp"}

@jmay
Copy link

jmay commented Oct 15, 2016

I just experienced this for the first time. I wonder if it's some sort of timestamp issue with the restart.txt file? I had not done a touch tmp/restart.txt in many days, maybe weeks. Deleting the file works, touch does not.

@pitops
Copy link

pitops commented Oct 21, 2016

I can confirm that touch tmp/restart.txt is not working. rm tmp/restart.txt works though.

@johnksawers
Copy link

This is still happening, both the bug and the workaround.

@brunowego
Copy link

Thanks @firedev, your way works.

@attilagyorffy
Copy link
Contributor

I am having the same issue. @evanphx we can screenshare if that helps. my go-fu is limited but am keen to learn to be able to help out.

@drosboro
Copy link

I am seeing exactly the same issue, and can confirm that the @firedev's workaround is working as expected.

@colorfulfool
Copy link

colorfulfool commented Oct 21, 2017

I was using puma-dev happily, until couple weeks ago, when I started getting this bug.

I think it started right after upgrade from El Capitan to High Sierra — this might be a clue.

@codybrouwers
Copy link

I experienced the same issue on High Sierra with a Rails 5 app, and the above fix of rm the tmp restart file didn't help, what did help was running puma-dev in debug mode for a moment with puma-dev -debug. Not sure why that helped but it does seem like it could be a High Sierra issue.

@mitio
Copy link

mitio commented Jan 16, 2018

What also worked for me was doing a puma-dev -stop to make it shut down all apps. The next attempt to access the app booted it properly.

@colorfulfool
Copy link

colorfulfool commented Feb 7, 2018

I just want to report that I'm no longer having this issue on High Sierra. Was fixed by one of puma-dev updates, I guess.

@alistairholt
Copy link

alistairholt commented Feb 23, 2018

I'm still experiencing this issue with puma-dev version: 0.11 (go1.9.1) – installed via homebrew. macOS 10.13.3.

@bjensen
Copy link

bjensen commented Aug 7, 2018

I get the same error and in the logs shows 10x:

2018/08/07 09:30:05 http: proxy error: dial unix /Users/xx/.puma-dev/nordplaner/tmp/puma-dev-82192.sock: connect: connection refused

When I do a ls /Users/xx/.puma-dev/nordplaner/tmp/puma-dev-82192.sock the file is gone

I started puma-dev like this:
sudo puma-dev --http-port 81 --https-port 443 -d dev:test:localhost

@attilagyorffy
Copy link
Contributor

What I have personally seen so far is that hitting an app (via an HTTP request for example) straight after touch tmp/restart.txt results in a connection refused error.. If I wait a few more seconds, then everything is fine. I wonder whether that's related to the size of the app I'm trying to run. It may take a while for the Rails app to start listening, puma-dev then fails to route the requests to it until it's ready.

@evanphx
Copy link
Member

evanphx commented Aug 21, 2018

Please reopen this if it's still an issue!

@evanphx evanphx closed this as completed Aug 21, 2018
@bjensen
Copy link

bjensen commented Aug 21, 2018

This is still an issue: Way to reproduce:

sudo puma-dev --http-port 81 --https-port 443 -d dev:test:localhost

Wait 30 minutes..and you get the connection refused:

http: proxy error: dial unix /Users/xx/.puma-dev/planer/tmp/puma-dev-82192.sock: connect: connection refused

@yemartin
Copy link

@evanphx Can you please reopen this? It is definitely still happening with the latest version (v0.12) on High Sierra (10.13.6). I am also seeing the "proxy error" when using touch, and a clean shutdown when using rm. Excerpts from my logs:

  1. when I do touch tmp/restart.txt, I consistently get:
! Killing 'myapp.mydomain' (81963)
2018/08/30 14:40:06 http: proxy error: EOF

then when I try to hit the app again, I get the "connection refused" error:

2018/08/30 14:58:18 http: proxy error: dial unix /Users/yemartin/.puma-dev/myapp.mydomain/tmp/puma-dev-83651.sock: connect: connection refused
  1. In comparison, when I do rm tmp/restart.txt (no need to do a touch first):
! Killing 'myapp.mydomain' (84658)
* App 'myapp.mydomain' shutdown and cleaned up

and then the app reboots properly.

Notice how when using rm, the app shutdown gracefully, but with touch, it looks like some sort of error is triggered, puma-dev fails to shutdown the app properly and ends up in a broken state.

In case it helps:

$ puma-dev -V
Version: v0.12 (go1.10.2)

@nonrational
Copy link
Member

@yemartin @bjensen are you able to try to reproduce with the latest master @ 338eacc ? i've been unable to reproduce on a number of ruby and puma versions on macOS 10.14.6.

see steps i used to attempt to reproduce here: #175 (comment)

@nonrational
Copy link
Member

Please try to reproduce with the latest v0.13 and see if you're still seeing an issue. I believe updates to vendored dependencies addressed this.

@uson1x
Copy link

uson1x commented Feb 12, 2021

Unfortunately, just happened on puma-dev Version: 0.14 (go1.14.3) for me (installed via brew on macOS 10.15.7)

@nonrational
Copy link
Member

nonrational commented Feb 14, 2021

@uson1x Could you please try updating to 0.15.2?

If that doesn't fix the issue, please provide the output of puma-dev -V; sw_vers; ruby -v; puma --version; rails --version. Thanks.

@elsurudo
Copy link

elsurudo commented Mar 19, 2021

I am still having this issue, and none of the above workarounds are working. Output from above:

Version: 0.15.2 (go1.15.3)
ProductName: macOS
ProductVersion: 11.2.3
BuildVersion: 20D91
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
puma version 5.1.1
Rails 6.0.3

@nonrational
Copy link
Member

A while ago, I had a patch up to ensure we remove apps from the pool correctly, but I wasn't able to reliably reproduce the issue.

I will post a build with that patch for testing this week.

@nonrational nonrational reopened this Mar 22, 2021
@nonrational nonrational self-assigned this Mar 22, 2021
@elsurudo
Copy link

As a follow-up, the only way I can get puma working again after this happens is like so:

launchctl stop io.puma.dev
launchctl start io.puma.dev

@nonrational
Copy link
Member

That's consistent with my understanding of the issue. puma-dev thinks the app is still running and will refuse to boot a new copy. Here's the previous patch I referred to: https://github.com/puma/puma-dev/pull/175/files.

@nonrational
Copy link
Member

@aelkoussy
Copy link

aelkoussy commented Oct 17, 2022

Just fyi, this issue is still happening till now unfortunately...

http: proxy error: dial unix /Users/username/.puma-dev/project_folder/tmp/puma-dev-RandomNumber.sock: connect: connection refused
After loading the app and while everything is running, when navigating to a different page or when I refresh the page, I get the above error, it happens randomly.

This doesn't happen if I am using normal Puma instead of Puma-dev

The hack above (#59 (comment)) seems to work, showing( app "app_name" shutdown and cleaned up)

puma-dev -V
Version: 0.18.2 (go1.17.6)

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

Successfully merging a pull request may close this issue.