[issue26236] urllib2 initiate irregular call to gethostbyaddr

2021-06-18 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43324] asyncio: add socket getfqdn and gethostbyaddr functions

2021-02-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +asvetlov, yselivanov
title: asyncio -> asyncio: add socket getfqdn and gethostbyaddr functions

___
Python tracker 
<https://bugs.python.org/issue43324>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Thomas Jollans

On 12/09/18 16:29, Florian Bergmann wrote:

On the other hand I feel given the documentation, passing the `ip_address` would
be the right thing to do, so I am wondering if I am missing something very
obvious here (especially given that the code seems to be unchanged for 18 
years).
Whatever the docs say, turning the hostname into an IP address and 
working with that would be incorrect.


Say we have a server, 'fred.weasley.example.com', which is also known as 
'www.example.com'. Its reverse DNS pointer is 
'fred.weasley.example.com'. Now, if we have 'example.com' on our DNS 
search path, the FQDN of 'www' is 'www.example.com', while the FQDN 
derived from the IP would be 'fred.weasley.example.com'.


Right?
--
https://mail.python.org/mailman/listinfo/python-list


Re: getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Rhodri James

On 12/09/18 15:29, Florian Bergmann wrote:

Hello,

While I was debugging some salt issues I dug into the python code and found a
piece of code in the `socket.py` module that surprised my a bit:

In the `getfqdn` function the `gethostbyaddr` name function is being called with
a `hostname` instead of an `ipaddress`:


[snip]


2. `gethostbyaddr()`:

Also from the documentation:

```
Return a triple (hostname, aliaslist, ipaddrlist) where hostname is the primary 
host name responding to the *given ip_address* (...)
```

As the documentation states it expects an `ip_address` and not a hostname,
but it is given a `hostname` instead.


I believe the online documentation is wrong.  The help text certainly 
differs:


Help on built-in function gethostbyaddr in module _socket:

gethostbyaddr(...)
gethostbyaddr(host) -> (name, aliaslist, addresslist)

Return the true host name, a list of aliases, and a list of IP 
addresses,
for a host.  The host argument is a string giving a host name or IP 
number.



--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Florian Bergmann
Hello,

While I was debugging some salt issues I dug into the python code and found a
piece of code in the `socket.py` module that surprised my a bit:

In the `getfqdn` function the `gethostbyaddr` name function is being called with
a `hostname` instead of an `ipaddress`:

```python
def getfqdn(name=''):
"""Get fully qualified domain name from name.
An empty argument is interpreted as meaning the local host.
First the hostname returned by gethostbyaddr() is checked, then
possibly existing aliases. In case no FQDN is available, hostname
from gethostname() is returned.
"""
name = name.strip()
if not name or name == '0.0.0.0':
name = gethostname() # (1)
try:
    hostname, aliases, ipaddrs = gethostbyaddr(name) # (2)
except error:
pass
else:
aliases.insert(0, hostname)
for name in aliases:
if '.' in name:
break
else:
name = hostname
return name
```

1. `gethostname()`:

The documentation states:

```
Return a string containing the hostname of the machine where the Python 
interpreter is currently executing.

If you want to know the current machine’s IP address, you may want to use 
gethostbyname(gethostname()).
```

2. `gethostbyaddr()`:

Also from the documentation:

```
Return a triple (hostname, aliaslist, ipaddrlist) where hostname is the primary 
host name responding to the *given ip_address* (...)
```

As the documentation states it expects an `ip_address` and not a hostname,
but it is given a `hostname` instead.

I used the following two snippets to check the different behaviors:

```
python -c 'import socket; 
print(socket.gethostbyaddr(socket.gethostbyname(socket.gethostname('
```

```
python -c 'import socket; print(socket.gethostbyaddr(socket.gethostname()))'
```

Now on *most* of my machines the results are exactly the same, but on some it
differs (which I actually attribute to strange `/etc/hosts` configurations).

