Game Development Community

Deadlock during startup

by Lyndon Howie · in Torque Game Builder · 08/03/2009 (11:28 am) · 4 replies

I downloaded the latest 1.7.4 release of TGB and it hangs on startup (before displaying a window or anything). I built the code, and when i pause the debugger after the hang, i get the following popup "The process appears to be deadlocked (or is not running any user-mode code). All threads have been stopped." There is only a single thread running when i break into the debugger.
The callstack is stopped at a call to (sockets) bind() with a few levels of system stuff above:

ntdll.dll!_KiFastSystemCallRet@0()
ntdll.dll!_NtDeviceIoControlFile@40() + 0xc bytes
mswsock.dll!_WSPBind@16() + 0x163 bytes
ws2_32.dll!_bind@12() + 0x4d bytes
> TorqueGameBuilder.exe!Net::bind(int socket=5576, unsigned short port=0) Line 635 + 0xe bytes C++

If i build and run the debug version it runs fine and doesn't deadlock.
I don't think it's an issue with my firewall or any other apps i have running, as i've tried to run the release version with all those apps disabled or not running, and get the same issue, and also the debug version runs fine with all those other apps running. Most annoyingly, it's impossible to kill the process, it doesn't die when stopping debugging, and task manager, process explorer, command line can't kill it either, it just keeps sitting there chewing 100% CPU.
I'm running XP SP3, Windows SDK 6.1, Directx SDK March 2009, Visual Studio 2008.
Intel Core2 Duo E8500, 3GB Ram, ATI Radeon HD 4800
Console log follows at the end.

Anyone experienced this in the past, or tips on how i might track down the cause of this issue?
Cheers,
Lyndon

Console log
/-------------------------- 7/30/2009 -- 09:59:34 -----
Processor Init:
Intel Pentium III, ~3.20 Ghz
(timed at roughly 3.22 Ghz)
FPU detected
MMX detected
SSE detected

Math Init:
Installing Standard C extensions
Installing Assembly extensions
Installing FPU extensions
Installing MMX extensions
Installing SSE extensions

Input Init:
DirectInput enabled.

Initializing chunk mappings...
o 'TEXT' maps to TextChunk
o 'SCHK' maps to UnknownChunk
o 'SCHK' maps to SimChunk
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/tgb/common/main.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/tgb/tools/main.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/tgb/common/preferences/defaultPrefs.cs.
Reading Display Device information...
Primary Display Device Found:
Vendor Id: VEN_0000
Device Id: DEV_0000

Using OpenGL rendering. Fullscreen: 0

Executing C:/Documents and Settings/Lyndon/Application Data/GarageGames/TorqueGameBuilder/commonPrefs.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/tgb/common/gameScripts/common.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/tgb/common/gameScripts/audio.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/tgb/common/gameScripts/canvas.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/tgb/common/gameScripts/cursor.cs.
Binding server port to default IP

#1
08/03/2009 (3:47 pm)

Hmm, don't know why it runs fine in the debug version, but either allowing the TGB exe access to your IP or setting $pref::Net::BindAddress to the loopback IP (127.0.0.1) should probably do the trick.
#2
08/04/2009 (7:07 am)
Tried setting the bind address in commonPrefs.cs, no luck. Not quite sure what you mean by allowing the TGB exe access to my IP...
Cheers
#3
08/06/2009 (10:06 am)
My solution to this was to change the source to use winsock 2 instead of winsock 1. This just requires changing WSOCK32.lib to WS2_32.lib in the linker inputs, replacing winsock.h with winsock2.g, and also #including <winsock2.h> before <windows.h> in the platformWin32.h.
Worked for me anyway :)
#4
08/07/2009 (3:42 am)

Glad you found the solution. My thinking definitely followed down the wrong road.