Hey there! I’ve been running into a crash when catching an ObjectDisposedException
on my headless server build.
Uploading Crash Report
ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.UdpClient'.
at System.Net.Sockets.UdpClient.EndReceive (System.IAsyncResult asyncResult, System.Net.IPEndPoint& remoteEP) [0x00013] in <d8cd0ec6fc774382b0a4c707a194e94c>:0
at CNETServer_Server.UDPReceiveCallback (System.IAsyncResult result) [0x0000c] in <165f234f7f1c435db8c1014fbe63cf2e>:0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
CNETServer_Server:UDPReceiveCallback(IAsyncResult)
System.Net.Sockets.<>c:<Complete>b__27_0(Object)
System.Threading.QueueUserWorkItemCallback:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
System.Threading.ThreadPoolWorkQueue:smile:ispatch()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()
It only appears to be a problem in the headless server build - the program gracefully catches/logs the ObjectDisposedException
error just fine in the editor server build, as well as the client build in both cases (editor + built player).
Essentially:
- Client
- Editor: no issues
- Built Player: no issues
- Server
- Editor: no issues
- Built Player (headless): crash
I attached a zip with the .dmp and .log file - my current Unity version is 2019.1.14f1 (I know, I’m a bit behind) since I’ve been working on this game for about 3 years now.
Anyone know how to avoid crashing? I can try just not logging the exception at all, but that seems a bit counterintuitive. I’m trying to have as many helpful logs as possible since my servers are currently running (and also crashing when catching/logging) on Clanforge with Multiplay.
Any help is greatly appreciated! Thank you!
8883042–1213812–server_crash_log_dmp.zip (88.5 KB)
It looks like Debug.Log call crashes from a background thread:
UnityPlayer.dll!memcpy() Line 399 Unknown
UnityPlayer.dll!core::StringStorageDefault<char>::assign(const char * str, unsigned __int64 strLen)
UnityPlayer.dll!core::StringStorageDefault<char>::assign(const core::StringStorageDefault<char> & other)
[Inline Frame] UnityPlayer.dll!core::basic_string<char,core::StringStorageDefault<char>>::assign(const core::basic_string<char,core::StringStorageDefault<char>> &)
[Inline Frame] UnityPlayer.dll!core::basic_string<char,core::StringStorageDefault<char>>::operator=(const core::basic_string<char,core::StringStorageDefault<char>> &)
UnityPlayer.dll!CrashReporting::LogBuffer::RecordLogMessage(const core::basic_string<char,core::StringStorageDefault<char>> & message, unsigned __int64 timestamp, unsigned int framecount, LogType type)
> UnityPlayer.dll!CrashReporting::CrashReporter::HandleLog(const core::basic_string<char,core::StringStorageDefault<char>> & exceptionType, const core::basic_string<char,core::StringStorageDefault<char>> & message, const core::basic_string<char,core::StringStorageDefault<char>> & strippedStacktrace, LogType logType)
UnityPlayer.dll!CrashReporting::CrashReporter::OnLogCallbackStatic(const DebugStringToFileData & messageData, LogType type, bool isMainThread)
[Inline Frame] UnityPlayer.dll!CallbackArray3<DebugStringToFileData const &,enum LogType,bool>::Invoke(const DebugStringToFileData &)
UnityPlayer.dll!DebugStringToFilePostprocessedStacktrace(const DebugStringToFileData & data)
UnityPlayer.dll!DebugStringToFile(const DebugStringToFileData & data)
[Inline Frame] UnityPlayer.dll!DebugStringToFile(const char * const &)
[Inline Frame] UnityPlayer.dll!DebugLogHandler::Internal_Log(LogType)
UnityPlayer.dll!DebugLogHandler_CUSTOM_Internal_Log(LogType level, LogOption options, ScriptingReferenceWrapper<MonoString *> msg, ScriptingReferenceWrapper<MonoObject *> obj)
Unfortunately it seems like you’re on a pretty old version of Unity so even if we fixed it, it wouldn’t be in your version of Unity :(.
1 Like
Hey thanks a bunch for looking at it, and for the reply!
Yeah, I do realize I’m quite a bit behind…about 4 years now…I should have upgraded a while ago, now its to the point where when I tried upgrading I had 999+ errors in the console and a bunch of UI was completely destroyed, so I think there’s no going forward with that, at least until I absolutely have to lol 
I think I may just not log the errors for now. It would be nice to have them, but not having them is better than the build crashing! Lol 
Cheers!