On the other hand I feel given the documentation, passing the `ip_address` would
be the right thing to do, so I am wondering if I am missing something very
obvious here (especially given that the code seems to be unchanged for 18 
years).

Best regards,

Florian
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28431] socket gethostbyaddr returns IPv6 names for 127.0.0.1

2016-10-13 Thread R. David Murray

R. David Murray added the comment:

I believe that you will find that the same thing happens if you call 
gethostbyaddr from C.  So this either isn't a bug, or it isn't a bug in Python 
:)

(Correct me if I'm wrong; I don't have time to actually test it myself, but 
gethostbyaddr is a fairly thing wrapper.)

--
nosy: +r.david.murray

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28431>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28431] socket gethostbyaddr returns IPv6 names for 127.0.0.1

2016-10-13 Thread Nick Carboni

New submission from Nick Carboni:

socket.gethostbyaddr seems to be equating loopback addresses regardless of IP 
protocol version.

In both versions tested (2.7.5 and 3.4.3) the ordering of the entries in my 
/etc/hosts file determines the result I get, rather than what address I'm 
querying for.

For example:

/etc/hosts:

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

result:

>>> import socket
>>> socket.gethostbyaddr("127.0.0.1")
('localhost', ['localhost.localdomain', 'localhost6', 
'localhost6.localdomain6'], ['127.0.0.1'])

Then if I change the ordering of the entries in /etc/hosts as follows:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

result:

>>> import socket
>>> socket.gethostbyaddr("127.0.0.1")
('localhost', ['localhost.localdomain', 'localhost4', 
'localhost4.localdomain4'], ['127.0.0.1'])

I would expect gethostbyaddr to return only the hostnames associated with the 
given address regardless of the ordering of the entries in /etc/hosts.

--
messages: 278580
nosy: carbonin
priority: normal
severity: normal
status: open
title: socket gethostbyaddr returns IPv6 names for 127.0.0.1
type: behavior
versions: Python 2.7, Python 3.4

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28431>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26236] urllib2 initiate irregular call to gethostbyaddr

2016-01-28 Thread Julia Dolgova

New submission from Julia Dolgova:

I'm using python 2.7. My system is windows 7(64-bit). I also use proxy.
urllib2.urlopen usually implements 0,2..1sec but sometimes sends a strange UDP 
to 137 port (netbios-ns) of the remote server, waits 4..6 sec. and then sends 
HTTP-request.

If I disable Netbios over TCP/IP in my system settings no UDP to 137 port is 
sent, but urlopen still implements 4..6sec.

I've found out that the delay happens in 
_socket.gethostbyaddr(HostName)
called by socket.getfqdn(HostName)
called by urllib.proxy_bypass_registry(HostName)
called by urllib.proxy_bypass(HostName)
called by urllib2.ProxyHandler.proxy_open 

HostName='pykasso.rc-online.ru'

"nslookup pykasso.rc-online.ru" works quickly in my computer

I suppose the problem is that the hostname is passed into gethostbyaddr instead 
of IP

If I add an IP-verification of the string before socket.getfqdn() call in 
urllib.proxy_bypass_registry()
try:
socket.inet_aton(rawHost)  I added this operator
fqdn = socket.getfqdn(rawHost)
if fqdn != rawHost:
   host.append(fqdn)
except socket.error:
pass

then no delay happens.

My proposal is to make an IP-verification in urllib.proxy_bypass_registry() or 
to add an opportunity for a programmer to refuse a proxy bypass attempt

--
components: Library (Lib), Windows
messages: 259190
nosy: juliadolgova, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: urllib2 initiate irregular call to gethostbyaddr
type: performance
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26236>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



gethostbyaddr()

2014-07-28 Thread Edward Manning
I wrote this code, but it seem to work fine if I only have one ip in the file. 
When I have more than one IP in the file 
I get a error. Does anyone have an idea why.


import socket
 
 
def main():
 
