[issue34411] ProactorEventLoop should use implement GetAddrInfo, GetNameInfo

2018-08-15 Thread ysangkok+launchpad


New submission from ysangkok+launchpad :

Since socket.getaddrinfo and socket.getnameinfo take a lock on Windows, it 
would be nice to have their corresponding methods in asyncio.ProactorEventLoop 
use IOCP, so that they wouldn't block the whole event loop.

Overlapped I/O flags are available, so I am wondering how hard this would be: 
https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfoexa

--
components: asyncio
messages: 323572
nosy: asvetlov, ysangkok+launchpad, yselivanov
priority: normal
severity: normal
status: open
title: ProactorEventLoop should use implement GetAddrInfo, GetNameInfo
type: enhancement
versions: Python 3.8

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



[issue34411] ProactorEventLoop should use implement GetAddrInfo, GetNameInfo

2018-08-15 Thread ysangkok+launchpad


ysangkok+launchpad  added the comment:

As far as our experiments show, the requests are blocking each other 
irrespective of thread pool size. Which is expected since the lock is global 
across threads.

Am I correct in assuming that an implementation for the ProactorEventLoop with 
IOCP would not require a global lock?

Here is our code, this takes 12 sec on Ubuntu and ~12*100 secs on Windows 
(cause a failed DNS request takes 10 sec):

import asyncio

futs = []
for i in range(100):
  t = asyncio.get_event_loop().getaddrinfo("aa00aa"+str(i)+".onion.", 80)
  futs.append(t)

print(asyncio.get_event_loop().run_until_complete(asyncio.gather(*futs, 
return_exceptions=True)))

--

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



[issue34411] ProactorEventLoop should use implement GetAddrInfo, GetNameInfo

2018-08-15 Thread ysangkok+launchpad


ysangkok+launchpad  added the comment:

The lock I was referring to is 
https://github.com/python/cpython/blob/e0b5b2096ead4cc094a129ce7602ac5c0e998086/Modules/socketmodule.c#L222

Is netdb_lock the GIL?

If the thread pooling was effective, the slowdown wouldn't be linear, but it 
does indeed appear to be. How can this be?

--

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