cancel
Showing results for 
Search instead for 
Did you mean: 

UE 4.17 and crash on server side

m_milazzo
Protege
I have a matchmaking pool and it worked well with UE 4.16. A side creates a session and another finds and joins it.
I'm still able to create and join a session, but, since the update to UE 4.17, the server side crashes after some seconds the client has joined the session. It crashes only when using the Oculus subsystem and a matchmaking session (works well when using the Null subsystem and a normal session).

It crashes with this error
[2017.09.08-10.24.01:995][ 94]LogWindows: Error: === Critical error: ===
[2017.09.08-10.24.01:995][ 94]LogWindows: Error:
[2017.09.08-10.24.01:996][ 94]LogWindows: Error: Assertion failed: HasReceivedClientPacket() [File:D:\Build\++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\Engine\Private\NetConnection.cpp] [Line: 684]

So the problem is the method HasReceivedClientPacket() in the NetConnection class.
This method has been introduced in UE 4.17 (it does not exist in 4.16) and this is what it does:
FORCEINLINE bool HasReceivedClientPacket()
{
return !!InternalAck || Driver->ServerConnection != nullptr || InReliable[0] != InitInReliable;
}

May you investigate on this problem?
9 REPLIES 9

opus_studio
Explorer
Here's an image of my response because this stupid garbage forum won't allow me to post with either images, attachments, both or neither because... I have no fucking idea... because my post is too long??? Wasted so much time trying to post this...

1jisd5imb9ag.png

Edit: Now after so much frustration this is what I am allowed to post?!?
Prohibiting developers from writing useful bug reports is just another great Oculus idea I guess.
Maybe I can also attach the 16 kb project ZIP file here... Let's try...

Edit: Duh... this is just bonkers... You really need to fix your 'spam filter'... gah!

opus_studio
Explorer
I can confirm that since UE 4.17 the OculusNetDriver/OculusNetConnection part of the OnlineSubsystemOculus is broken. The matchmaking in FOnlineSessionOculus still works as mentioned but the P2P communication part broke due to the way networking changed in 4.17.

In shipping builds where the assertion Checks() are not performed the server does not crash but a client is never able to connect. A connection is started but the client never even receives the UE4 welcome packet so it doesn't even load into the same map as the server. It just stays waiting forever (without any timeout ever) and the server seemingly so too. Nothing ever arrives in the game logic code side about a new connection as the engine seems to not be able to process anything from the connection at all (no controller, pawn or playerstate getting constructed or spawned even on the server).

I'm attaching a very minimal example project I used to test this with two .uproject files for 4.16 and 4.17 in which the key [1] hosts a session and starts a server and the key [2] searches for a session and connects to it. After connection the host should spawn a new pawn for the client and on the client side the map should reload while receiving the replicated actors. To compile it make sure to set OculusAppId and OculusMyPoolName in DefaultEngine.ini. The matchmaking pool should be of type 'Browse' because the join code searches open sessions and joins the first session found.

Here's how it looks on 4.16:6hya9p9tc3ol.png

And on 4.17:ega2zd0q7fy3.png
(in shipping builds the crash reporter does not appear but the screens show the same on both server and client)

Here's the full stack trace for the assertion on the server:
Assertion failed: HasReceivedClientPacket() [File:D:\Build\++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\Engine\Private\NetConnection.cpp] [Line: 684]

UE4Editor_Core!FDebug::AssertFailed()
UE4Editor_Engine!UNetConnection::FlushNet()
UE4Editor_Engine!UNetConnection::WriteBitsToSendBuffer()
UE4Editor_Engine!UNetConnection::SendAck()
UE4Editor_Engine!UNetConnection::ReceivedPacket()
UE4Editor_Engine!UNetConnection::ReceivedRawPacket()
UE4Editor_OnlineSubsystemOculus_Win64_DebugGame!UOculusNetDriver::TickDispatch()
UE4Editor_Engine!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float)>::ExecuteIfSafe()
UE4Editor_Engine!TBaseMulticastDelegate<void,float>::Broadcast()
UE4Editor_Engine!UWorld::Tick()
UE4Editor_Engine!UGameEngine::Tick()
UE4Editor!FEngineLoop::Tick()
UE4Editor!GuardedMain()
UE4Editor!GuardedMainWrapper()
UE4Editor!WinMain()
UE4Editor!__scrt_common_main_seh()
kernel32
ntdll

Thanks for looking into this.

opus_studio
Explorer
I can confirm that since UE 4.17 the OculusNetDriver/OculusNetConnection part of the OnlineSubsystemOculus is broken. The matchmaking in FOnlineSessionOculus still works as mentioned but the P2P communication part broke due to the way networking changed in 4.17.

In shipping builds where the assertion Checks() are not performed the server does not crash but a client is never able to connect. A connection is started but the client never even receives the UE4 welcome packet so it doesn't even load into the same map as the server. It just stays waiting forever (without any timeout ever) and the server seemingly so too. Nothing ever arrives in the game logic code side about a new connection as the engine seems to not be able to process anything from the connection at all (no controller, pawn or playerstate getting constructed or spawned even on the server).

I created a very minimal example project I used to test this with two .uproject files for 4.16 and 4.17 in which the key [1] hosts a session and starts a server and the key [2] searches for a session and connects to it. After connection the host should spawn a new pawn for the client and on the client side the map should reload while receiving the replicated actors. To compile it make sure to set OculusAppId and OculusMyPoolName in DefaultEngine.ini. The matchmaking pool should be of type 'Browse' because the join code searches open sessions and joins the first session found.

Here's how it looks on 4.16: us.v-cdn.net/6024342/uploads/editor/4e/6hya9p9tc3ol.png

