getdns-python-bindings
getdns-python-bindings copied to clipboard
SIGSEV and callback errors
Hi,
I noticed a few random crashes of the Python interpreter while using the GetDNS Python bindings. I've been able to reproduce the problem in Python 2.7 and 3.5 but with a different error.
I am using the latest library (c84ff93) and Python bindings (98f635f) on Ubuntu 14.04.
The issue happens infrequently while performing 'normal' lookups but I've been able to trigger it reliably with the attached script, which resolves 199.181.132.250 multiple times asynchronously. The odd bit about this IP is the number of PTR entries (500+), which might be triggering a race condition.
The crash doesn't happen every time - typically every other time.
1 Normal run, using 8.8.4.4 as the IP being resolved: 2016-10-25 21:18:02,312 INFO: submitting ip query: 8.8.4.4 2016-10-25 21:18:02,313 INFO: submitting ip query: 8.8.4.4 2016-10-25 21:18:02,313 INFO: submitting ip query: 8.8.4.4 2016-10-25 21:18:02,313 INFO: submitting ip query: 8.8.4.4 2016-10-25 21:18:02,319 INFO: callback 8.8.4.4:900 2016-10-25 21:18:02,344 INFO: callback 8.8.4.4:900 2016-10-25 21:18:02,346 INFO: callback 8.8.4.4:900 2016-10-25 21:18:02,347 INFO: callback 8.8.4.4:900 2016-10-25 21:18:02,348 INFO: Done
2 Python 2.7
2016-10-25 20:56:30,968 INFO: submitting ip query: 199.181.132.250
2016-10-25 20:56:30,968 INFO: submitting ip query: 199.181.132.250
2016-10-25 20:56:30,968 INFO: submitting ip query: 199.181.132.250
2016-10-25 20:56:30,969 INFO: submitting ip query: 199.181.132.250
2016-10-25 20:56:31,182 INFO: callback 199.181.132.250:900
2016-10-25 20:56:31,195 INFO: callback 199.181.132.250:900
/usr/lib/python2.7/threading.py:1160: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
return _active[_get_ident()]
Traceback (most recent call last):
File "/srv/async.py", line 62, in
3 Python 3.5 (ven35)root@developmentsrv:/srv/getdns-python-bindings# python /srv/async.py 2016-10-25 20:18:47,036 INFO: submitting ip query: 199.181.132.250 2016-10-25 20:18:47,037 INFO: submitting ip query: 199.181.132.250 2016-10-25 20:18:47,037 INFO: submitting ip query: 199.181.132.250 2016-10-25 20:18:47,037 INFO: submitting ip query: 199.181.132.250 2016-10-25 20:18:47,079 INFO: callback 199.181.132.250:900 2016-10-25 20:18:47,260 INFO: callback 199.181.132.250:900 2016-10-25 20:18:47,274 INFO: callback 199.181.132.250:900 TypeError: callback() missing 3 required positional arguments: 'result', 'userarg', and 'tid'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/async.py", line 94, in
4 Python 3.5 - self and result_dict are 0x0 in the stack trace 2016-10-25 21:13:39,821 INFO: submitting ip query: 199.181.132.250 2016-10-25 21:13:39,822 INFO: submitting ip query: 199.181.132.250 2016-10-25 21:13:39,822 INFO: submitting ip query: 199.181.132.250 2016-10-25 21:13:39,822 INFO: submitting ip query: 199.181.132.250 2016-10-25 21:13:39,958 INFO: callback 199.181.132.250:900 2016-10-25 21:13:39,976 INFO: callback 199.181.132.250:900 Segmentation fault (core dumped)
$ gdb python3.5 core Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f40f33b4127 in result_init (self=self@entry=0x0, result_dict=result_dict@entry=0x0) at result.c:50
50 if ((self->replies_full = gdict_to_pdict(result_dict)) == NULL) {
(gdb) where
#0 0x00007f40f33b4127 in result_init (self=self@entry=0x0, result_dict=result_dict@entry=0x0) at result.c:50
#1 0x00007f40f33b43f5 in result_create (resp=resp@entry=0x0) at result.c:196
#2 0x00007f40f33b406a in callback_shim (context=context@entry=0x217f920, type=type@entry=GETDNS_CALLBACK_ERROR, response=response@entry=0x0, userarg=userarg@entry=0x21a0db0, tid=tid@entry=18043064835844998925) at context_util.c:96
#3 0x00007f40f316bd05 in _getdns_call_user_callback (dns_req=0x21a2dc0, response=0x0) at ./general.c:77
#4 0x00007f40f317655b in upstream_erred (upstream=
Script: async.py.txt