Closed wilg closed 7 years ago
Hi wilg, I'll investigate this one first thing tomorrow.
Could you give me any code which might reproduce it? You mentioned you're accessing IsMuted
for example, what are you doing with that which is potentially causing the crash?
I was simply toggling a UI element to reflect that state. I'm working on an app that works on iOS, macOS, and Windows using the UNET HLAPI plugin. I've experienced crashes on both macOS and iOS.
When it does connect, I also get these sporadically on all platforms (though the actual audio seems to sound pretty good and does in fact work on all platforms):
[Dissonance:Network] HlapiServer: Failed to send a message
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Dissonance.Logs:SendLogMessage(String, LogLevel)
Dissonance.Log:WriteLog(LogLevel, String)
Dissonance.Log:Error(String)
Dissonance.Integrations.UNet_HLAPI.HlapiServer:Send(ArraySegment`1, HlapiConn, Byte)
Dissonance.Integrations.UNet_HLAPI.HlapiServer:SendUnreliable(HlapiConn, ArraySegment`1)
Dissonance.Networking.BaseServer`3:Dissonance.Networking.Server.IServer<TPeer>.SendUnreliable(TPeer, ArraySegment`1)
Dissonance.Networking.Server.PacketRouter`1:ProcessVoiceData(TPeer, PacketReader&)
Dissonance.Networking.BaseServer`3:NetworkReceivedPacket(TPeer, ArraySegment`1)
Dissonance.Integrations.UNet_HLAPI.HlapiCommsNetwork:PreprocessPacketToServer(ArraySegment`1)
Dissonance.Integrations.UNet_HLAPI.HlapiClient:Send(ArraySegment`1, Byte)
Dissonance.Integrations.UNet_HLAPI.HlapiClient:SendUnreliable(ArraySegment`1)
Dissonance.Networking.BaseClient`3:SendUnreliableDataPackets()
Dissonance.Networking.BaseClient`3:Update()
Dissonance.Networking.Session:Update()
Dissonance.Networking.BaseCommsNetwork`5:Update()
Dissonance.Integrations.UNet_HLAPI.HlapiCommsNetwork:Update()
On second thoughts I don't think reading DissonanceComms:IsMuted
can possibly be the cause of the problem - the complete implementation of that property is:
[SerializeField]private bool _isMuted;
public bool IsMuted
{
get { return _isMuted; }
set { _isMuted = value; }
}
The big error log you pasted in your first post shows abort
being called deep inside the stacktrace of the mono GC - so my guess is this is actually a runtime bug and Dissonance is doing something which trips up the GC. I've encountered an issue like that with mono once before - it garbage collected lambda functions which were only kept alive in a event handler, so when the event handler fires it tries to invoke null memory and causes a segfault
. If something is happening occasionally which triggers a fairly rarely run event handler to fire. For example...
I also get these [HLAPI errors] sporadically
If that throws an exception the network system will catch it and raise an event. Obviously the error event handler is fairly rarely used and so it's a good candidate for mono garbage collecting it and no one normally noticing.
Could you try toggling the Comms network component for the server off and on again. Doing this should be handled by this error path and, if everything is working, will kick off all the clients and trigger all of their error paths (they should reconnect once the server comes back). Could you try doing that a few times (leaving 10s or so each time for everything to set itself back up) to see if it triggers the error.
If that's not fruitful could you try looking through your log file for any of the messages printed by this method in the HLAPI. Ultimately this is what Dissonance is using and if that method returns false Dissonance prints the Failed to send a message
error you are seeing.
Are you using the voice activation detector? I discovered a thread safety issue to do with how the VAD state is polled. However if this was going to cause an error I would expect a segfault (EXC_BAD_ACCESS
on Mac) which isn't the problem we have here.
I'm going to do a review around thread safety and the audio preprocessor just to make sure no other issue have slipped through, just to make sure.
Edit:: Actually it is the problem we have here. It's not the trap in coreaudio, but it is the mono_sigsegv_signal_handler
which ultimately results in abort being called. Could you try running without the VAD (if indeed you are using it).
Yes, I am using voice activation. I'll try without it, thanks! (Though it's a VR app so push-to-talk is ultimately impractical). Apologies for not getting that additional information to you yet.
Disabling voice activation seems to have fixed the crashes. What do you think is a timeline on the fix? Also does the fix you discovered impact Windows (I've seen crashes there as well.) Thanks!
Hi wilg,
Thanks very much for testing that for us. :+1:
I'll do a complete check of the thread safety around the native bits (VAD/Preprocessor/Codec) within the next couple of days (it might slip to Monday if my current work takes longer than expected). Could you send me your order number and I'll get you the a test version as soon as possible :)
Edit: Sent on Monday 2017-08-14
Dissonance 3.0.0 has just released on the Unity asset store, this includes the changes made to resolve this issue so I'll close it now. If the problem persists please feel free to continue posting in this thread. If you're happy with how this issue was handled please consider rating and reviewing us on the asset store!
Context
I'm regularly getting crashes on macOS and sometimes Windows when connecting to a network server. It's unfortunately sporadic.
I've included the mac crashdump (note the trap in coreaudio). Not sure it's 100% the cause but I commented out the portion of my code that accesses
IsMuted
and it doesn't seem to crash.Your Environment
Include as many relevant details about the environment you experienced the bug in
Dissonance version used: 2.0.0
Unity version: 2017.1.0f3
Editor Operating System and version: macOS 10.12.6