bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.16k stars 112 forks source link

2.0.0 Fails to kill servers if no aux.pid #916

Open MaxLap opened 2 months ago

MaxLap commented 2 months ago

So I'm trying to upgrade from 1.3.4 to 2.0.0.beta2 (and then to the latest commit on github) do see if I encounter issues.

I have an error during boot (uninitialized constant Bridgetown::Rack::Roda, but I haven't investigated that yet), but that error triggers #kill_processes. However, because this is my first start in 2.0.0, and the error isvery early, there are no tmp/aux.pid file created yet. This causes the following exception:

[Bridgetown]   Exception raised: Errno::ENOENT
[Bridgetown] No such file or directory @ rb_sysopen - /home/max/projects/documold/docs/bridgetown/tmp/pids/aux.pid
[Bridgetown]                  1: /home/max/.rvm/gems/ruby-3.3.5/bundler/gems/bridgetown-3ec30e28aac3/bridgetown-foundation/lib/bridgetown/foundation/packages/pid_tracker.rb:15:in `readlines'
[Bridgetown]                  2: /home/max/.rvm/gems/ruby-3.3.5/bundler/gems/bridgetown-3ec30e28aac3/bridgetown-foundation/lib/bridgetown/foundation/packages/pid_tracker.rb:15:in `read_pidfile'
[Bridgetown]                  3: /home/max/.rvm/gems/ruby-3.3.5/bundler/gems/bridgetown-3ec30e28aac3/bridgetown-core/lib/bridgetown-core/utils/aux.rb:51:in `kill_processes'
[Bridgetown]                  4: /home/max/.rvm/gems/ruby-3.3.5/bundler/gems/bridgetown-3ec30e28aac3/bridgetown-core/lib/bridgetown-core/commands/start.rb:104:in `block (2 levels) in start'
[Bridgetown]                  5: /home/max/.rvm/gems/ruby-3.3.5/bundler/gems/bridgetown-3ec30e28aac3/bridgetown-core/lib/bridgetown-core/commands/start.rb:11:in `ensure in start'

I solved that error by manually creating the file tmp/pids/aux.pid, which lets me see the actual error causing trouble (uninitialized constant Bridgetown::Rack::Roda, which I will investigate and create a distinct issue for if needed). In any case, this error hides an actual problem, so I would suggest having a rescue or a exist check somewhere to return an empty Array.

KonnorRogers commented 2 months ago

I hit this error as well and fixing the uninitialized constant should fix this error.

https://github.com/bridgetownrb/bridgetown/pull/910