This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1312770 - Undefined response_time in finally section of udp() (upstream has fix for this problem)
Undefined response_time in finally section of udp() (upstream has fix for thi...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-dns (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Charalampos Stratakis
Jan Houska
Marc Muehlfeld
: Patch
Depends On:
Blocks: 1305230
  Show dependency treegraph
 
Reported: 2016-02-29 04:21 EST by Anatoly
Modified: 2016-11-04 00:30 EDT (History)
8 users (show)

See Also:
Fixed In Version: python-dns-1.12.0-2.20150617git465785f.el7
Doc Type: Bug Fix
Doc Text:
Undefined variable in the `udp()` function of the _python-dns_ toolkit is now set Previously, the _python-dns_ toolkit used an undefined `response_time` variable in the *finally* section of the `udp()` function. As a consequence, an incorrect exception was displayed to the user. This bug has been fixed and the correct exception is returned.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-04 00:30:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Anatoly 2016-02-29 04:21:43 EST
Description of problem:

python-dns 1.12.0 has undefined response_time variable in finally section of udp() function. This bug lead to incorrect exception in this function. For example this lead to UnboundLocalError instead of Timeout exception.
Upstream has fix for this problem https://github.com/rthalley/dnspython/commit/daf723176da7bfee5baae928ff1af310a2400289
This problem new for RHEL 7.2 and doesn't presents in previous versions.


Version-Release number of selected component (if applicable): 1.12.0
Comment 3 Charalampos Stratakis 2016-04-04 07:11:21 EDT
Could you provide a reproducer?
Comment 4 Anatoly 2016-04-05 05:05:52 EDT
#!/usr/bin/python

from dns.resolver import Resolver

r = Resolver()
r.nameservers = [ '127.0.0.1', ]
r.timeout = 2
r.lifetime = 2
answers = r.query( 'redhat.com', 'SOA', source_port = 53 )

This script should be started on host with port 53/udp assigned e.g. on host with named started.

Results on host with patch:

Traceback (most recent call last):
  File "./query-bug.py", line 9, in <module>
    answers = r.query( 'redhat.com', 'SOA', source_port = 53 )
  File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 857, in query
    timeout = self._compute_timeout(start)
  File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 769, in _compute_timeout
    raise Timeout(timeout=duration)
dns.exception.Timeout: The DNS operation timed out after 2.00053596497 seconds

Results with not patched version of python-dns:

Traceback (most recent call last):
  File "./query-bug.py", line 9, in <module>
    answers = r.query( 'redhat.com', 'SOA', source_port = 53 )
  File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 869, in query
    source_port=source_port)
  File "/usr/lib/python2.7/site-packages/dns/query.py", line 227, in udp
    response_time = time.time() - begin_time
UnboundLocalError: local variable 'begin_time' referenced before assignment

Correct result for this case is dns.exception.Timeout incorrect results is UnboundLocalError
Comment 13 errata-xmlrpc 2016-11-04 00:30:58 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2354.html

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