ntdll: Do not execute callbacks past DeleteTimer(INVALID_HANDLE_VALUE)

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Fri Oct 26 02:59:21 CDT 2012


Hi,

You know this patch from March this year.  Initially, this patch was
the first of 2-3.  I decided to release it on its own after finding
out yesterday that in July, Fran,cois Gouget added a todo_wine for a
bug that I fixed monthes earlier!  Now I had to augment my patch
with a one-liner removing that todo_wine from kernel32/tests.

Let me thank him for writing a test case that demonstrates the
effectiveness of my patch.

Francois' patch is a bit flaky. MSDN says: "If the timer has already
expired, the timer callback function will run to completion."  One can
argue that a timer scheduled for immediate execution has expired by
definition.

Based on my experience with unsuccessfully trying to write reliable
stress tests for timer queues, my explanation of the occasional failure
of Francois' test witnessed in:
http://test.winehq.org/data/6ae3418aaf873b85f4508a8920e565d039e7b817/2000_fg-win2000-ie6/kernel32:sync.html
is that w2k/xp/w2k3 fire timer callbacks off a periodic 15.6ms source.
Thus most of the time, the timer will not have fired right after creation.

My stabilisator tests (initially part 3 of these patches to ntdll/kernel32)
prove that native changed behaviour since Vista.

[original March message:]

If you've run my CreateTimerQueue tests found on testbot, you'll have noticed that callbacks
are running in Wine even after DeleteTimerQueue(INVALID_HANDLE_VALUE).
That is not supposed to happen.

This is no good and can cause mysterious and hard to reproduce crashes, as apps are
going to free resources after destruction of the timer queue.

I investigated the issue and here's a patch.
This bug has been in Wine since DeleteTimerQueue was added in 2008.

Perhaps that's why Andrew Eikum saw an improvement in wineoss after moving
away from using INVALID_HANDLE_VALUE.

Note that this affects EXECUTEINTIMERTHREAD above all. I've not investigated
native's event signaling behaviour when independent worker threads are used.

Regards,
 Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ntdll-Do-not-execute-callbacks-past-DeleteTimer-INV.patch
Type: application/octet-stream
Size: 1905 bytes
Desc: 0001-ntdll-Do-not-execute-callbacks-past-DeleteTimer-INV.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20121026/54d9ad96/attachment.obj>


More information about the wine-patches mailing list