Forum C# Problem with: ContextSwitchDeadlock was detected

Problem with: ContextSwitchDeadlock was detected

Postby to_ja_mateusz » March 20th, 2014, 10:20 pm

I have just downloaded new sdk from Yahoo Games Network.
I updated some files in serverside of my game (Player.IO Development Server.exe, Player.IO GameLibrary.dll, Player.IO GameLibrary.xml).
After i run (from Visual c# 2010, in debug mode) my development server, after some short time i have bug:
Code: Select all
ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x113cb80 to COM context 0x113cdd0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.


Please help me.
User avatar
to_ja_mateusz
 
Posts: 5
Joined: February 18th, 2013, 12:35 pm

Re: Problem with: ContextSwitchDeadlock was detected

Postby to_ja_mateusz » March 20th, 2014, 10:28 pm

I found this in output window:
Code: Select all
[size=50]'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'D:\Projekty\TakeControl\server\TestServer\bin\Debug\Test Server.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread '<No Name>' (0x1570) has exited with code 0 (0x0).
The thread '<No Name>' (0x152c) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x159c) has exited with code 0 (0x0).
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'D:\Projekty\TakeControl\server\TestServer\bin\Debug\Test Server.exe', Symbols loaded.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'D:\Projekty\TakeControl\server\TestServer\bin\Debug\Player.IO Development Server.exe'
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'D:\Projekty\TakeControl\server\TestServer\bin\Debug\Player.IO GameLibrary.dll'
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Management.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread '<No Name>' (0x16e8) has exited with code 0 (0x0).
ARG!: + System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\GameServerCache\cache1.bin' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.WriteAllBytes(String path, Byte[] bytes)
   at PlayerIO.ServerCore.identifier33.getCached[T](String name, Func`1 create)
The thread '<No Name>' (0x1590) has exited with code 0 (0x0).
The thread '<No Name>' (0xa94) has exited with code 0 (0x0).
ARG!: + System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\GameServerCache\cache1.bin' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.WriteAllBytes(String path, Byte[] bytes)
   at PlayerIO.ServerCore.identifier33.getCached[T](String name, Func`1 create)
The thread '<No Name>' (0x154c) has exited with code 0 (0x0).
'Test Server.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\Skafiriaki\AppData\Local\Temp\tempgame-259a3f857f334b6d8dacc33b50bac430.dll', Symbols loaded.

Trying last loaded dll

Using Game Dll: TakeControl.dll
========================
(dll: D:\Projekty\TakeControl\server\TestServer\bin\Debug\TakeControl.dll)
The thread '<No Name>' (0x15d0) has exited with code 0 (0x0).
The thread '<No Name>' (0x17f0) has exited with code 0 (0x0).
The thread '<No Name>' (0xa90) has exited with code 0 (0x0).
The thread '<No Name>' (0xd88) has exited with code 0 (0x0).
The thread '<No Name>' (0x16b8) has exited with code 0 (0x0).
Step into: Stepping over non-user code 'System.Threading._TimerCallback.PerformTimerCallback'
The program '[5628] Test Server.vshost.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).
[/size]
User avatar
to_ja_mateusz
 
Posts: 5
Joined: February 18th, 2013, 12:35 pm

Re: Problem with: ContextSwitchDeadlock was detected

Postby frank84 » March 22nd, 2014, 12:57 am

I had the same issue. Completely replaced the sln and Serverside Code folder with the one from Flash\NewGame and then pasted back my code.
frank84
 
Posts: 27
Joined: November 23rd, 2013, 2:09 am


Return to C#



cron