1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/lib/puma/plugin
eileencodes bebdf266e5 Only write if file doesn't exist
Before this fix if you have an application that uses Puma and this
plugin it is impossible to start 2 servers at once even if they are
using separate pidfiles and ports. The reason is because this plugin
will overwrite the pidfiles no matter.

To reproduce:

Start a regular Rails server which points to the pidfile in
`tmp/pids/server.pid`

```
rails s
```

Start a second Rails server which points to a new pidfile and port

```
rails s -p 4000 -P tmp/pids/new_server.pid
```

The first server will be stopped and claim that the pid is being used by
another process.

What really is happening is the restart plugin is writing over the
original pidfile which stops the server.

If we check the file exists first this will prevent the problem from
occuring. Touching tmp/restart.txt will still work but starting a
separate process with it's own pidfile should not interfere with other
running servers in the same app.
2017-03-09 15:19:50 -05:00
..
tmp_restart.rb Only write if file doesn't exist 2017-03-09 15:19:50 -05:00