Issue #9525 has been updated by Yui NARUSE.

Status changed from Feedback to Third Party's Issue

gdb says __check_pf is guilty.
https://gist.github.com/sonots/9047653#file-gistfile3-txt

    (gdb) bt
    #0  0x00000032f2ce659d in recvmsg () from /lib64/libc.so.6
    #1  0x00000032f2d0c2c5 in make_request () from /lib64/libc.so.6
    #2  0x00000032f2d0c6fa in __check_pf () from /lib64/libc.so.6
    #3  0x00000032f2ccfb47 in getaddrinfo () from /lib64/libc.so.6
    #4  0x00007fb3139d3818 in nogvl_getaddrinfo (arg=<value optimized out>) at raddrinfo.c:161
    #5  0x00000000004f600c in rb_thread_blocking_region (func=0x7fb3139d3800 <nogvl_getaddrinfo>, data1=0x7fb0d5dd0140, ubf=<value optimized out>, data2=<value optimized out>) at thread.c:1129
    #6  0x00007fb3139d2eaf in rb_getaddrinfo (node=<value optimized out>, service=<value optimized out>, hints=<value optimized out>, res=<value optimized out>) at raddrinfo.c:181
    #7  0x00007fb3139d2fcb in rsock_getaddrinfo (host=<value optimized out>, port=22017, hints=0x7fb0d5dd0600, socktype_hack=1) at raddrinfo.c:359
    #8  0x00007fb3139d37ed in rsock_addrinfo (host=0, port=140397479001552, socktype=<value optimized out>, flags=659) at raddrinfo.c:379
    #9  0x00007fb3139c939a in sock_s_pack_sockaddr_in (self=<value optimized out>, port=140397479001552, host=35158400) at socket.c:1307

By glibc's commits, once __check_pf is always called [6f3914d5a3269c00e70506bd95f816fef6b635ce](https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=6f3914d5a3269c00e70506bd95f816fef6b635ce)
(it is fixed at [fa3fc0fe5f452d0aa7e435d8f32e992958683819](https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=fa3fc0fe5f452d0aa7e435d8f32e992958683819))

The difference between akr's and sonots' seems because of this.

Therefore this is glibc's old bug and RHEL/CentOS's backport issue.

----------------------------------------
Bug #9525: Stuck with Socket.pack_sockaddr_in
https://bugs.ruby-lang.org/issues/9525#change-45226

* Author: Naotoshi Seo
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: 1.9.3p194
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
We met this trouble with Fluentd https://github.com/fluent/fluentd. 

Fluentd is sometimes stuck at `Socket.pack_sockaddr_in` line on shutdown. 
Here is the gist https://gist.github.com/sonots/9047653 to explain details. 





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