[4.3] Sending a FQuat over network without setting it to a variable crashes the game

Dear Friends at Epic,

This is one of those really odd network bugs!

#Server Function

UFUNCTION(reliable, server, WithValidation)
void SERVER_SetGoalRotation(FQuat NewRot);

#This crashes the Game

SERVER_SetGoalRotation(Dir.Rotation().Quaternion());

#This Doesnt

const FQuat Yipeee = Dir.Rotation().Quaternion();
SERVER_SetGoalRotation(Yipeee);

#Log

Log just states the line number, no useful info, its one of those new-window crashes, no actual useful log info

#Why?!

I have no idea why just this small change prevents game from crashing and makes everything work!

Why would a non variable-ized FQuat crash the game when passed over network?

Are you certain SERVER_SetGoalRotation is not taking a reference? If constructed inside the parameter list, this could cause an issue. In the second case, it still could be an issue if the function held onto the reference, but is less likely to crash (but still bad to do).

This is complete random guessing here :slight_smile:

Without a callstack, this will be hard to diagnose. Can you run this under the debugger under development or debug, and see if it will produce a callstack?

I am positive it was not by reference, but it is great to hear from you , as always!

I will look more into this soon as I can, but if anyone else sees this or can duplicate this let me know!

Also I was testing in 4.3 when this happened

#Thanks !

#Reproduced in 4.4.1

I was able to reproduce this crash again just now!

#Test in Tick

I put this code in the Character’s Tick function!

#This Works

FQuat HappyQuat = GetTransform().GetRotation();
SERVER_SetGoalRotation(HappyQuat);

#This Doesnt

//Local Sends updates to Server!
SERVER_SetGoalRotation(GetTransform().GetRotation());

#Server Func

UFUNCTION(reliable, server, WithValidation)
void SERVER_SetGoalRotation(FQuat NewRot);
	
UPROPERTY(Replicated)
FQuat GoalRotation;


bool AFlightCharMovement::SERVER_SetGoalRotation_Validate(FQuat NewRot)
{
	return true; 
}
void AFlightCharMovement::SERVER_SetGoalRotation_Implementation(FQuat NewRot)
{
	GoalRotation = NewRot;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//							Replication List
void AFlightCharMovement::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
{
	Super::GetLifetimeReplicatedProps( OutLifetimeProps );

	//GoalRotation
	DOREPLIFETIME(AFlightCharMovement, GoalRotation);
	
}

#Crash

!Id:2f33e7f1183c0ad9152e06fe66b1204d

Access violation - code c0000005 (first/second chance not available)

Fatal error!

UE4Editor_GalaxyHeist!AFlightCharMovement::SERVER_SetGoalRotation() + 10 bytes [e:\ue4clients\scriptingscrub\galaxy\ghrepo\intermediate\build\win64\inc\galaxyheist\galaxyheist.generated.cpp:190]
UE4Editor_GalaxyHeist!AFlightCharMovement::Tick() + 797 bytes [e:\ue4clients\scriptingscrub\galaxy\ghrepo\source\galaxyheist\public\flightcharacter\flightcharmovement.cpp:322]
UE4Editor_GalaxyHeist!AFlightCharTurrets::Tick() + 14 bytes [e:\ue4clients\scriptingscrub\galaxy\ghrepo\source\galaxyheist\public\flightcharacter\flightcharturrets.cpp:128]
UE4Editor_GalaxyHeist!AFlightChar::Tick() + 23 bytes [e:\ue4clients\scriptingscrub\galaxy\ghrepo\source\galaxyheist\public\flightcharacter\flightchar.cpp:114]

#FQuat Not Replicating in 4.4, Client->Server

Actually unlike 4.3 where it still worked if I do above workaround, in 4.4.1 it looks like FQuat is not replicating at all going from client back to server

it works great from server to client!

I know this sounds strange but I’ve just tested with an FRotator under the exact same conditions and the Rotator replicates both ways, unlike FQuat

Epic?

?

Anybody?

:wink:

Just a shot in the dark, but might it have something to do with FQuat being 16 byte aligned?

I’m not sure, I hope Epic fixes it!

Thanks for the input !

Hey -

Are you still seeing this same crash in the latest version of the engine? Let us know if you are and if so could you include the callstack and log files.

Cheers

Hi ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.