falcon icon indicating copy to clipboard operation
falcon copied to clipboard

Falcon not working properly locally on MacOS (m1) in forked mode

Open k1r8r0wn opened this issue 4 months ago • 17 comments

Hello!

When I run be falcon host & make a simple health check request I got this in .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/pg-1.5.4/lib/pg/connection.rb:690:

Снимок экрана 2024-03-01 в 19 30 05

And then have a server restart.

When I use be falcon serve -b http:/localhost:3000, get this endless forked loop:

Снимок экрана 2024-03-01 в 19 34 31

be falcon serve -b --threaded http:/localhost:3000 works fine. No problems inside Docker even with forked mode.

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
falcon (0.42.3)

Any thoughts, suggestions? How to correctly run the forked mode in MacOS (m1)?

Much appreciated in advance!

k1r8r0wn avatar Mar 01 '24 16:03 k1r8r0wn

This can happen with some native extensions which load Objective-C. If you share the full backtrace we might be able to identify it.

Otherwise, for the sake of potentially avoiding this problem and definitely avoiding memory usage, try adding all your core gems to the preload group:

# gems.rb or Gemfile:

group :preload do
  # e.g.
  gem 'rails'
end

ioquatix avatar Mar 01 '24 22:03 ioquatix

Thanks, @ioquatix for the quick reply! I've attached the example of the full trace. trace.txt

Also tried to use group :preload - didn't help.

k1r8r0wn avatar Mar 02 '24 00:03 k1r8r0wn

Make sure the pg gem is in the preload group. Can you share what your preload group contains?

ioquatix avatar Mar 02 '24 00:03 ioquatix

Local core-lib gem has pg inside (also the main stack - rails, etc.), but I've also tried to install the fresh one...

Снимок экрана 2024-03-02 в 03 38 13

k1r8r0wn avatar Mar 02 '24 00:03 k1r8r0wn

By the way - I have my db inside docker container (only the app is running locally for this case), maybe this is a reason?!

k1r8r0wn avatar Mar 02 '24 00:03 k1r8r0wn

Okay, thanks, I'll try to reproduce this.

ioquatix avatar Mar 02 '24 03:03 ioquatix

Thank you!

k1r8r0wn avatar Mar 02 '24 09:03 k1r8r0wn

For postgres related seg fault, sometimes following helps:

export PGGSSENCMODE="disable"

schovi avatar Apr 16 '24 06:04 schovi