falcon: Falcon not working properly locally on MacOS (m1) in forked mode
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:
And then have a server restart.
When I use be falcon serve -b http:/localhost:3000, get this endless forked loop:
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!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (8 by maintainers)
@jf try setting
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YESthis worked for me.Hey, karafka author here: https://karafka.io/docs/Forking/#forking-issues-on-macos
macos dynlibs need to be loaded pre-fork. No option to bypass this securely. Also no karafka components (including raw rdkafka usage) can be done pre-fork.
one suggestion if I may: you want to make it as easy as possible for folks to run your sample code.
It took a while for me to try to run the example:
PG.connectparameters right (I thinkdbname: 'postgres'is probably a better assumption for folks’ setup thandbname: 'test'?)falcon host /path/to/example/pgfault/falcon.rb(as opposed to simplyruby /path/to/...)It does not look like I have any issue with
pg(but again, my issue is usingrdkafkawith falcon):I’m encountering the same report from falcon, except my issue has to do with
rdkafka, rather than withpg.I am basically using https://github.com/socketry/roda-websockets/blob/main/examples/interactive_browser/config.ru, but adding this block within
r.websocketto create a consumer for kafka:And that’s all it takes to get this error for Falcon. I wish I could resolve this easily myself… but I’m stuck
Okay, thanks, I’ll try to reproduce this.