Bug 657489 - Assertion failure in sysdeps/posix/getaddrinfo.c:1464: rfc3484_sort (socket binding crashes python)
Summary: Assertion failure in sysdeps/posix/getaddrinfo.c:1464: rfc3484_sort (socket b...
Keywords:
Status: CLOSED DUPLICATE of bug 739743
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 14
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Andreas Schwab
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 665844 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-26 09:18 UTC by Onyeibo Oku
Modified: 2016-11-24 16:09 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-26 07:35:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Onyeibo Oku 2010-11-26 09:18:33 UTC
Description of problem:
sock.bind((host.port) crashes python3 and python2.7

Version-Release number of selected component (if applicable):
Python 3.1.2

How reproducible:
Certain (100%)

Steps to Reproduce:
1.Run Python Console
2.Type the following Code

import socket 
s = socket.socket()
host = socket.gethostname()
port = 12345
s.bind((host, port))
  
Actual results:
python: ../sysdeps/posix/getaddrinfo.c:1464: rfc3484_sort: Assertion `src->results[i].native == -1 || src->results[i].native == a1_native' failed.
Aborted (core dumped)

Expected results:


Additional info:

Comment 1 Toshio Ernie Kuratomi 2010-11-26 17:56:54 UTC
I'm unable to reproduce this using a not-uptodate F14 for either python or python3.  Updating to see if the behaviour changes

Comment 2 Toshio Ernie Kuratomi 2010-11-27 04:17:10 UTC
Still cannot duplicate.  Versions I'm testing with:

rpm -q python python3 glibc

python-2.7-8.fc14.1.i686
python3-3.1.2-14.fc14.i686
glibc-2.12.90-19.i686

One possibility is that this is x86_64 specific.  Finding a machine to test there.

Comment 3 Toshio Ernie Kuratomi 2010-11-27 06:42:31 UTC
Can't replicate on x86_64 either:

% rpm -q python python3 glibc
python-2.7-8.fc14.1.x86_64
python3-3.1.2-14.fc14.x86_64
glibc-2.12.90-19.x86_64

Comment 4 Toshio Ernie Kuratomi 2010-11-27 06:43:46 UTC
What's socket.gethostname() returning for you?  Maybe there's some value of host that causes socket.bind() to fail in that way.

Comment 5 Onyeibo Oku 2010-11-27 09:00:45 UTC
socket.gethostname() returns the host name ... 'dellprime' which is the hostname of this machine. 

However, its embarrassing that I can no longer replicate the crash.  I suspect a syntax error, maybe a faulty spacing between operators, tuples etc. OR something to do with running python after waking from hibernation. I just don't get it. It happened thrice!

Comment 6 Dave Malcolm 2010-11-29 16:49:30 UTC
Thanks for filing this bug report.

What version of glibc do you have installed?

The assertion failure is happening inside glibc:
  1459                /* Fill in the results in all the records.  */
  1460                for (int i = 0; i < src->nresults; ++i)
  1461                  if (src->results[i].index == a1_index)
  1462                    {
  1463                      assert (src->results[i].native == -1
>>1464                              || src->results[i].native == a1_native);
  1465                      src->results[i].native = a1_native;
  1466                    }
  1467                  else if (src->results[i].index == a2_index)
  1468                    {
  1469                      assert (src->results[i].native == -1
  1470                              || src->results[i].native == a2_native);
  1471                      src->results[i].native = a2_native;
  1472                    }

Reassigning component to "glibc"

Comment 7 Onyeibo Oku 2010-11-29 18:44:58 UTC
glibc.i686                                                                  2.12.90-19                                                                 
glibc.x86_64                                                                 2.12.90-19                                                                 @updates (fedora repo)

Comment 8 Onyeibo Oku 2010-12-03 14:54:47 UTC
Okay, its started again.  Appears to do with socket.gethostname() returning a string of the short hostname. Passing an IPv4 address as string e.g. socket.bind(('10.10.10.45', port)) works fine.

Comment 9 Dave Malcolm 2010-12-03 16:19:01 UTC
If you're able to reliably reproduce this, it may help the glibc experts debug this if we have a symbolic backtrace (e.g. using gdb).  In order to get a symbolic stack trace, the appropriate debuginfo packages need to be installed. In order to accomplish this, you can run the command:

   debuginfo-install glibc python3

Please see http://fedoraproject.org/wiki/StackTraces for more information about stack traces.

Once this is done, you can run python3 under gdb like this:

  $ gdb --args python3 ARGS_OF_PYTHON3
  (gdb) run

and when it crashes, type:
  (gdb) t a a bt

to get a backtrace.

Hope this helps.

Comment 10 Andreas Schwab 2010-12-09 09:43:29 UTC
(gdb) p src.results[0]@src.nresults

Comment 11 Onyeibo Oku 2010-12-15 22:00:41 UTC
Finally, I got a backtrace, Here:

Missing separate debuginfo for 
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/bb/59d9741d29c8d4ef59c5aa92df45b808bb0eb9 /var/cache/abrt-di/usr/lib/debug/.build-id/bb/59d9741d29c8d4ef59c5aa92df45b808bb0eb9
[New Thread 8501]
Core was generated by `python3 netrender_server.py'.
Program terminated with signal 6, Aborted.
#0  0x0000003032634085 in raise () from /lib64/libc-2.12.90.so

Thread 1 (Thread 8501):
#0  0x0000003032634085 in raise () from /lib64/libc-2.12.90.so
No symbol table info available.
#1  0x0000003032635a36 in abort () from /lib64/libc-2.12.90.so
No symbol table info available.
#2  0x000000303262c8c5 in __assert_fail () from /lib64/libc-2.12.90.so
No symbol table info available.
#3  0x00000030326cf6dc in rfc3484_sort () from /lib64/libc-2.12.90.so
No symbol table info available.
#4  0x000000303263652b in msort_with_tmp () from /lib64/libc-2.12.90.so
No symbol table info available.
#5  0x0000003032636398 in msort_with_tmp () from /lib64/libc-2.12.90.so
No symbol table info available.
#6  0x0000003032636cb0 in qsort_r () from /lib64/libc-2.12.90.so
No symbol table info available.
#7  0x00000030326cff2d in getaddrinfo () from /lib64/libc-2.12.90.so
No symbol table info available.
#8  0x00007fca31833416 in setipaddr (name=0x23cf7e0 "dellprime", addr_ret=0x7fffda6a60d0, addr_ret_size=16, af=<value optimized out>) at /usr/src/debug/Python-3.1.2/Modules/socketmodule.c:835
        _save = 0x222e410
        hints = {ai_flags = 0, ai_family = 2, ai_socktype = 0, ai_protocol = 0, ai_addrlen = 0, ai_addr = 0x0, ai_canonname = 0x0, ai_next = 0x0}
        res = <value optimized out>
        error = <value optimized out>
        d1 = 36705480
        d2 = 62
        d3 = 1876788384
        d4 = 62
        ch = 0 '\000'
#9  0x00007fca318347aa in getsockaddrarg (s=0x23014c8, args=<value optimized out>, addr_ret=0x7fffda6a60d0, len_ret=0x7fffda6a60cc) at /usr/src/debug/Python-3.1.2/Modules/socketmodule.c:1225
        addr = 0x7fffda6a60d0
        host = 0x23cf7e0 "dellprime"
        port = <value optimized out>
        result = <value optimized out>
#10 0x00007fca31834bde in sock_bind (s=0x23014c8, addro=<value optimized out>) at /usr/src/debug/Python-3.1.2/Modules/socketmodule.c:1828
        addrbuf = {in = {sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0}, sin_zero = "\000\000\000\000\000\000\000"}, un = {sun_family = 0, sun_path = '\000' <repeats 14 times>, "081\002", '\000' <repeats 12 times>, "081\002\000\000\000\000`\301\061\002\000\000\000\000\200\330H\002\000\000\000\000\020\344\"\002\000\000\000\000\310;:\002\000\000\000\000\334w\247\061\312\177\000\000\200\330H\002\000\000\000\000L\370\247o>\000\000\000`\301\061\002\000\000\000\000\312w\247\061\312\177"}, nl = {nl_family = 0, nl_pad = 0, nl_pid = 0, nl_groups = 0}, in6 = {sin6_family = 0, sin6_port = 0, sin6_flowinfo = 0, sin6_addr = {__in6_u = {__u6_addr8 = "\000\000\000\000\000\000\000\000\060\070\061\002\000\000\000", __u6_addr16 = {0, 0, 0, 0, 14384, 561, 0, 0}, __u6_addr32 = {0, 0, 36780080, 0}}}, sin6_scope_id = 0}, storage = {ss_family = 0, __ss_align = 0, __ss_padding = "081\002", '\000' <repeats 12 times>, "081\002\000\000\000\000`\301\061\002\000\000\000\000\200\330H\002\000\000\000\000\020\344\"\002\000\000\000\000\310;:\002\000\000\000\000\334w\247\061\312\177\000\000\200\330H\002\000\000\000\000L\370\247o>\000\000\000`\301\061\002\000\000\000\000\312w\247\061\312\177\000\000Z\000\000\000\000\000\000\000\070\375G\002\000\000\000"}, ll = {sll_family = 0, sll_protocol = 0, sll_ifindex = 0, sll_hatype = 0, sll_pkttype = 0 '\000', sll_halen = 0 '\000', sll_addr = "\000\000\000\000\060\070\061\002"}}
        addrlen = <value optimized out>
        res = <value optimized out>
#11 0x0000003e6fad8093 in call_function (f=<value optimized out>, throwflag=<value optimized out>) at /usr/src/debug/Python-3.1.2/Python/ceval.c:3822
        arg = (u'dellprime', 7777L)
        meth = <value optimized out>
        self = <value optimized out>
        flags = <value optimized out>
        tstate = <value optimized out>
        func = <built-in method bind of socket object at remote 0x23014c8>
        w = <value optimized out>
        na = 1
        nk = <value optimized out>
        n = <value optimized out>
        pfunc = 0x247fd28
        x = <value optimized out>
#12 PyEval_EvalFrameEx (f=<value optimized out>, throwflag=<value optimized out>) at /usr/src/debug/Python-3.1.2/Python/ceval.c:2618
        sp = 0x247fd30
        stack_pointer = <value optimized out>
        next_instr = 0x7fca31a777e2 "\001e\003"
        opcode = <value optimized out>
        oparg = <value optimized out>
        why = WHY_NOT
        err = 0
        x = <value optimized out>
        v = <value optimized out>
        w = <value optimized out>
        u = <value optimized out>
        fastlocals = <value optimized out>
        freevars = 0x247fd28
        retval = 0x0
        tstate = 0x222e410
        co = 0x23522b0
        instr_ub = -1
        instr_lb = 0
        instr_prev = -1
        first_instr = 0x7fca31a777a0 "d"
        names = (u'socket', u'AF_INET', u'SOCK_STREAM', u'serversock', u'PORT', u'bind', u'gethostname', u'listen', u'accept', u'clientsock', u'clientaddr', u'recv', u'clientdata', u'bytes', u'decode', u'clientSTATUS', u'print', u'close')
        consts = (0L, None, 7777L, 5L, 1024L, u'Server is going down')
#13 0x0000003e6fad9714 in PyEval_EvalCodeEx (co=0x23522b0, globals=<value optimized out>, locals=<value optimized out>, args=<value optimized out>, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at /usr/src/debug/Python-3.1.2/Python/ceval.c:3270
        f = <value optimized out>
        retval = 0x0
        fastlocals = <value optimized out>
        freevars = 0x247fd28
        tstate = 0x222e410
        x = <value optimized out>
        u = <value optimized out>
#14 0x0000003e6fad97fb in PyEval_EvalCode (co=<value optimized out>, globals=<value optimized out>, locals=<value optimized out>) at /usr/src/debug/Python-3.1.2/Python/ceval.c:672
No locals.
#15 0x0000003e6faf6a4c in run_mod (mod=<value optimized out>, filename=<value optimized out>, globals={u'socket': <module at remote 0x22f9680>, u'__builtins__': <module at remote 0x7fca31a61518>, u'__file__': u'netrender_server.py', u'__package__': None, u'PORT': 7777L, u'serversock': <socket at remote 0x23014c8>, u'__name__': u'__main__', u'__doc__': None}, locals={u'socket': <module at remote 0x22f9680>, u'__builtins__': <module at remote 0x7fca31a61518>, u'__file__': u'netrender_server.py', u'__package__': None, u'PORT': 7777L, u'serversock': <socket at remote 0x23014c8>, u'__name__': u'__main__', u'__doc__': None}, flags=<value optimized out>, arena=<value optimized out>) at /usr/src/debug/Python-3.1.2/Python/pythonrun.c:1701
        co = 0x23522b0
        v = <value optimized out>
#16 0x0000003e6faf86a8 in PyRun_FileExFlags (fp=0x241d1c0, filename=0x248d830 "netrender_server.py", start=<value optimized out>, globals={u'socket': <module at remote 0x22f9680>, u'__builtins__': <module at remote 0x7fca31a61518>, u'__file__': u'netrender_server.py', u'__package__': None, u'PORT': 7777L, u'serversock': <socket at remote 0x23014c8>, u'__name__': u'__main__', u'__doc__': None}, locals={u'socket': <module at remote 0x22f9680>, u'__builtins__': <module at remote 0x7fca31a61518>, u'__file__': u'netrender_server.py', u'__package__': None, u'PORT': 7777L, u'serversock': <socket at remote 0x23014c8>, u'__name__': u'__main__', u'__doc__': None}, closeit=1, flags=0x7fffda6a65f0) at /usr/src/debug/Python-3.1.2/Python/pythonrun.c:1658
        ret = <value optimized out>
        mod = 0x2466c88
        arena = 0x22bfe70
#17 0x0000003e6faf923f in PyRun_SimpleFileExFlags (fp=0x241d1c0, filename=0x248d830 "netrender_server.py", closeit=1, flags=0x7fffda6a65f0) at /usr/src/debug/Python-3.1.2/Python/pythonrun.c:1186
        m = <value optimized out>
        d = {u'socket': <module at remote 0x22f9680>, u'__builtins__': <module at remote 0x7fca31a61518>, u'__file__': u'netrender_server.py', u'__package__': None, u'PORT': 7777L, u'serversock': <socket at remote 0x23014c8>, u'__name__': u'__main__', u'__doc__': None}
        v = <value optimized out>
        ext = 0x248d83f "r.py"
        set_file_name = 1
        ret = <value optimized out>
        len = <value optimized out>
#18 0x0000003e6fb0a631 in Py_Main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/Python-3.1.2/Modules/main.c:598
        filenameObj = u'netrender_server.py'
        p_cfilename = <value optimized out>
        c = <value optimized out>
        sts = <value optimized out>
        command = 0x0
        filename = 0x222e260 L"netrender_server.py"
        module = 0x0
        fp = 0x241d1c0
        p = <value optimized out>
        skipfirstline = 0
        stdin_is_interactive = 1
        help = <value optimized out>
        version = <value optimized out>
        saw_unbuffered_flag = 35840608
        cf = {cf_flags = 0}
#19 0x0000000000400be9 in main (argc=2, argv=0x7fffda6a87a8) at /usr/src/debug/Python-3.1.2/Modules/python.c:152
        argv_copy = 0x222d010
        argv_copy2 = 0x222d030
        i = 2
        res = <value optimized out>
        oldloc = 0x222d050 "en_US.utf8"
From                To                  Syms Read   Shared Object Library
0x0000003e6fa41400  0x0000003e6fb325a8  Yes         /usr/lib64/libpython3.1.so.1.0
0x0000003032a05680  0x0000003032a11048  Yes         /lib64/libpthread-2.12.90.so
0x0000003032e00de0  0x0000003032e01988  Yes         /lib64/libdl-2.12.90.so
0x0000003e71600e10  0x0000003e71601788  Yes         /lib64/libutil-2.12.90.so
0x0000003033603ef0  0x00000030336447a8  Yes         /lib64/libm-2.12.90.so
0x000000303261eb60  0x000000303274a21c  Yes         /lib64/libc-2.12.90.so
0x0000003032200b20  0x0000003032219ac6  Yes         /lib64/ld-2.12.90.so
0x00007fca31832060  0x00007fca318376d8  Yes         /usr/lib64/python3.1/lib-dynload/_socketmodule.so
0x00007fca3159b1f0  0x00007fca3159d578  Yes         /usr/lib64/python3.1/lib-dynload/unicodedata.so
0x00007fca313917f0  0x00007fca31395128  Yes         /usr/lib64/python3.1/lib-dynload/arraymodule.so
0x00007fca311660d0  0x00007fca3116d358  Yes         /lib64/libnss_files-2.12.90.so
$1 = 0x23bd580 "python3: ../sysdeps/posix/getaddrinfo.c:1464: rfc3484_sort: Assertion `src->results[i].native == -1 || src->results[i].native == a1_native' failed.\n"
No symbol "__glib_assert_msg" in current context.
rax            0x0	0
rbx            0x7fffda6a99bc	140736857807292
rcx            0xffffffffffffffff	-1
rdx            0x6	6
rsi            0x2135	8501
rdi            0x2135	8501
rbp            0x30327602f4	0x30327602f4
rsp            0x7fffda6a5648	0x7fffda6a5648
r8             0x7fca37911720	140506492376864
r9             0x30327622d4	207005033172
r10            0x8	8
r11            0x206	518
r12            0x3032766608	207005050376
r13            0x3032761d78	207005031800
r14            0x30327602f4	207005025012
r15            0x5b8	1464
rip            0x3032634085	0x3032634085 <raise+53>
eflags         0x206	[ PF IF ]
cs             0x33	51
ss             0x2b	43
ds             0x0	0
es             0x0	0
fs             0x0	0
gs             0x0	0
Dump of assembler code for function raise:
   0x0000003032634050 <+0>:	mov    %fs:0x2d4,%eax
   0x0000003032634058 <+8>:	mov    %fs:0x2d0,%esi
   0x0000003032634060 <+16>:	test   %esi,%esi
   0x0000003032634062 <+18>:	jne    0x3032634090 <raise+64>
   0x0000003032634064 <+20>:	mov    $0xba,%eax
   0x0000003032634069 <+25>:	syscall 
   0x000000303263406b <+27>:	mov    %eax,%esi
   0x000000303263406d <+29>:	mov    %eax,%fs:0x2d0
   0x0000003032634075 <+37>:	movslq %edi,%rdx
   0x0000003032634078 <+40>:	movslq %esi,%rsi
   0x000000303263407b <+43>:	movslq %eax,%rdi
   0x000000303263407e <+46>:	mov    $0xea,%eax
   0x0000003032634083 <+51>:	syscall 
=> 0x0000003032634085 <+53>:	cmp    $0xfffffffffffff000,%rax
   0x000000303263408b <+59>:	ja     0x303263409f <raise+79>
   0x000000303263408d <+61>:	repz retq 
   0x000000303263408f <+63>:	nop
   0x0000003032634090 <+64>:	test   %eax,%eax
   0x0000003032634092 <+66>:	jg     0x3032634075 <raise+37>
   0x0000003032634094 <+68>:	test   $0x7fffffff,%eax
   0x0000003032634099 <+73>:	je     0x30326340b0 <raise+96>
   0x000000303263409b <+75>:	neg    %eax
   0x000000303263409d <+77>:	jmp    0x3032634075 <raise+37>
   0x000000303263409f <+79>:	mov    0x368efa(%rip),%rdx        # 0x303299cfa0
   0x00000030326340a6 <+86>:	neg    %eax
   0x00000030326340a8 <+88>:	mov    %eax,%fs:(%rdx)
   0x00000030326340ab <+91>:	or     $0xffffffffffffffff,%rax
   0x00000030326340af <+95>:	retq   
   0x00000030326340b0 <+96>:	mov    %esi,%eax
   0x00000030326340b2 <+98>:	jmp    0x3032634075 <raise+37>
End of assembler dump.

Comment 12 Andreas Schwab 2011-01-11 14:21:26 UTC
What is the contents of /etc/hosts?

Comment 13 Onyeibo Oku 2011-01-11 15:33:38 UTC
/etc/hosts:

82.128.116.174	dellprime	# Added by NetworkManager
127.0.0.1	localhost.localdomain	localhost
::1	dellprime	localhost6.localdomain6	localhost6
192.168.0.100	dellprime	dellprime.hotgroup.org	dellprime
192.168.0.101	dellsmall	dellsmall.hotgroup.org	miniprime
192.168.0.102	adapted
192.168.0.1	alphagray
192.168.0.2	beta
192.168.0.3	gamma
192.168.0.4	delta
192.168.0.5	epsilon
192.168.0.6	zeta
192.168.0.7	eta
192.168.0.200	bubbles-aspire5516
192.168.0.201	vostroprime
192.168.0.203	Hilary

Comment 14 Andreas Schwab 2011-01-11 16:27:45 UTC
*** Bug 665844 has been marked as a duplicate of this bug. ***

Comment 15 Andreas Schwab 2011-01-11 16:59:14 UTC
Output of "ip ad ad"?

Comment 16 Onyeibo Oku 2011-01-11 17:28:57 UTC
$ ip ad ad
Not enough information: "dev" argument is required.

Comment 17 Andreas Schwab 2011-01-12 09:45:27 UTC
Strike the last ad.

Comment 18 Onyeibo Oku 2011-01-12 20:57:08 UTC
$ ip ad

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 00:21:70:aa:3a:40 brd ff:ff:ff:ff:ff:ff
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DORMANT qlen 1000
    link/ether 00:22:5f:29:77:4f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::222:5fff:fe29:774f/64 scope link 
       valid_lft forever preferred_lft forever
4: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 3
    link/ppp 
    inet 10.80.166.63 peer 10.64.64.64/32 scope global ppp0

Comment 19 Andreas Schwab 2011-02-16 16:39:38 UTC
There is no network containing either 82.128.116.174 or 192.168.0.100.

Comment 20 Andreas Schwab 2011-09-26 07:35:01 UTC

*** This bug has been marked as a duplicate of bug 739743 ***


Note You need to log in before you can comment on or make changes to this bug.