Here's something I spent a long time debugging, so I'm making this gist to help others find the solution when searching.
postgres 12 on MacOS will cause crashes when forking. The solution is to do one of these two things:
- add
gssencmode: "disable"
to database.yml - if using homebrew: uninstall postgres, update homebrew, reinstall postgres
Here's some discussion:
- ged/ruby-pg#311
- https://stackoverflow.com/questions/59560085/how-can-i-solve-ruby-on-rails-segmentation-fault-on-macos-catalina
- jaraco/keyring#281 (comment)
- Homebrew/homebrew-core#47494
- macos
- ruby on rails
- web server like puma or unicorn configured to fork
- postgres 12 installed by homebrew or macports (homebrew has now been fixed)
you'll see this at the top:
/Users/john/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/listen-3.2.1/lib/listen/record/entry.rb:53: [BUG] Segmentation fault at 0x0000000000000110
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
This at the bottom:
[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.
And this in ~/Library/Logs/DiagnosticReports
Process: ruby [2193]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: 0
Code Type: X86-64 (Native)
Parent Process: ruby [2128]
Responsible: iTerm2 [717]
User ID: 502
Date/Time: 2020-04-28 22:44:44.737 -0400
OS Version: Mac OS X 10.15.4 (19E287)
Report Version: 12
Anonymous UUID: C0DC3E8B-79F0-D22B-DEB4-7E21ED4CF508
Time Awake Since Boot: 170 seconds
System Integrity Protection: enabled
Crashed Thread: 5 thread_pool.rb* Dispatch queue: com.apple.security.keychain-cache-queue
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000110
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0x110:
-->
__TEXT 0000000108e77000-0000000108e78000 [ 4K] r-x/r-x SM=COW /Users/USER/*
Application Specific Information:
*** multi-threaded process forked ***
crashed on child side of fork pre-exec
probably the most interesting line is:
Crashed Thread: 5 thread_pool.rb* Dispatch queue: com.apple.security.keychain-cache-queue