Bug 57876 - logresolve.exe on any Windows immediately crashes (if usage() doesn't get called)
Summary: logresolve.exe on any Windows immediately crashes (if usage() doesn't get cal...
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: support (show other bugs)
Version: 2.4.12
Hardware: PC Windows NT
: P2 regression (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-30 14:19 UTC by ernstthal
Modified: 2018-09-11 15:35 UTC (History)
0 users



Attachments
Patch for logresolve.c to open stdin & -out buffered (562 bytes, patch)
2015-04-30 14:19 UTC, ernstthal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ernstthal 2015-04-30 14:19:06 UTC
Created attachment 32704 [details]
Patch for logresolve.c to open stdin & -out buffered

main() from httpd-2.4.12/support/logresolve.c first opens stdin & -out unbuffered using the plain apr_file_open_stdin() & -out() so no mutex will be allocated in the apr_file_t structures, followed by calls to apr_file_buffer_set() to assign two newly created buffers.

apr_file_buffer_set() from httpd-2.4.12/srclib/apr/file_io/win32/buffer.c starts by trying to apr_thread_mutex_lock() the associated mutex which is still NULL from the open above.

The easiest fix is to use apr_file_open_flags_stdin() & -out with the APR_FOPEN_BUFFERED flag instead as shown in the attached patch.

The implementation for UNIX of apr_file_buffer_set() (in httpd-2.4.12/srclib/apr/file_io/unix/buffer.c) differs by applying the file_lock() & -unlock macros from httpd-2.4.12/srclib/apr/include/arch/unix/apr_arch_file_io.h which in turn will only call apr_thread_mutex_lock() & -unlock if the mutex exists.

Both variants are wrong as the documentation in httpd-2.4.12/srclib/apr/include/apr_file_io.h states that apr_file_buffer_set() can be used to assign a buffer to an unbuffered file *requiring* the use of a mutex (#if APR_HAS_THREADS). Fixing the handling of the mutex in the APR library would be the right thing and obsolete the patch given here.

logresolve.exe from httpd-2.2.x did work on Windows.
Comment 1 ernstthal 2015-04-30 14:23:22 UTC
Also see https://bz.apache.org/bugzilla/show_bug.cgi?id=57877
Comment 2 moh.riza 2018-09-11 15:19:34 UTC
not google work windows
Comment 3 moh.riza 2018-09-11 15:33:56 UTC
dont not issue
Comment 4 moh.riza 2018-09-11 15:35:03 UTC
dont not issue