Skip to content

Commit a74d7f6

Browse files
committed
Add example to try and reproduce failure.
1 parent d179982 commit a74d7f6

File tree

5 files changed

+150
-0
lines changed

5 files changed

+150
-0
lines changed

examples/pgfault/config.ru

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
require "rdkafka"
4+
5+
run do |env|
6+
[200, {"content-type" => "text/plain"}, ["Hello, World!"]]
7+
end

examples/pgfault/falcon.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
require "falcon/environment/rack"
4+
5+
service "hello.localhost" do
6+
include Falcon::Environment::Rack
7+
end

examples/pgfault/gems.locked

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
async (2.23.1)
5+
console (~> 1.29)
6+
fiber-annotation
7+
io-event (~> 1.9)
8+
metrics (~> 0.12)
9+
traces (~> 0.15)
10+
async-container (0.24.0)
11+
async (~> 2.22)
12+
async-container-supervisor (0.5.1)
13+
async-container (~> 0.22)
14+
async-service
15+
io-endpoint
16+
memory-leak (~> 0.5)
17+
async-http (0.88.0)
18+
async (>= 2.10.2)
19+
async-pool (~> 0.9)
20+
io-endpoint (~> 0.14)
21+
io-stream (~> 0.6)
22+
metrics (~> 0.12)
23+
protocol-http (~> 0.49)
24+
protocol-http1 (~> 0.30)
25+
protocol-http2 (~> 0.22)
26+
traces (~> 0.10)
27+
async-http-cache (0.4.5)
28+
async-http (~> 0.56)
29+
async-pool (0.10.3)
30+
async (>= 1.25)
31+
async-service (0.13.0)
32+
async
33+
async-container (~> 0.16)
34+
console (1.30.2)
35+
fiber-annotation
36+
fiber-local (~> 1.1)
37+
json
38+
falcon (0.51.1)
39+
async
40+
async-container (~> 0.20)
41+
async-container-supervisor (~> 0.5.0)
42+
async-http (~> 0.75)
43+
async-http-cache (~> 0.4)
44+
async-service (~> 0.10)
45+
bundler
46+
localhost (~> 1.1)
47+
openssl (~> 3.0)
48+
protocol-http (~> 0.31)
49+
protocol-rack (~> 0.7)
50+
samovar (~> 2.3)
51+
ffi (1.17.2-arm64-darwin)
52+
fiber-annotation (0.2.0)
53+
fiber-local (1.1.0)
54+
fiber-storage
55+
fiber-storage (1.0.1)
56+
io-endpoint (0.15.2)
57+
io-event (1.10.0)
58+
io-stream (0.6.1)
59+
json (2.11.3)
60+
localhost (1.5.0)
61+
mapping (1.1.3)
62+
memory-leak (0.5.2)
63+
metrics (0.12.2)
64+
mini_portile2 (2.8.8)
65+
openssl (3.3.0)
66+
protocol-hpack (1.5.1)
67+
protocol-http (0.49.0)
68+
protocol-http1 (0.34.0)
69+
protocol-http (~> 0.22)
70+
protocol-http2 (0.22.1)
71+
protocol-hpack (~> 1.4)
72+
protocol-http (~> 0.47)
73+
protocol-rack (0.11.2)
74+
protocol-http (~> 0.43)
75+
rack (>= 1.0)
76+
rack (3.1.13)
77+
rake (13.2.1)
78+
rdkafka (0.21.0)
79+
ffi (~> 1.15)
80+
mini_portile2 (~> 2.6)
81+
rake (> 12)
82+
samovar (2.3.0)
83+
console (~> 1.0)
84+
mapping (~> 1.0)
85+
traces (0.15.2)
86+
87+
PLATFORMS
88+
arm64-darwin
89+
90+
DEPENDENCIES
91+
falcon
92+
rdkafka (~> 0.21.0)
93+
94+
BUNDLED WITH
95+
2.6.7

examples/pgfault/gems.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
gem "falcon"
6+
7+
group :preload do
8+
gem 'rdkafka', '~> 0.21.0'
9+
end

examples/pgfault/readme.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Objective-C Segfault
2+
3+
On macOS, some usage of the Objective-C runtime can cause issues when forking. This is a known issue but is not specifically a bug in Falcon.
4+
5+
## Usage
6+
7+
### Run the server
8+
9+
```bash
10+
bundle exec falcon host
11+
```
12+
13+
It should start correctly with no errors.
14+
15+
Now, comment out the preload group:
16+
17+
``` ruby
18+
# group :preload do
19+
gem 'rdkafka', '~> 0.21.0'
20+
# end
21+
```
22+
23+
If you run the server again, it will fail:
24+
25+
```
26+
objc[9330]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
27+
objc[9330]: +[__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.
28+
2.33s error: Async::Container::Forked [oid=0xa00] [ec=0xc30] [pid=8967] [2025-04-27 11:15:58 +0900]
29+
| {
30+
| "status": "pid 9330 SIGABRT (signal 6)"
31+
| }
32+
```

0 commit comments

Comments
 (0)