And on 4.17: us.v-cdn.net/6024342/uploads/editor/vb/ega2zd0q7fy3.png
(in shipping builds the crash reporter does not appear but the screens show the same on both server and client)


Also here's the full stack trace for the assertion on the server:
Assertion failed: HasReceivedClientPacket() [File:D:\Build\++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\Engine\Private\NetConnection.cpp] [Line: 684]

UE4Editor_Core!FDebug::AssertFailed()
UE4Editor_Engine!UNetConnection::FlushNet()
UE4Editor_Engine!UNetConnection::WriteBitsToSendBuffer()
UE4Editor_Engine!UNetConnection::SendAck()
UE4Editor_Engine!UNetConnection::ReceivedPacket()
UE4Editor_Engine!UNetConnection::ReceivedRawPacket()
UE4Editor_OnlineSubsystemOculus!UOculusNetDriver::TickDispatch()
UE4Editor_Engine!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float)>::ExecuteIfSafe()
UE4Editor_Engine!TBaseMulticastDelegate<void,float>::Broadcast()
UE4Editor_Engine!UWorld::Tick()
UE4Editor_Engine!UGameEngine::Tick()
UE4Editor!FEngineLoop::Tick()
UE4Editor!GuardedMain()
UE4Editor!GuardedMainWrapper()
UE4Editor!WinMain()
UE4Editor!__scrt_common_main_seh()
kernel32
ntdll

Thanks for looking into this.

PS: I really I wanted to attach the project (16kb ZIP file) and embed the
two images into this post but the forum just says 'Your post will be
seen once it is approved' for a few
short seconds in the lower left corner and it keeps my post here as a
draft. I missed the message at first and thought it was buggy so I just
submitted it a few times. Now I learn about some invisible verification
status which apparently even keeps developer from making useful bug
reports... This really doesn't help the frustration with Oculus...

brian_jew
Expert Protege
Thanks for the sample project.  I'm able to repro the problem and am looking into how to fix this.

brian_jew
Expert Protege
@bernhardschellingopu

Update: found out what's causing the server side to crash and it has to do with the first bunch of packets sent by the client machine to be invalid.

Working on both an actual fix and seeing if there's a workaround to help unblock you all in the meantime.

opus_studio
Explorer
@brian_jew

Thank you for investigating and for the good news!

If the fix you are preparing is contained inside Engine/Plugins/Online/OnlineSubsystemOculus then I can just put it in our code base as we are using a customized OSS plugin anyway (to get avatar images, etc.). On the other hand if the fix touches the UE4 core engine code I guess we'd need to wait for EPIC to integrate that as we're not running custom engine builds.
Cloning the plugin and placing it in the project directory is fairly easy so that could be a workaround for others as well.

Thanks again,
- Bernhard

brian_jew
Expert Protege
>If the fix you are preparing is contained inside Engine/Plugins/Online/OnlineSubsystemOculus

Good news, it is contained to just that plugin folder.  You can pull it from our github: 
https://github.com/Oculus-VR/UnrealEngine/tree/4.17/Engine/Plugins/Online/OnlineSubsystemOculus

opus_studio
Explorer

brian_jew said:

Good news, it is contained to just that plugin folder.  You can pull it from our github: https://github.com/Oculus-VR/UnrealEngine/tree/4.17/Engine/Plugins/Online/OnlineSubsystemOculus




Good stuff! I merged the changes in OculusNetDriver.h, OculusNetDriver.cpp and OculusNetConnection.cpp into our customized plugin and preliminary tests show networking as working fine again (connection established, joined, actors replicated, etc.).



For anyone interested into incorporating this fix into their own C++ project, you can move the engine plugin into your project.

1. Create a directory named 'Plugins' in your project directory

2. Create a directory 'OnlineSubsystemOculusCustom' inside 'Plugins'.

3. Copy all of https://github.com/Oculus-VR/UnrealEngine/tree/4.17/Engine/Plugins/Online/OnlineSubsystemOculus into it.

4. Rename 'OnlineSubsystemOculus.uplugin' to 'OnlineSubsystemOculusCustom.uplugin'.

5. Modify your .uproject file and change the 'Enabled' state of 'OnlineSubsystemOculus' to false and add an entry for your local 'OnlineSubsystemOculusCustom'. Example:

        { "Name": "OnlineSubsystemOculus", "Enabled": false },

        { "Name": "OnlineSubsystemOculusCustom", "Enabled": true },



Thanks again for the fix!

- Bernhard

Anonymous
Not applicable




For anyone interested into incorporating this fix into their own C++ project, you can move the engine plugin into your project.

1. Create a directory named 'Plugins' in your project directory

2. Create a directory 'OnlineSubsystemOculusCustom' inside 'Plugins'.

3. Copy all of https://github.com/Oculus-VR/UnrealEngine/tree/4.17/Engine/Plugins/Online/OnlineSubsystemOculus into it.

4. Rename 'OnlineSubsystemOculus.uplugin' to 'OnlineSubsystemOculusCustom.uplugin'.

5. Modify your .uproject file and change the 'Enabled' state of 'OnlineSubsystemOculus' to false and add an entry for your local 'OnlineSubsystemOculusCustom'. Example:

        { "Name": "OnlineSubsystemOculus", "Enabled": false },

        { "Name": "OnlineSubsystemOculusCustom", "Enabled": true },



Thanks again for the fix!

- Bernhard


Thank you guys. I would just like to say that I was having the same problem in unreal 4.18. By doing what @bernhardschellingopu said, but instead copying the OnlineSubsystemOculus from the 4.18 branch of Oculus github repo and renaming as a custom plugin, I was able to have the bug fixed too 😃