MillhioreF / hourglass-win32

Automatically exported from code.google.com/p/hourglass-win32
0 stars 0 forks source link

Game process doesn't fully terminate on Windows 7 #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When you click Stop, the game exe doesn't fully terminate and can be seen in 
the task manager (and sometimes its window remains frozen in place), where it 
remains until Hourglass itself is closed. This never happens on Windows XP, and 
I'm not sure whether it happens in Windows Vista. Beyond probably wasting 
memory, this currently causes problems in games that can only have one instance 
of them opened at a time (for example, Perfect Cherry Blossom).

For the record, Hourglass calls TerminateProcess with an exit code (after 
giving the process a chance to exit on its own), and it calls 
GetExitCodeProcess to check whether it exited (the OS apparently lies and says 
it has), and Hourglass also terminates the thread that spawned the process 
(which the documentation says is supposed to be guaranteed to kill the process 
as well).

One possible clue is this message I saw posted by someone who had the same 
problem in their project, albeit probably on a different OS:
"TerminateProcess is the right way for a debugger to kill its debuggee. My code 
simply forgot to process a "post mortem" debug event Windows send when the 
process dies. As this event was never retrieved from the event queue, Windows 
could not delete that queue and the process remained in the system."

If no fix can be found for this bug, a last resort workaround would be to make 
Hourglass automatically restart itself when you click Stop if the OS is Windows 
7.

Original issue reported on code.google.com by nitsuja-@hotmail.com on 17 Jul 2011 at 4:41

GoogleCodeExporter commented 9 years ago
In issue 12, you wrote:

"By the way, about issue 11, I think someone reported it fixed (i.e. clicking 
Stop caused the game process to completely exit) on Vista in r15 or r18, but 
maybe it broke again later. It would be great if you could say report how it 
acts for you in those versions. If it was working and I can find out which 
version it stopped working in, it should be easy to fix."

Both versions (r15 and r18 (or is it r19?; download page said the file name was 
wrong)) exhibited the same behavior for all my tests.  I tested both Warp and 
Cave Story for whether these revisions would completely terminate the process 
upon pressing "Stop Running".

Pressing "Stop Running" caused the game windows to close, but the processes to 
remain running (as seen in Process Explorer), so I can see why someone would 
report that the game process completely exited if they didn't know to look at 
an actual process list.

With Cave Story, after the first time pressing "Stop Running", pressing "Run 
and Play Existing Movie" would cause new processes to start (as seen in Process 
Explorer), but no Cave Story window would spawn.  Subsequent "Stop Running" 
presses didn't end these new processes either.

With Warp, subsequent "Stop Running" presses caused new game windows to spawn, 
but the processes just piled up.

Original comment by lexlexlex@gmail.com on 27 Jul 2011 at 2:48

GoogleCodeExporter commented 9 years ago
I recently got a new computer with Windows 7 and I have confirmed that this 
behavior is identical in Windows 7 to its Windows Vista counterpart.

Original comment by lexlexlex@gmail.com on 1 Aug 2011 at 8:25

GoogleCodeExporter commented 9 years ago
Should be fixed in r81.

Original comment by nitsuja-@hotmail.com on 13 Nov 2011 at 9:19