Comments (18)
Okay, thanks, I'll try to reproduce this.
from falcon.
I'm encountering the same report from falcon, except my issue has to do with rdkafka
, rather than with pg
.
0.0s info: Falcon::Command::Serve [oid=0x85c] [ec=0x870] [pid=94063] [2024-05-16 23:49:44 +0800]
| Falcon v0.47.6 taking flight! Using Async::Container::Forked {:count=>12, :restart=>true}.
| - Binding to: #<Falcon::Endpoint https://localhost:9292/ {}>
| - To terminate: Ctrl-C or kill 94063
| - To reload configuration: kill -HUP 94063
0.04s info: Falcon::Service::Server [oid=0x8fc] [ec=0x870] [pid=94063] [2024-05-16 23:49:44 +0800]
| Starting server on #<Falcon::Endpoint https://localhost:9292/ {}>
objc[94074]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[94074]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
3.65s error: Async::Container::Forked [oid=0xaf0] [ec=0xb04] [pid=94063] [2024-05-16 23:49:47 +0800]
| pid 94074 SIGABRT (signal 6)
I am basically using https://github.com/socketry/roda-websockets/blob/main/examples/interactive_browser/config.ru, but adding this block within r.websocket
to create a consumer for kafka:
consumer = Rdkafka::Config.new(KAFKA_CONFIG).consumer
consumer.subscribe('test-topic')
consumer.each do |mesg|
p msg
end
And that's all it takes to get this error for Falcon. I wish I could resolve this easily myself... but I'm stuck
from falcon.
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:
- first up, I had to get the
PG.connect
parameters right (I thinkdbname: 'postgres'
is probably a better assumption for folks' setup thandbname: 'test'
?) - having not much experience with falcon (really I came to falcon by way of roda-websockets, as mentioned), it took a while for me to figure out that I should be doing
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 using rdkafka
with falcon):
0.0s info: Falcon::Command::Host [oid=0x7d0] [ec=0x7e4] [pid=73820] [2024-05-20 21:12:16 +0800]
| Falcon Host v0.47.6 taking flight!
| - Configuration: /Users/jf/PROJS/falcon/examples/pgfault/falcon.rb
| - To terminate: Ctrl-C or kill 73820
| - To reload: kill -HUP 73820
#<PG::Connection:0x000000012071d6a0 host=127.0.0.1 port=5432 user=postgres>
0.18s info: Falcon::Service::Server [oid=0xb90] [ec=0x7e4] [pid=73820] [2024-05-20 21:12:16 +0800]
| Starting hello.localhost on #<Falcon::ProxyEndpoint endpoint=#<IO::Endpoint::UNIXEndpoint "/Users/jf/PROJS/falcon/examples/pgfault/application.ipc">>
from falcon.
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
from falcon.
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.
from falcon.
Make sure the pg
gem is in the preload group. Can you share what your preload group contains?
from falcon.
Local core-lib gem has pg inside (also the main stack - rails, etc.), but I've also tried to install the fresh one...
from falcon.
By the way - I have my db inside docker container (only the app is running locally for this case), maybe this is a reason?!
from falcon.
Thank you!
from falcon.
For postgres related seg fault, sometimes following helps:
export PGGSSENCMODE="disable"
from falcon.
I'll take a look today.
from falcon.
Do you mind telling me what version of macOS you are using?
I was not able to reproduce the issue on:
> sw_vers
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224
from falcon.
I created a branch with an example, can either of you check if it fails on darwin22? I'm on darwin23.
https://github.com/socketry/falcon/tree/pg-segfault
from falcon.
I'm guessing I would be on darwin23 as well:
ProductName: macOS
ProductVersion: 14.3.1
BuildVersion: 23D60
from falcon.
export PGGSSENCMODE="disable"
It really helped , @schovi, much appreciated!
from falcon.
@jf are you either able to (1) upgrade the latest macOS to check if the issue goes away or (2) check the branch I gave and see if it reproduces the problem?
I'm also on a M1 MacBook Pro but I can't reproduce the issue.
from falcon.
sorry, to be clear, my issue is not with pg (I havent had to use that just yet). My issue is with using rdkafka with falcon (#225 (comment)
from falcon.
@jf try setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
this worked for me.
from falcon.
Related Issues (20)
- The problem with io-event update to 1.3.0 HOT 7
- Limiting incoming requests queue HOT 3
- Sinatra - cannot load such file -- sinatra/base HOT 2
- Concurrent Database Transaction worries HOT 2
- Getting a Errno::EPIPE: Broken pipe warning HOT 11
- Socket::ResolutionError: getnameinfo: Temporary failure in name resolution HOT 10
- Should the 'virtual' command be changing the Console.logger log level? HOT 4
- Plugin `:tmp_restart` HOT 2
- Production ready? HOT 1
- How to install? HOT 4
- Falcon 0.44 broken when used with Rack 2 HOT 7
- Falcon no longer respects count, new likely increases memory usage on shared hosts HOT 8
- Core methods doesn't work in configuration block after upgrading Falcon to 0.44 HOT 1
- async-io still in use HOT 3
- `falcon proxy` prints an exception if no `paths` are given
- Sure! Here's what we're trying to do. This is a bit simplified, but the issue with Rack vs. Rails responses still applies. HOT 4
- Cleartext HTTP/2 connections HOT 6
- LocalJumpError after migration to 0.45.1 HOT 3
- pause/resume for tasks HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from falcon.