# get file names
infileName = input (What file our the IP adderss in?  )
outfileName = input(What file should the results go in?)
 
# open files
infile = open(infileName, r)
outfile = open(outfileName, w)
 
 
#Proccess each line of the input file
 
for line in infile:
ipAddress = line.strip()
resluts = socket.gethostbyaddr(ipAddress)
print(resluts[0],resluts[2], end=)-- 
https://mail.python.org/mailman/listinfo/python-list


Re: gethostbyaddr()

2014-07-28 Thread Chris Kaynor
On Mon, Jul 28, 2014 at 2:33 PM, Edward Manning ejmmann...@gmail.com
wrote:

 I wrote this code, but it seem to work fine if I only have one ip in the
 file. When I have more than one IP in the file

 I get a error. Does anyone have an idea why.


It would be helpful to know what the error you are getting is. It is also a
good idea to generally provide the Python version and OS version with your
messages, as they can often make a major difference. As it is, I've made my
best guess below (in bold), I've also included some other notes that may
cause issues, but I doubt are causing your error.


 import socket





 def main():



 # get file names

 infileName = input (What file our the IP adderss in?  )

 outfileName = input(What file should the results go in?)



 # open files

 infile = open(infileName, r)

 outfile = open(outfileName, w)


While this shouldn't cause the issue your reporting (without other issues
going on), Its generally a better idea to use the with statement to open
file, like so:
with open(infileName, r) as infile:
# code that needs infile goes here.

This will ensure that the file is closed when you are done with it, even if
an error occurs in the code that may prevent the code from running to
completion.






 #Proccess each line of the input file



 for line in infile:

 ipAddress = line.strip()


I'm guessing that, when you only have one IP, you do not have a trailing
new-line in the file, but when you put more than one in the file, you have
a trailing new-line. You can try adding:

if not ipAddress:
continue

here to ignore any empty lines (due to the line.strip() above, it will also
ignore all white-space lines) you might get. This may be the cause of your
error...


 resluts = socket.gethostbyaddr(ipAddress)

 print(resluts[0],resluts[2], end=)


Note that this does not seem to be printing into outfile (its printing to
stdout instead). I presume this is for debugging purposes.


 --
 https://mail.python.org/mailman/listinfo/python-list


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: gethostbyaddr()

2014-07-28 Thread Edward Manning
Chris 

Thank you for the info.  I figure it out. But thank you again.

Ed 
 On Jul 28, 2014, at 5:42 PM, Chris Kaynor ckay...@zindagigames.com wrote:
 
 On Mon, Jul 28, 2014 at 2:33 PM, Edward Manning ejmmann...@gmail.com wrote:
 I wrote this code, but it seem to work fine if I only have one ip in the 
 file. When I have more than one IP in the file 
 I get a error. Does anyone have an idea why.
 
 It would be helpful to know what the error you are getting is. It is also a 
 good idea to generally provide the Python version and OS version with your 
 messages, as they can often make a major difference. As it is, I've made my 
 best guess below (in bold), I've also included some other notes that may 
 cause issues, but I doubt are causing your error.
  
 import socket
  
  
 def main():
  
 # get file names
 infileName = input (What file our the IP adderss in?  )
 outfileName = input(What file should the results go in?)
  
 # open files
 infile = open(infileName, r)
 outfile = open(outfileName, w)
 
 While this shouldn't cause the issue your reporting (without other issues 
 going on), Its generally a better idea to use the with statement to open 
 file, like so:
 with open(infileName, r) as infile:
 # code that needs infile goes here.
 
 This will ensure that the file is closed when you are done with it, even if 
 an error occurs in the code that may prevent the code from running to 
 completion.
  
  
  
 #Proccess each line of the input file
  
 for line in infile:
 ipAddress = line.strip()
 
 I'm guessing that, when you only have one IP, you do not have a trailing 
 new-line in the file, but when you put more than one in the file, you have a 
 trailing new-line. You can try adding:
 
 if not ipAddress:
 continue
 
 here to ignore any empty lines (due to the line.strip() above, it will also 
 ignore all white-space lines) you might get. This may be the cause of your 
 error...
  
 resluts = socket.gethostbyaddr(ipAddress)
 print(resluts[0],resluts[2], end=)
 
 Note that this does not seem to be printing into outfile (its printing to 
 stdout instead). I presume this is for debugging purposes.
  
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-22 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset fe66fb61f199 by Vinay Sajip in branch 'default':
Issue #14622: Increased default timeout for SMTPHandler.
http://hg.python.org/cpython/rev/fe66fb61f199

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14622
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-22 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--
Removed message: http://bugs.python.org/msg158973

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14622
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Yuval Greenfield

