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

bin/dev crashes on new app #166

Closed
diegomichel opened this issue Aug 24, 2023 · 3 comments
Closed

bin/dev crashes on new app #166

diegomichel opened this issue Aug 24, 2023 · 3 comments

Comments

@diegomichel
Copy link

diegomichel commented Aug 24, 2023

On Mac when using the bin/dev script the web server crashes, here are the logs. Please excuse me if this is not the correct gem to report this :).

~/github/pmt (4-testing-tools ✗) bin/dev
00:06:49 web.1  | started with pid 45581
00:06:49 js.1   | started with pid 45582
00:06:49 css.1  | started with pid 45583
00:06:49 js.1   | yarn run v1.22.15
00:06:49 css.1  | yarn run v1.22.15
00:06:49 js.1   | $ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --watch
00:06:49 css.1  | $ tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify --watch
00:06:50 js.1   | [watch] build finished, watching for changes...
00:06:50 web.1  | DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/kv/16w8qw0d0dxg1nnm0lc34glc0000gn/T/ruby-debug-sock-501/ruby-debug-diegomichelrubioramirez-45584)
00:06:50 web.1  | #<Thread:0x000000010d938240@DEBUGGER__::Server::reader /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/server.rb:44 run> terminated with exception (report_on_exception is true):
00:06:50 web.1  | /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1116:in `unix': too long unix socket path (109 bytes given but 104 bytes max) (ArgumentError)
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1116:in `unix_server_socket'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1164:in `unix_server_loop'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/server.rb:500:in `accept'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/server.rb:49:in `block in activate'
00:06:50 web.1  | #<Thread:0x000000010d938010@DEBUGGER__::SESSION@server /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/session.rb:179 aborting> terminated with exception (report_on_exception is true):
00:06:50 web.1  | /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1116:in `unix': too long unix socket path (109 bytes given but 104 bytes max) (ArgumentError)
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1116:in `unix_server_socket'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1164:in `unix_server_loop'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/server.rb:500:in `accept'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/server.rb:49:in `block in activate'
00:06:50 web.1  | /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1116:in `unix': too long unix socket path (109 bytes given but 104 bytes max) (ArgumentError)
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1116:in `unix_server_socket'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:1164:in `unix_server_loop'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/server.rb:500:in `accept'
00:06:50 web.1  |       from /Users/diegomichelrubioramirez/.rvm/gems/ruby-3.1.2/gems/debug-1.8.0/lib/debug/server.rb:49:in `block in activate'
00:06:50 web.1  | exited with code 1
00:06:50 system | sending SIGTERM to all processes
00:06:50 css.1  | exited with code 1
00:06:50 js.1   | exited with code 1

Looks like env command on Procfile.dev might be causing the issue, probably an env var?

changing env RUBY_DEBUG_OPEN=true bin/rails server to just env bin/rails server fixes the issue 🤔 .

@phantomwhale
Copy link

phantomwhale commented Aug 28, 2023

I've been hitting a similar issue:

my-app-1 | 05:50:27 web.1  |   Rendered text template (Duration: 0.0ms | Allocations: 24)
my-app-1 | 05:50:27 web.1  | Completed 200 OK in 452ms (Views: 4.8ms | ActiveRecord: 2.8ms | Allocations: 28169)
my-app-1 | 05:50:27 web.1  |
my-app-1 | 05:50:27 web.1  |
my-app-1 | 05:50:27 web.1  | Started GET "/assets/fonts/Graphik-Medium-aeec9e6cbb82ed00c2bf827ef56ac0099bb39112.woff2" for 172.18.0.1 at 2023-08-28 05:50:27 +0000
my-app-1 | 05:50:27        | exited with code 0
my-app-1 | 05:50:27 system | sending SIGTERM to all processes
my-app-1 | 05:50:27 web.1  | [8] === puma shutdown: 2023-08-28 05:50:27 +0000 ===
my-app-1 | 05:50:27 web.1  | [8] - Goodbye!
my-app-1 | 05:50:27 web.1  | [8] - Gracefully shutting down workers...
my-app-1 | 05:50:27 js.1   | exited with code 1
my-app-1 | 05:50:27 web.1  | Not notifying due to an invalid api_key
my-app-1 | 05:50:27 css.1  | exited with code 1
my-app-1 | 05:50:27 web.1  | terminated by SIGTERM
my-app-1 exited with code 0

The exited with code 0 doesn't appear to be any of the sub-processes (as it has no name?) - but it seems to send the SIGTERM killer to all the running processes.

I'm running inside a docker container (with tty: true set) and have removed the ruby debug env var, but it still crashes.

I'm still using webpack, and note that it seems to take 30-40 seconds to build the assets every time I start up (which isn't ideal) - I wonder if that long build time causes something to be unresponsive and causes foreman to be marked for death? I have noted that if "left alone" after starting up, the process seems to no longer crash after 1-2 requests, whereas queueing up 2-3 requests whilst webpack is compiling seems to correlate with the server serving up one page, and then dying.

Nothing crashes when I run all my Procfile tasks in separate containers

@matt17r
Copy link

matt17r commented Nov 1, 2023

This is happening to me too... macOS Sonoma 14.1, Ruby 3.2.2 and Rails 7.1.1. No docker.

Like the OP, it seems to be caused by env RUBY_DEBUG_OPEN=true in Procfile.dev. If I remove that environment variable it starts up fine.

Reproducible on any new app that uses Foreman. For example:

rails new debug_test --javascript esbuild

@matt17r
Copy link

matt17r commented Nov 1, 2023

Figured it out @diegomichel. It's because we have long computer usernames. Ruby debug generates a socket name that is too long. Yours is 24 characters (diegomichelrubioramirez) and mine is 23 (matthewlindfieldseager). Suggest you close this issue and plus one the issue there.

@phantomwhale, your issue looks different. Ours was crashing at Rails startup, yours is crashing during the app lifecycle.

@dhh dhh closed this as completed Jan 5, 2024
gabeodess added a commit to gabeodess/jumpstart that referenced this issue Apr 28, 2024
The flag causes errors on socket name length when the current username is over a certain number of characters: rails/jsbundling-rails#166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants