Vadim Chekan wrote:
Hi all,I'm having assertion failed at server/mpm/winnt/nt_eventlog.c: mpm_nt_eventlog_stderr_open() ... /* Flush stderr and unset its buffer, then commit and replace stderr. * This is typically a noop for Win2K/XP since services with NULL std * handles [but valid FILE *'s, oddly enough], but is required * for NT 4.0 and to use this code outside of services. */ fflush(stderr); setvbuf(stderr, NULL, _IONBF, 0); _commit(2 /* stderr */); ======================================== 1. FlushFileBuffers which is called from _commit() returns ERROR_INVALID_HANDLE. 2. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/flushfilebuffers.asp states that: "The function fails if hFile is a handle to the console output. That is because the console output is not buffered. The function returns FALSE, and GetLastError returns ERROR_INVALID_HANDLE. Windows Me/98/95: The function does nothing if hFile is a handle to the console output. That is because console output is not buffered. The function returns TRUE, but it does nothing." 3. fflush does _commit() if appropriate flags are set: /* lowio commit to ensure data is written to disk */ if (str->_flag & _IOCOMMIT) { return (_commit(_fileno(str)) ? EOF : 0); I think we can remove safely _commit() call. Note: I have Win XP Pro(sp2) & Visual Studio 2005.
Yes, that's possibly true in VS2005, but not in MSVC 5 or 6, so it stays. Note that httpd.exe really isn't 'meant' to be a console app. But we can do more to mop up any error emits. You presume _IOCOMMIT is set, but that isn't neccessarily so. Perhaps we should slowly start backing it out from VS2005 first, then VS2003 and earlier as someone can confirm it's not needed. The only way to validate your proposed patch is to go forward from NT 4.0 (we can safely assume a baseline of SP6), NT 5.0 and NT 5.1, using the MSVCRT as well as the new clibs. So please provide the exact, complete assert message you receive (hate it when that trivial detail is not reported) and we can look at a way to safely ignore it for now. Bill