New submission from Yuval Greenfield ubershme...@gmail.com:

This is the line in question: 
http://hg.python.org/cpython/file/293180d199f2/Lib/http/server.py#l527

I was trying to test out a few html files using python -m http.server and it 
took 4 seconds for each request, it was completely unusable. I had to do hula 
hoops to find out that it was Python's fault. The function self.address_string 
is used in every log, meaning every request makes a reverse DNS query before 
responding. This function failed for every request. Now I know this may be my 
network's fault but that doesn't mean the server has to die with it. I think 
the better solution would be to just print out the ip address like other 
popular servers do. There's no need to be fancy with server names in the log of 
our toy server, especially when it may come at such a high price.

--
components: Library (Lib)
messages: 158737
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: Python http.server is dead slow using gethostbyaddr/getfqdn for each 
request
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14622
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Yuval Greenfield

Changes by Yuval Greenfield ubershme...@gmail.com:


--
type:  - performance

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14622
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Probably a duplicate of issue 6085.

--
nosy: +pitrou
resolution:  - duplicate
status: open - closed
superseder:  - Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14622
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue583975] gethostbyaddr lag

2011-11-06 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue583975
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2129] Link error of gethostbyaddr and gethostname in Python Manuals (the chm file)

2008-05-11 Thread Georg Brandl

Changes by Georg Brandl [EMAIL PROTECTED]:


--
status: pending - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2129
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2129] Link error of gethostbyaddr and gethostname in Python Manuals (the chm file)

2008-03-28 Thread Georg Brandl

Changes by Georg Brandl [EMAIL PROTECTED]:


--
status: open - pending

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2129
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2129] Link error of gethostbyaddr and gethostname in Python Manuals (the chm file)

2008-02-21 Thread Martin v. Löwis

Martin v. Löwis added the comment:

That's difficult to fix. Notice that this page does reference
gethostbyaddr (in the uname documentation), and that the online HTML
version links to both the socket and the os modules. Apparently, the CHM
generation picks up the first link.

--
nosy: +loewis

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2129
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2129] Link error of gethostbyaddr and gethostname in Python Manuals (the chm file)

2008-02-21 Thread Georg Brandl

Georg Brandl added the comment:

I think you get two links in the CHM generated by Sphinx. Can somebody
with a working HTML Help Compiler check that?

--
assignee:  - georg.brandl
nosy: +georg.brandl

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2129
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: problem with gethostbyaddr with intranet addresses on MAC

2008-01-28 Thread Sion Arrowsmith
shailesh  [EMAIL PROTECTED] wrote:
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type help, copyright, credits or license for more information.
 from socket import *
 x = gethostbyname('google.com')
 x
'64.233.167.99'
 gethostbyaddr(x)
('py-in-f99.google.com', [], ['64.233.167.99'])
 e = '192.168.4.123'
 gethostbyaddr(e)
Traceback (most recent call last):
  File stdin, line 1, in ?
socket.herror: (1, 'Unknown host')


