[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev [BUG] Race condition in LYGetHostByName on WinNT
From: |
Alexei Anatski |
Subject: |
lynx-dev [BUG] Race condition in LYGetHostByName on WinNT |
Date: |
Wed, 5 Apr 2000 14:44:15 +0400 |
Hello!
Sometime Lynx on WinNT hangs with "Looking up aaa.bbb.com" message chewing
100% CPU time. I traced the problem to race condition in LYGetHostByName.
If threa spawned for name lookup terminates before "donelookup = FALSE" then
"while (!donelookup)" loop is endless.
Quick fix: move "donelookup = FALSE" before CreateThread call.
There are more problems:
MessageBox used instead of CTRACE
CloseThread not called on "success" path
"while (!donelookup)" loop takes 100% CPU while lookup is in progress.
But these may wait for 2.8.4dev1.
Unfortunatly I have no time now to rewrite this function.
WWW\Library\Implementation\HTTP.c, 1082
} else { /* for Windows NT */
phost = (struct hostent *) NULL;
hThread = CreateThread((void *)NULL, 4096UL,
(LPTHREAD_START_ROUTINE)_fork_func,
(void *)NULL, 0UL, (unsigned long *)&dwThreadID);
if (!hThread)
MessageBox((void *)NULL, "CreateThread",
"CreateThread Failed", 0L);
donelookup = FALSE;
while (!donelookup) {
if (HTCheckForInterrupt()) {
/* Note that host is a character array and is not freed */
/* to avoid possible subthread problems: */
if (!CloseHandle(hThread)) {
MessageBox((void *)NULL,
"CloseHandle","CloseHandle Failed", 0L);
}
lynx_nsl_status = HT_INTERRUPTED;
return NULL;
}
}
}
---- Alexei Anatski <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lynx-dev [BUG] Race condition in LYGetHostByName on WinNT,
Alexei Anatski <=