Issue #16283 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Third Party's Issue

This looks like the Mac OS getaddrinfo bug. See the part of the C-level backtrace before the crash:

```
/usr/lib/system/libsystem_platform.dylib(_sigtramp+0x1d) [0x7fff7cbf8b5d]
/usr/lib/system/libsystem_trace.dylib(_os_log_preferences_refresh+0x4c) [0x7fff7cc1b90a]
/usr/lib/system/libsystem_trace.dylib(0x7fff7cc1c13d) [0x7fff7cc1c13d]
/usr/lib/system/libsystem_info.dylib(si_destination_compare_rfc6724+0x97e) [0x7fff7cb2fbee]
/usr/lib/system/libsystem_info.dylib(0x7fff7cb2d1f9) [0x7fff7cb2d1f9]
/usr/lib/system/libsystem_info.dylib(0x7fff7cb2cd3f) [0x7fff7cb2cd3f]
/usr/lib/system/libsystem_info.dylib(0x7fff7cb0b6df) [0x7fff7cb0b6df]
/usr/lib/system/libsystem_c.dylib(_isort+0xc1) [0x7fff7cab5e5b]
/usr/lib/system/libsystem_c.dylib(0x7fff7cab5d88) [0x7fff7cab5d88]
/usr/lib/system/libsystem_info.dylib(0x7fff7cb02f2d) [0x7fff7cb02f2d]
/usr/lib/system/libsystem_info.dylib(0x7fff7cb01885) [0x7fff7cb01885]
/usr/lib/system/libsystem_info.dylib(0x7fff7cb00f77) [0x7fff7cb00f77]
/usr/lib/system/libsystem_info.dylib(0x7fff7cb00e7d) [0x7fff7cb00e7d]
/Users/k-omoto/.rbenv/versions/2.6.3/lib/ruby/2.6.0/x86_64-darwin18/socket.bundle(nogvl_getaddrinfo+0xb5) [0x1048ea295]
```

Many variations of this bug have been reported, see all the bugs linked in #13646.  As this crash happens inside a Mac OS system library, there doesn't appear to be anything Ruby can do to fix it.

----------------------------------------
Bug #16283: A fork in transaction of PG cause Segmentation fault
https://bugs.ruby-lang.org/issues/16283#change-82369

* Author: doloopwhile / gmail.com ( )
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Call Kernel#fork in transaction of Postgres and call some Socket method in fork's block, then ruby on the child process abort with segmentation fault.

Conceptual code:

```
MGModel.connection.transaction do

  # Do something

  fork do
    Socket.gethostbyname('localhost') # <- Segmentation fault.
  end
end
```

Expected behavior: The child process successfully exists or raises exception.

Please see attached files for Reproduction code and full error log.


---Files--------------------------------
bug.zip (1.51 KB)
stderr.txt (97.3 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>