So what are you expecting it to return? Or, to put it another way,
what would you feed to gethostbyname() to get 192.168.4.123 back?
Can you get the right answer from host or some other command-
line tool? Can you get an answer from gethostbyaddr() on one of
the other machines on the network? How do they do their name
resolution?

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
   Frankly I have no feelings towards penguins one way or the other
-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

problem with gethostbyaddr with intranet addresses on MAC

2008-01-25 Thread shailesh
Hi,

I am facing  a peculiar problem. socket.gethostbyaddr is not working
fine on my MAC for ip addresses on the LAN. The LAN happens to consist
of linux and windows machines and this is the only one MAC on the
LAN.

Please see the example below. I am getting error: socket.herror: (1,
'Unknown host')



apples-computer:~ apple$ ping 192.168.4.123
PING 192.168.4.123 (192.168.4.123): 56 data bytes
64 bytes from 192.168.4.123: icmp_seq=0 ttl=64 time=0.328 ms
64 bytes from 192.168.4.123: icmp_seq=1 ttl=64 time=0.236 ms
64 bytes from 192.168.4.123: icmp_seq=2 ttl=64 time=0.255 ms
^C
--- 192.168.4.123 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.236/0.273/0.328/0.040 ms
apples-computer:~ apple$ python2.4
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type help, copyright, credits or license for more information.
 from socket import *
 x = gethostbyname('google.com')
 x
'64.233.167.99'
 gethostbyaddr(x)
('py-in-f99.google.com', [], ['64.233.167.99'])
 e = '192.168.4.123'
 gethostbyaddr(e)
Traceback (most recent call last):
  File stdin, line 1, in ?
socket.herror: (1, 'Unknown host')



With regards,
- Shailesh

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with gethostbyaddr with intranet addresses on MAC

2008-01-25 Thread Vladimir Rusinov
On 1/25/08, shailesh [EMAIL PROTECTED] wrote:

 apples-computer:~ apple$ ping 192.168.4.123
 PING 192.168.4.123 (192.168.4.123): 56 data bytes
 64 bytes from 192.168.4.123: icmp_seq=0 ttl=64 time=0.328 ms
 64 bytes from 192.168.4.123: icmp_seq=1 ttl=64 time=0.236 ms
 64 bytes from 192.168.4.123: icmp_seq=2 ttl=64 time= 0.255 ms
 ^C
 --- 192.168.4.123 ping statistics ---
 3 packets transmitted, 3 packets received, 0% packet loss
 round-trip min/avg/max/stddev = 0.236/0.273/0.328/0.040 ms
 apples-computer:~ apple$ python2.4
 Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
 [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
 Type help, copyright, credits or license for more information.
  from socket import *
  x = gethostbyname('google.com')
  x
 '64.233.167.99'
  gethostbyaddr(x)
 ('py-in-f99.google.com', [], ['64.233.167.99'])
  e = '192.168.4.123'
  gethostbyaddr(e)
 Traceback (most recent call last):
   File stdin, line 1, in ?
 socket.herror: (1, 'Unknown host')
 


I'm sure your dns server have no reverse records for ' 192.168.4.123'.
So, it can't resolve it (123.4.168.192.in-addr.arpa).

-- 
Vladimir Rusinov
GreenMice Solutions: IT-решения на базе Linux
http://greenmice.info/
-- 
http://mail.python.org/mailman/listinfo/python-list

[ python-Bugs-583975 ] gethostbyaddr lag

2006-12-28 Thread SourceForge.net
Bugs item #583975, was opened at 2002-07-19 11:41
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=583975group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Closed
Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Jason R. Mastaler (jasonrm)
Assigned to: Nobody/Anonymous (nobody)
Summary: gethostbyaddr lag

Initial Comment:
For more info, also see
http://mail.python.org/pipermail/python-list/2002-July/113706.html
 
Perl's gethostbyaddr doesn't seem to have this problem
as shown
below.  Should I report this in the bug tracker?
 
$ time perl -MSocket -lwe 'print +(gethostbyaddr
inet_aton(quot;datavortex.netquot;), AF_INET)[0]'
datavortex.net
 
