Opened 4 years ago

Last modified 4 years ago

#8312 defect new

twisted.names.client errors out on some DNS lookups in a confusing way

Reported by: Alex Gaynor Owned by:
Priority: normal Milestone:
Component: names Keywords:
Cc: Branch:
Author:

Description

This codesnippet:

from twisted.internet.task import react
from twisted.names import client

def main(reactor):
     return client.lookupMailExchange("ABILITYONE.FED.US")


react(main, [])

Fails with the following confusing error:

main function encountered error
Traceback (most recent call last):
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/names/client.py", line 329, in _reissue
    d = self._query(address, query, timeout[0], reason.value.id)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/names/client.py", line 264, in _query
    d = protocol.query(*args)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/names/dns.py", line 2802, in query
    return self._query(queries, timeout, id, writeMessage)
--- <exception caught here> ---
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/names/dns.py", line 2680, in _query
    writeMessage(m)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/names/dns.py", line 2800, in writeMessage
    self.writeMessage(m, address)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/names/dns.py", line 2728, in writeMessage
    self.transport.write(message.toStr(), address)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-72bf309634a39/site-packages/twisted/internet/udp.py", line 295, in write
    addr[0], "IPv4 port write() called with IPv6 address")
twisted.internet.error.InvalidAddressError:

This appears to be a names internal issue where it uses the wrong type of address.

Change History (1)

comment:1 Changed 4 years ago by Alex Gaynor

Type: enhancementdefect
Note: See TracTickets for help on using tickets.