Closed keiranlovett closed 3 years ago
Thanks @keiranlovett we have a full refresh of this project in development which will be released in the next couple of weeks. I'll check in that rebuilt code whether the same bug exists.
Thanks,
The reason we had identified it was using a similar structure for our own project.
Would you have any ideas for a more immediate fix or workaround until then that we could use?
Sent from my iPhone
On 18 Jan 2021, at 9:55 pm, Chris Molozian notifications@github.com wrote:
Thanks @keiranlovett we have a full refresh of this project in development which will be released in the next couple of weeks. I'll check in that rebuilt code whether the same bug exists.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@novabyte upon more experimentation I've narrowed down what causes the crash.
Taking the example ChatManager.cs
script and removing all content from the method ReceiveMessage
(literally just a debug line included) and then by sending a message while subscribed to ReceivedChannelMessage
like below
NakamaSessionManager.Instance.Socket.ReceivedChannelMessage += ReceiveMessage;
I get a stackoverflow.
HOWEVER
If I put the contents of ReceiveMessage
in the ReceivedChannelMessage
subscription like so:
NakamaSessionManager.Instance.Socket.ReceivedChannelMessage += message =>
{
ChatChannel channel;
string messageContent = "";
//Search for chat channel which should receive message, if it's not created - creates it
....
....
....
};
There is no stackoverflow and everything works as intended. So I believe it is a problem with the Socket implementation itself?
@keiranlovett What version of the Unity client SDK do you use in your project?
This demo project runs an older version than what's recommended. It's part of the update work I mentioned we're in the middle of. In the meantime have a look at this chat example which is code only:
Proposing a closure based on the update you mentioned @novabyte and the chat example you have shared.
@keiranlovett I'll make a note to close this issue as soon as we can open-source the refresh I mentioned to this demo project. 👍
@keiranlovett The refresh to the project is now complete. I'll close this issue but have a look at this code and re-open if you still have issues.
Problem
When sending a chat message the Unity editor hangs unexpectedly. There are no errors in
Editor.log
as this occurs making it a bit harder to debug.Some testing has narrowed things to
ChatManager.cs
for lineUnityMainThreadDispatcher.Instance().Enqueue(() => ReceiveMessage(message));
By removing
UnityMainThreadDispatcher
and simply usingReceiveMessage(message);
you get a stackoverflow error. However I'm imagining this is for the purposeUnityMainThreadDispatcher
was meant for. Happy to help provide any more context as needed.