real0m0.063s
user0m0.050s
sys 0m0.010s
 
$ time python2 -c 'from socket import * ; print
gethostbyaddr(quot;datavortex.netquot;)[0]'
datavortex.net
 
real0m20.176s
user0m0.070s
sys 0m0.020s
 


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-12-28 23:38

Message:
Logged In: YES 
user_id=33168
Originator: NO

Not fully diagnosed, no.  I suspect (based on reading the comments here)
that the other programs didn't use the threaded version where python did. 
That's the only reasonable explanation I can come up with.  I'm closing
this since we could never reproduce.  I don't recall ever seeing another
similar bug report.

--

Comment By: A.M. Kuchling (akuchling)
Date: 2006-12-22 05:11

Message:
Logged In: YES 
user_id=11375
Originator: NO

Was the cause of this bug ever diagnosed?  Should this report remain open,
or be closed?


--

Comment By: Jason R. Mastaler (jasonrm)
Date: 2003-07-24 20:03

Message:
Logged In: YES 
user_id=85984

This problem has cropped up again for another
TMDA user, so we still have this bug in Python.

In short, just as with the previous report, this
user sees a 20 second delay with 
socket.gethostbyaddr() on a hostname which
all other tools (nslookup, host, mail progs, etc)
look up instantaneously.

In other words, Python is the only app on his
system with this problem.  I had him try 
Python 2.3c1 to no avail.

As with the previous user, he is running Linux
(Redhat):

Linux sparge 2.4.20-18.7 #1 Thu May 29 06:51:53 EDT 2003
i686 unknown

glibc-2.2.5-43

Any other information I should provide or any
diagnostics I can have the user run?

--

Comment By: Jason R. Mastaler (jasonrm)
Date: 2002-11-02 20:40

Message:
Logged In: YES 
user_id=85984

The problem was under Python 2.2.

Though now the user reports that he can no longer
reproduce the problem, despite not having done any
Python upgrades or system configuration changes.

We might just have to chuck this one up to 
FM (Funny Magic).


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-02 13:14

Message:
Logged In: YES 
user_id=33168

Jason, still with us?  What version of python were you
having the problem with? 2.1.x? 2.2.x?  Do you have the
problem with 2.2?  Have you looked at patch #604210
(http://python.org/604210)?  Can you test that?

--

Comment By: Jason R. Mastaler (jasonrm)
Date: 2002-09-06 17:20

Message:
Logged In: YES 
user_id=85984

Still having the problem, but I'm unsure how to
proceed.

nslookup and host both return instantly when querying
datavortex.net.

Only Python seems to exhibit this problem, but it 
still could be a system misconfiguration.  This is the
only time I've ever seen/heard of this behavior.


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-09-06 15:23

Message:
Logged In: YES 
user_id=33168

Jason, are you still having this problem?  Do you have
anything to report?

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-07-22 15:37

Message:
Logged In: YES 
user_id=33168

Looking at the output, the problem is definitely in
gethostbyaddr_r().
This is what python calls from Modules/socketmodule.c
socket_gethostbyaddr().

Notice:  the first attempt to send to the first DNS server
quot;207.69.188.185quot; looks like it fails after 5 seconds.  DNS
#2 is attempted quot;207.69.188.186quot;, this send also takes 5
seconds, back to #1 ...

The poll is being done in gethostbyaddr_r() (ie, libc).  If
you want to break in a debugger, gethost...() should be
around line 2216 in python 2.2.  You can also put prints

[ python-Bugs-583975 ] gethostbyaddr lag

2006-12-22 Thread SourceForge.net
Bugs item #583975, was opened at 2002-07-19 14:41
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=583975group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jason R. Mastaler (jasonrm)
Assigned to: Nobody/Anonymous (nobody)
Summary: gethostbyaddr lag

Initial Comment:
For more info, also see
http://mail.python.org/pipermail/python-list/2002-July/113706.html
 
Perl's gethostbyaddr doesn't seem to have this problem
as shown
below.  Should I report this in the bug tracker?
 
$ time perl -MSocket -lwe 'print +(gethostbyaddr
inet_aton(quot;datavortex.netquot;), AF_INET)[0]'
datavortex.net
 
