Potential bug in RtlRegisterWait()

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Joakim Tjernlund

Potential bug in RtlRegisterWait()

Post by Joakim Tjernlund »

Noticed that RtlRegisterWait() will approve a zero timeout value(Milliseconds == 0)

This makes ies4linux spin the CPU 100% when visiting a
https page. The below crude patch fixes it:

--- dlls/ntdll/threadpool.c.org 2010-05-02 22:37:08.000000000 +0200
+++ dlls/ntdll/threadpool.c 2010-05-02 22:46:45.000000000 +0200
@@ -427,6 +427,9 @@

TRACE( "(%p, %p, %p, %p, %d, 0x%x)\n", NewWaitObject, Object, Callback, Context, Milliseconds, Flags );

+ if (!Milliseconds)
+ return RPC_NT_INVALID_TIMEOUT;
+
wait_work_item = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*wait_work_item) );
if (!wait_work_item)
return STATUS_NO_MEMORY;

On a related note, whitout this patch wineserver also goes into an endless
loop, doing brk() calls over and over until memory is exausted. Seems
like a bug that too.

Jocke
James McKenzie

Potential bug in RtlRegisterWait()

Post by James McKenzie »

Joakim Tjernlund wrote:
Noticed that RtlRegisterWait() will approve a zero timeout value(Milliseconds == 0)

This makes ies4linux spin the CPU 100% when visiting a
https page. The below crude patch fixes it:

--- dlls/ntdll/threadpool.c.org 2010-05-02 22:37:08.000000000 +0200
+++ dlls/ntdll/threadpool.c 2010-05-02 22:46:45.000000000 +0200
@@ -427,6 +427,9 @@

TRACE( "(%p, %p, %p, %p, %d, 0x%x)\n", NewWaitObject, Object, Callback, Context, Milliseconds, Flags );

+ if (!Milliseconds)
+ return RPC_NT_INVALID_TIMEOUT;
+
wait_work_item = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*wait_work_item) );
if (!wait_work_item)
return STATUS_NO_MEMORY;

On a related note, whitout this patch wineserver also goes into an endless
loop, doing brk() calls over and over until memory is exausted. Seems
like a bug that too.

File a bug report with the patch attached.

James McKenzie
Charles Davis

Potential bug in RtlRegisterWait()

Post by Charles Davis »

On 5/2/10 3:02 PM, Joakim Tjernlund wrote:
Noticed that RtlRegisterWait() will approve a zero timeout value(Milliseconds == 0)

This makes ies4linux spin the CPU 100% when visiting a
https page. The below crude patch fixes it:

--- dlls/ntdll/threadpool.c.org 2010-05-02 22:37:08.000000000 +0200
+++ dlls/ntdll/threadpool.c 2010-05-02 22:46:45.000000000 +0200
@@ -427,6 +427,9 @@

TRACE( "(%p, %p, %p, %p, %d, 0x%x)\n", NewWaitObject, Object, Callback, Context, Milliseconds, Flags );

+ if (!Milliseconds)
+ return RPC_NT_INVALID_TIMEOUT;
+
wait_work_item = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*wait_work_item) );
if (!wait_work_item)
return STATUS_NO_MEMORY;

On a related note, whitout this patch wineserver also goes into an endless
loop, doing brk() calls over and over until memory is exausted. Seems
like a bug that too.
This looks like something you should post to wine-devel.

Chip
Locked