ioctl() on socket fd's take 3 seconds on 1.7.7
Jason Curl
jcurlnews@arcor.de
Mon Nov 22 21:08:00 GMT 2010
On 22/11/2010 14:17, Corinna Vinschen wrote:
> Can you retry with the next developer snapshot? Are the ioctl calls
> still slow? If so, I'm wondering if the GetAdaptersAddresses call is
> rather slow if a lot of interfaces exist. Every single ioctl in your
> application calls GetAdaptersAddresses twice, like this:
>
> bool
> get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa_ret, ULONG family)
> {
> DWORD ret, size = 0;
> PIP_ADAPTER_ADDRESSES pa0 = NULL;
>
> if (!pa_ret)
> return ERROR_BUFFER_OVERFLOW
> == GetAdaptersAddresses (family, GAA_FLAG_INCLUDE_PREFIX
> | GAA_FLAG_INCLUDE_ALL_INTERFACES,
> NULL, NULL,&size);
> do
> {
> ret = GetAdaptersAddresses (family, GAA_FLAG_INCLUDE_PREFIX
> | GAA_FLAG_INCLUDE_ALL_INTERFACES,
> NULL, pa0,&size);
> if (ret == ERROR_BUFFER_OVERFLOW
> && !(pa0 = (PIP_ADAPTER_ADDRESSES) realloc (pa0, size)))
> break;
> }
> while (ret == ERROR_BUFFER_OVERFLOW);
> if (ret != ERROR_SUCCESS)
> {
> if (pa0)
> free (pa0);
> *pa_ret = NULL;
> return false;
> }
> *pa_ret = pa0;
> return true;
> }
>
It's not this function. I see it called twice after adding my own
syscall_printf and it's very quick taking about 7ms. The problem is
after the second call to this function from get_xp_ifs()
258 6374960 [main] a 3484 ioctl: fd 3, cmd 80487368
215 6375175 [main] a 3484 get_ifconf: **JC** get_xp_ifs()
1606 6376781 [main] a 3484 get_adapters_addresses: **JC**
get_adapters_addresses enter
310 6377091 [main] a 3484 get_adapters_addresses: **JC** call to
GetAdaptersAddresses
6361 6383452 [main] a 3484 get_adapters_addresses: **JC** call to
GetAdaptersAddresses finished
155 6383607 [main] a 3484 get_adapters_addresses: **JC** call to
GetAdaptersAddresses
6615 6390222 [main] a 3484 get_adapters_addresses: **JC** call to
GetAdaptersAddresses finished
292 6390514 [main] a 3484 get_adapters_addresses: **JC**
get_adapters_addresses leave
3112178 9502692 [main] a 3484 get_ifconf: **JC** 9896336 = get_xp_ifd()
The actual delays are caused by SendARP() called from get_xp_ifs().
Interestingly enough, it isn't always slow, only sometimes.
220 107969 [main] a 2808 ioctl: fd 3, cmd 80087364
256 108225 [main] a 2808 fhandler_socket::ioctl: **JC** get_ifconf()
310 108535 [main] a 2808 get_ifconf: **JC** get_xp_ifs()
322 108857 [main] a 2808 get_xp_ifs: **JC** -> A
363 109220 [main] a 2808 get_adapters_addresses: **JC**
get_adapters_addresses enter
327 109547 [main] a 2808 get_adapters_addresses: **JC** call to
GetAdaptersAddresses
8617 118164 [main] a 2808 get_adapters_addresses: **JC** call to
GetAdaptersAddresses finished
194 118358 [main] a 2808 get_adapters_addresses: **JC** call to
GetAdaptersAddresses
7119 125477 [main] a 2808 get_adapters_addresses: **JC** call to
GetAdaptersAddresses finished
122 125599 [main] a 2808 get_adapters_addresses: **JC**
get_adapters_addresses leave
1062 126661 [main] a 2808 get_xp_ifs: **JC** -> cnt=8
235 126896 [main] a 2808 get_xp_ifs: **JC** -> SendARP (D4B7FEA9, 0,
0x28C6FC, 0x28C704
3111331 3238227 [main] a 2808 get_xp_ifs: **JC** -> 67 = SendARP
(D4B7FEA9, 0, 0x28C6FC, 0x28C704 (=0))
459 3238686 [main] a 2808 get_xp_ifs: **JC** -> SendARP (1901A8C0, 0,
0x28C6FC, 0x28C704
276 3238962 [main] a 2808 get_xp_ifs: **JC** -> 0 = SendARP
(1901A8C0, 0, 0x28C6FC, 0x28C704 (=6))
735 3239697 [main] a 2808 get_xp_ifs: **JC** -> SendARP (C1D3FEA9, 0,
0x28C6FC, 0x28C704
351 3240048 [main] a 2808 get_xp_ifs: **JC** -> 0 = SendARP
(C1D3FEA9, 0, 0x28C6FC, 0x28C704 (=6))
283 3240331 [main] a 2808 get_xp_ifs: **JC** -> SendARP (01DFA8C0, 0,
0x28C6FC, 0x28C704
335 3240666 [main] a 2808 get_xp_ifs: **JC** -> 0 = SendARP
(01DFA8C0, 0, 0x28C6FC, 0x28C704 (=6))
264 3240930 [main] a 2808 get_xp_ifs: **JC** -> SendARP (0100007F, 0,
0x28C6FC, 0x28C704
344 3241274 [main] a 2808 get_xp_ifs: **JC** -> 0 = SendARP
(0100007F, 0, 0x28C6FC, 0x28C704 (=0))
311 3241585 [main] a 2808 get_ifconf: **JC** 15466896 = get_xp_ifd()
318 3241903 [main] a 2808 fhandler_socket::ioctl: **JC** 2672756 =
get_ifconf(0x80087364, 1628228800)
291 3242194 [main] a 2808 fhandler_socket::ioctl: 0 = ioctl_socket
(80087364, 28C8D4)
And the interface that is failing: D4B7FEA9 = 169.254.183.212 doesn't
appear by a call to "ipconfig /all". I'm guessing that Windows is
actually making a network request for this non-existent interface.
./Windows/v5.0/Include/WinError.h:#define ERROR_BAD_NET_NAME
67L
ERROR_BAD_NET_NAME
"The network name cannot be found. This error is returned on Windows
Vista and later when an ARP reply to the SendARP request was not
received. This error occurs if the destination IPv4 address could not be
reached."
I'm not sure where this IP is currently coming from...
$ ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : BUGATTI
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : home.lan
Ethernet adapter Bluetooth Network Connection 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Bluetooth Device (Personal Area
Network) #2
Physical Address. . . . . . . . . : 00-60-57-1B-21-99
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : home.lan
Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
Physical Address. . . . . . . . . : 00-24-1D-71-F6-EC
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . :
fe80::a825:d675:375a:2a8b%11(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.1.25(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : 22 November 2010 18:40:02
Lease Expires . . . . . . . . . . : 24 November 2010 18:40:02
Default Gateway . . . . . . . . . : 192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.2
DHCPv6 IAID . . . . . . . . . . . : 234890269
DHCPv6 Client DUID. . . . . . . . :
00-01-00-01-12-4A-50-BB-00-24-1D-71-F6-EC
DNS Servers . . . . . . . . . . . : 192.168.1.2
Primary WINS Server . . . . . . . : 192.168.1.2
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter VMware Network Adapter VMnet1:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter
for VMnet1
Physical Address. . . . . . . . . : 00-50-56-C0-00-01
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . :
fe80::fc13:bcfb:6f71:d3c1%23(Preferred)
Autoconfiguration IPv4 Address. . : 169.254.211.193(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 570445910
DHCPv6 Client DUID. . . . . . . . :
00-01-00-01-12-4A-50-BB-00-24-1D-71-F6-EC
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter VMware Network Adapter VMnet8:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter
for VMnet8
Physical Address. . . . . . . . . : 00-50-56-C0-00-08
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . :
fe80::c98c:6ec5:7b0b:cf51%24(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.223.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 587223126
DHCPv6 Client DUID. . . . . . . . :
00-01-00-01-12-4A-50-BB-00-24-1D-71-F6-EC
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
Tunnel adapter isatap.home.lan:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : home.lan
Description . . . . . . . . . . . : Microsoft ISATAP Adapter
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter Local Area Connection* 11:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.{7E5203E8-97DE-4822-9A2E-380BD258D97E}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.{A045DC0F-A979-49B3-954C-D0678365FF26}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.{8424F604-4FAE-4541-9D8E-7B0A583A0956}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #5
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list