real0m0.063s
user0m0.050s
sys 0m0.010s
 
$ time python2 -c 'from socket import * ; print
gethostbyaddr(quot;datavortex.netquot;)[0]'
datavortex.net
 
real0m20.176s
user0m0.070s
sys 0m0.020s
 


--

Comment By: A.M. Kuchling (akuchling)
Date: 2006-12-22 08:11

Message:
Logged In: YES 
user_id=11375
Originator: NO

Was the cause of this bug ever diagnosed?  Should this report remain open,
or be closed?


--

Comment By: Jason R. Mastaler (jasonrm)
Date: 2003-07-24 23:03

Message:
Logged In: YES 
user_id=85984

This problem has cropped up again for another
TMDA user, so we still have this bug in Python.

In short, just as with the previous report, this
user sees a 20 second delay with 
socket.gethostbyaddr() on a hostname which
all other tools (nslookup, host, mail progs, etc)
look up instantaneously.

In other words, Python is the only app on his
system with this problem.  I had him try 
Python 2.3c1 to no avail.

As with the previous user, he is running Linux
(Redhat):

Linux sparge 2.4.20-18.7 #1 Thu May 29 06:51:53 EDT 2003
i686 unknown

glibc-2.2.5-43

Any other information I should provide or any
diagnostics I can have the user run?

--

Comment By: Jason R. Mastaler (jasonrm)
Date: 2002-11-02 23:40

Message:
Logged In: YES 
user_id=85984

The problem was under Python 2.2.

Though now the user reports that he can no longer
reproduce the problem, despite not having done any
Python upgrades or system configuration changes.

We might just have to chuck this one up to 
FM (Funny Magic).


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-02 16:14

Message:
Logged In: YES 
user_id=33168

Jason, still with us?  What version of python were you
having the problem with? 2.1.x? 2.2.x?  Do you have the
problem with 2.2?  Have you looked at patch #604210
(http://python.org/604210)?  Can you test that?

--

Comment By: Jason R. Mastaler (jasonrm)
Date: 2002-09-06 20:20

Message:
Logged In: YES 
user_id=85984

Still having the problem, but I'm unsure how to
proceed.

nslookup and host both return instantly when querying
datavortex.net.

Only Python seems to exhibit this problem, but it 
still could be a system misconfiguration.  This is the
only time I've ever seen/heard of this behavior.


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-09-06 18:23

Message:
Logged In: YES 
user_id=33168

Jason, are you still having this problem?  Do you have
anything to report?

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-07-22 18:37

Message:
Logged In: YES 
user_id=33168

Looking at the output, the problem is definitely in
gethostbyaddr_r().
This is what python calls from Modules/socketmodule.c
socket_gethostbyaddr().

Notice:  the first attempt to send to the first DNS server
quot;207.69.188.185quot; looks like it fails after 5 seconds.  DNS
#2 is attempted quot;207.69.188.186quot;, this send also takes 5
seconds, back to #1 ...

The poll is being done in gethostbyaddr_r() (ie, libc).  If
you want to break in a debugger, gethost...() should be
around line 2216 in python 2.2.  You can also put prints in.

As for why perl doesn't have the same problem, it could be
that perl doesn't use the same library call
(gethostbyaddr_r), or attempts to read from /etc/hosts
before contacting the DNS server.  I'm just guessing.  In
order to debug this further, you will probably need the
python sources.  What happens if you do host datavortex.net
(you could also try nslookup)?  Does that return immediately
or wait?


--

Comment By: Data Vortex (datavortex)
Date