UFO: Alien Invasion Issue Tracker
UFO: Alien Invasion
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png UFO: Alien Invasion / Closed Bug report #2767 GroundCombat->end print-stats press-key|mouse->freeze-game
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "Not determined".
Issue basics
  • Type of issue
    Bug report
  • Category
    Battlescape
  • Targetted for
    Not determined
  • Status
    Closed
  • Priority
    5. Important
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
  • Estimated time
    Not estimated
Issue details
  • Resolution
    Not determined
  • Reproducability
    Not determined
  • Severity
    Not determined
  • Complexity
    Not determined
  • Platform
    Not determined
  • Architecture
    Not determined
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description
[http://sourceforge.net/p/ufoai/bugs/2767 Item 2767] imported from sourceforge.net tracker on 2013-01-28 19:47:16

http://ufoai.ninex.info/forum/index.php?topic=5677.0

Binary revision status is
commit 44da92a73850683eaeabf78730093aa08cc19093
Date: Wed Jan 5 07:00:18 2011 +0100

* fixed campaigns ui window id

-------------------------------------------------------------

If a ground combat has ended stat increase show up.
If you press a key (mouse or keyboard) during that, the game will freeze (ufo.exe is not responding [0% CPU usage])

You need to kill ufo.exe and restart the mission

Nothing in the logs
===== Comments Ported from Sourceforge =====

====== dodon (2011-01-08 20:41:03) ======

Looks like the bug "Mission Hanging on completion - ID: 3048626" was reintroduced or not realy solved in the first place
====== dodon (2011-04-18 16:44:32) ======

Here is a stacktrace of the last active thread, when ufo.exe freezes. C::B does not show any usefull stacktraces for all the other threads.

#0 7C91E514 ntdll!LdrAccessResource() (... ntdll.dll:??)
#1 7E3694BE USER32!GetWindowLongA() (... user32.dll:??)
#2 7E37C174 USER32!SetPropW() (... user32.dll:??)
#3 7E37F40B USER32!SendMessageA() (... user32.dll:??)
#4 0052BA89 Sys_ConsoleOutput(text=0x20c7ed7a "") (...\src\ports\windows\win_console.c:148)
#5 004FDC4E Com_vPrintf(fmt=0x6b493eef "[STATS] %s\n", ap=0x20c7fd4c "\200RSk\200RSk%") (...\src\common\common.c:373)
#6 0052EC28 SV_dprintf(fmt=0x6b493eef "[STATS] %s\n") (...\src\server\sv_game.c:42)
#7 00000000 0x6b45bfa2 in G_PrintStats(buffer=0x6b535280 "Soldier Sying Snow N earned 300 experience points in skill #4 (total experience: 19230) (...\src\game\g_utils.c:251)
#8 6B454984 G_UpdateCharacterSkills(chr=0xfb51000) (...\src\game\g_match.c:149)
#9 6B454CD5 G_MatchSendResults(team=1) (...\src\game\g_match.c:225)
#10 6B45508C G_MatchDoEnd() (...\src\game\g_match.c:311)
#11 6B454412 G_RunFrame() (...\src\game\g_main.c:442)
#12 0052FACD SV_RunGameFrame() (...\src\server\sv_game.c:568)
#13 0052FA7E SV_RunGameFrameThread(data=0x0) (...\src\server\sv_game.c:553)
#14 6810A4AC SDL_strtod() (...\SDL.dll:??)
#15 00000000 0x00000000 in ??() (??:??)
====== tlh2000 (2011-04-19 20:10:53) ======

[quote]OK, confirmed in a recent compile on Windows (NOT Muton's last build that IIRC is ~ a month old).

Pressing the "end turn" key right after killing the last alien, but before any resolution-type of screen comes up, freezes the game.

I could do this by simply starting a skirmish that only had one alien to start with.[/quote]

see http://ufoai.ninex.info/forum/index.php?topic=5885.15;topicseen
====== tlh2000 (2011-04-20 18:47:32) ======

i can't reproduce this. kill all aliens with:

sv debug_showall (gives you all living aliens)
debug_killteam 7 X (where X is the amount of aliens -1)

now you only have to kill the last alien and can try to reproduce it. i did so and it worked fine in skirmish. are you playing a campaign? skirmish or multiplayer?
====== tlh2000 (2011-04-20 18:48:20) ======

the last comment was just a quote from the forum - ignore the "i can't reproduce this... "
====== tlh2000 (2011-04-20 19:17:56) ======

I'll toss in my experience with this bug as well. I'm running Vista and 2.4-dev. I installed the game using http://ufoai.ninex.info/snapshots/ufoai-latest-win32.exe , and updated just the binaries on April 11 with http://ufoai.ninex.info/snapshots/ufoai-latest-win32.zip .

You can actually issue commands after the last alien is killed, but only for a brief moment. The freeze occurs if you try to take action while the game is adding up experience points for that mission, which starts ~1 second after the last kill. As a workaround, I've started opening up the console after a few kills to see if it's running the experience totals. That's where the delay between the last kill and the victory screen comes from.
====== tlh2000 (2011-04-20 19:23:06) ======

maybe a threading issue on windows Sys_ConsoleOutput is called by teh game.dll and the ufo.exe to print something to the console.
====== dodon (2011-04-20 22:46:37) ======

I think this is a Windows-only problem.

For a test I replaced all calls of SendMessage in Sys_ConsoleOutput with PostMessage.
That breaks the loging in several subtyle ways but the game does not freeze anymore. (PostMessage adds a message to the Messagequeue while SendMessage additionaly waits till the message is handled and then continues the execution)
====== dodon (2011-04-25 18:56:04) ======

I think i figured out what happens.
I could not get a stacktrace for the primary thread so this is only an educated guess.

P: is the primary thread. It handles all messages to windows.
S: is the thread associated to cvar sv_threads

After the last alien ist killed the following happens:
S: SV_RunGameFrameThread(sv_game.c): locks svs.serverMutex
S: G_UpdateCharacterSkills(g_match.c): the score for the game is calculated (this takes several seconds on my mashine)
As part of the G_UpdateCharacterSkills a line for every entity and every skill is loged to (stats.log and) the ufoconsole.
Several calls to SendMessage are a part of this.

The user is oblivious to the end of the game and goes on playing.
P: calculates a message for the server from the useraction and sends it.
P: recieves the message for the server and tries to process it.
P: in SV_ExecuteClientMessage(sv_user.c) the threadexecution stops because svs.serverMutex is locked
S: if the thread is still in G_UpdateCharacterSkills the execution stops with the next call of SendMessage.
DEADLOCK.

The problem is that SendMessage stops the execution of the active thread till the message is handled. But in our case the primarythread waits at svs.serverMutex.

As an emediate fix remove the line (at least for windows)
gi.DPrintf("[STATS] %s\n", buffer);
from G_PrintStats(g_utils.c). This removes the loging to ufoconsole.
G_PrintStats is used in other parts of the program so this is not the best solution.

As loging is a part of the problem something similar can happen every time a message is loged.
====== tlh2000 (2011-04-26 04:56:33) ======

thanks for the info - but removing that line is imo no option. we would only hide that problem better and maybe never find it again.
====== tlh2000 (2011-05-04 10:29:55) ======

i might have a fix for this - please test a796b1da2544febf3e620369f5721610c2fceecf and let me know if it works. i don't have windows and thus can't test this. so i need your feedback
====== crepitus (2011-05-07 00:28:41) ======

I'd been using SendNotifyMessage.

a796b1da2544febf3e620369f5721610c2fceecf worked for me. I've tried to crash it with mouse and keyboard input after killing the last alien, but failed. It ends the missions much faster, there used to be a delay of about 30 seconds whilst it dumped out the stats.
====== tlh2000 (2011-05-07 05:41:00) ======

could you maybe create a patch for SendNotifyMessage?
====== tlh2000 (2011-05-07 08:24:01) ======

i've added a mutex for the dbuffer access in sv_log.c now
====== sf-robot (2011-05-18 11:20:09) ======

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Steps to reproduce this issue
Nothing entered.
Todos (0 / 0)
Issue created
footer_logo.png The Bug Genie 4.3.1 | Support | Feedback spinning_16.gif