Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect->Disconnect->Connect actions cause game to crash #55

Closed
nomako opened this issue Jul 19, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@nomako
Copy link

commented Jul 19, 2017

Calling Connect action on SocketIOComponent while internal SocketIOClient is disconnecting, causes game/editor to crash with log below.

From epic crash log:

...
C++ EH exception - code e06d7363 (first/second chance not available)

KERNELBASE
VCRUNTIME140
msvcp140
UE4Editor_SocketIOClient!std::thread::join()
UE4Editor_SocketIOClient!sio::client_impl::connect()
UE4Editor_SocketIOClient!<lambda_48c5bfc20a28d488412b9ebe85cab230>::operator()() [d:\unrealprojects\loc416experiments\plugins\socketio-client-ue4.x\source\socketioclient\private\socketionative.cpp:112]
UE4Editor_SocketIOClient!FSIOLambdaRunnable::Run() [d:\unrealprojects\loc416experiments\plugins\socketio-client-ue4.x\source\socketioclient\private\siolambdarunnable.cpp:48]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\build\++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:76]

PS1: If you remove line 29 in SocketIONative.cpp (and fix paren on 113):

...
ConnectionThread = FSIOLambdaRunnable::RunLambdaOnBackGroundThread([&, Query, Headers]
.,.

... the game will only hang in this situation but not crash.

PS2: There is typo in SIOLambdaRunnable.cpp:

FSIOLambdaRunnable::~FSIOLambdaRunnable()
{
	if (Thread == NULL) // <<< Should be Thread != NULL ?
	{
		delete Thread;
		Thread = NULL;
	}

	//Runnables.Remove(this);
}

But it's not an answer to subj :)

@getnamo getnamo self-assigned this Jul 22, 2017

@getnamo getnamo added the bug label Jul 22, 2017

@getnamo

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2017

I believe it can take a while for a disconnect to be fully registered. You can ask to wait for a disconnect by setting bAsyncQuitDisconnect to false which could yield a temporary workaround. Better state management during async disconnect would be ideal, but I don't have a good idea on how to set it up atm. Contributions welcome :)

You are correct about the second part, but delete Thread should probably be removed so an infinity loop doesn't happen. That class needs a good cleanup pass to be honest...

@nmakoto

This comment has been minimized.

Copy link

commented Jul 22, 2017

bAsyncQuitDisconnect will not help coz it's used when SocketIOComponent is being destroyed. Crash appears when I try to call connect method, after disconnect w/o killing component at all.

Now I use some workaround: I just wait then OnDisconnected event triggered after calling Disconnect method. And there continue disconnection logic. But this could be problem, if no event appear (bad internet or so).

@getnamo

This comment has been minimized.

Copy link
Owner

commented Nov 11, 2017

Fixed in f17df08.

Try it out and re-open the issue if the new architecture still has this problem.

@getnamo getnamo closed this Nov 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.