puma / puma-dev

A tool to manage rack apps in development with puma
BSD 3-Clause "New" or "Revised" License
1.74k stars 107 forks source link

Multiple hostname support no longer working #280

Closed packagethief closed 3 years ago

packagethief commented 3 years ago

https://github.com/puma/puma-dev/pull/101 added support for sharing a single app instance with multiple hostnames by pointing symlinks to the same app. As of version 0.15.2, this is no longer working.

It looks like puma-dev tries to bind to alternative hostnames to same socket as the already running app:

! Booting app 'bc3' on socket /Users/jeff/.puma-dev/bc3/tmp/puma-dev-9798.sock
bc3[20138]: Puma starting in single mode...
bc3[20138]: * Puma version: 5.3.2 (ruby 2.7.2-p137) ("Sweetnighter")
bc3[20138]: *  Min threads: 0
bc3[20138]: *  Max threads: 5
bc3[20138]: *  Environment: development
bc3[20138]: *          PID: 20138
bc3[20138]: * Listening on unix:/Users/jeff/.puma-dev/bc3/tmp/puma-dev-9798.sock
bc3[20138]: Use Ctrl-C to stop
! App 'bc3' booted

! Booting app 'bc3-091a2a85' on socket /Users/jeff/.puma-dev/bc3-cdn/tmp/puma-dev-9798.sock
! App 'bc3-091a2a85' booted
bc3-091a2a85[20511]: Puma starting in single mode...
bc3-091a2a85[20511]: * Puma version: 5.3.2 (ruby 2.7.2-p137) ("Sweetnighter")
bc3-091a2a85[20511]: *  Min threads: 0
bc3-091a2a85[20511]: *  Max threads: 5
bc3-091a2a85[20511]: *  Environment: development
bc3-091a2a85[20511]: *          PID: 20511

bc3-091a2a85[20511]: RuntimeError: There is already a server bound to: /Users/jeff/.puma-dev/bc3-cdn/tmp/puma-dev-9798.sock
! Killing 'bc3-091a2a85' (20511) - 'stdout/stderr closed'
* App 'bc3-091a2a85' shutdown and cleaned up

I haven't tried to bisect, but I suspect this changed in https://github.com/puma/puma-dev/pull/270.

nonrational commented 3 years ago

Yeah, I'm seeing a similar error after 3c14306782993227da5a2f48d4a1a50afc4d4912.

Definitely a bug somewhere.

FWIW, it does appear to be short-lived. Given an app aliased as abc.puma and xyz.puma, after requesting abc.puma/ then xyz.puma/ then abc.puma/ then xyz.puma/, both respond correctly. 🙃