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

Editor crashes while sending data #65

Closed
ziliwap opened this issue Nov 6, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@ziliwap
Copy link

commented Nov 6, 2017

The editor crashes while sending data from UE:
2017-11-06 16_06_21-firstpersoncharacter
I tried both, the "emit" function and the "emit with callback" function. I have a function in place with correct input signatures to receive the callback in case of "emit with callback".

I am receiving the data correctly on the server but I believe its the acknowledgement message handling, that is making the editor crash. I am acknowledging with :
"EventCallback",{"data":"sample text"}

@getnamo

This comment has been minimized.

Copy link
Owner

commented Nov 7, 2017

To send {"data":"sample text"} js object as a callback, your server side javascript should look something like this

io.on('connection', function(socket){
	//...

	//respond to 'my event' on the server
	socket.on('my event', function(message, callback){

		//make an object with {"data":"sample text"}
		let reponseObject = {};
		responseObject['data'] = 'sample text';

		//make a callback function call with the data
		callback(responseObject);	
	});
}

Then ensure you have a valid callback function that matches your function name with SIOJsonValue as it's first parameter (with the function name EventCallback instead of OnEcho as per your setup)
img
see readme section for details: https://github.com/getnamo/socketio-client-ue4#emit-with-callback

If both of those things are correct and you're still getting an error, please provide plugin & ue version and any crash logs under saved/logs

@ziliwap

This comment has been minimized.

Copy link
Author

commented Nov 7, 2017

I am still experiencing the crash with the following log:

Fatal error: [File:D:\Build++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 174]
Ran out of memory allocating 18446744072482788960 bytes with alignment 0

KERNELBASE.dll!0x00000000B10F9E08
UE4Editor-Core.dll!0x00000000687914B4
UE4Editor-Core.dll!0x000000006857AD5B
UE4Editor-Core.dll!0x0000000068510179
UE4Editor-Core.dll!0x00000000683DAFD5
UE4Editor-Core.dll!0x0000000068454062
UE4Editor-Core.dll!0x000000006845426E
UE4Editor-Core.dll!0x000000006837ABE6
UE4Editor-Core.dll!0x0000000068359ACC
UE4Editor-Core.dll!0x000000006835D51E
UE4Editor-CoreUObject.dll!0x00000000740C52BD
UE4Editor-CoreUObject.dll!0x00000000743AD488
UE4Editor-Engine.dll!0x000000006A2DFD5F
UE4Editor-CoreUObject.dll!0x00000000741AEF44
UE4Editor-CoreUObject.dll!0x000000007436DF94
UE4Editor-CoreUObject.dll!0x00000000743832F1
UE4Editor-CoreUObject.dll!0x00000000743ACAF0
UE4Editor-CoreUObject.dll!0x00000000743854D2
UE4Editor-CoreUObject.dll!0x00000000741AEF44
UE4Editor-CoreUObject.dll!0x0000000074384865
UE4Editor-Engine.dll!0x0000000069A3B217
UE4Editor-SocketIOClient.dll!0x0000000054E1EEBB
UE4Editor-SocketIOClient.dll!0x0000000054E1BB0D
UE4Editor-SocketIOClient.dll!0x0000000054E1A909
UE4Editor-SocketIOClient.dll!0x0000000054E231C5
UE4Editor-Core.dll!0x00000000683E24F5
UE4Editor-Core.dll!0x00000000683E27F0
UE4Editor-Engine.dll!0x000000006AAFBA8A
UE4Editor.exe!0x00000000EF696BDA
UE4Editor.exe!0x00000000EF6A3970
UE4Editor.exe!0x00000000EF6A39EA
UE4Editor.exe!0x00000000EF6B02D9
UE4Editor.exe!0x00000000EF6B1C47
KERNEL32.DLL!0x00000000B2A92774
ntdll.dll!0x00000000B4A50D51
ntdll.dll!0x00000000B4A50D51

I am using Flask (have to due to requirements) for the server and the code that I am using is:

@socketio.on('my event')
def echo(message):
    print('My event : ' + str(message))
    return 'EventCallbackString'

I tried cross checking on a browser and I am getting the acknowledgement correctly using the following code in browser:

function clicked() {
    console.log('clicked');

    var resp = socket.emit('my event', {'data':"Some text"}, function name(params) {
    console.log(params);
    });
    console.log(resp);
}

Attaching the log file also.
sampleV.log
UE Version: 4.17.1
Plugin version: "0.6.4"

Edit: Adding UE screenshots.

2017-11-07 14_04_37-firstpersoncharacter_
2017-11-07 14_22_36-firstpersoncharacter_

@getnamo

This comment has been minimized.

Copy link
Owner

commented Nov 7, 2017

Event Callback function should have an SIO Json Value signature parameter, not String. See if that changes things. If not, could you also specify the socket.io server version?

@ziliwap

This comment has been minimized.

Copy link
Author

commented Nov 7, 2017

You are amazing my friend! Yes it did work when the function input was SIO Json Value. My initial thought was if I am simply sending a string why not use a string type. But I stand corrected. Thanks a lot!

@getnamo

This comment has been minimized.

Copy link
Owner

commented Nov 7, 2017

Great!

I want to see though if I can't get this error to spit out a warning instead of crashing and auto-convert to other input types. I'll investigate this possibility before closing the issue.

@getnamo getnamo self-assigned this Nov 7, 2017

@getnamo getnamo added the enhancement label Nov 7, 2017

@getnamo

This comment has been minimized.

Copy link
Owner

commented Nov 8, 2017

Added support for how you thought it worked as 0.6.8: 591c150

Now if you know the type of response you can use it directly in the function signature. String? just add a string signature. Binary? binary, etc
Supported signatures are
int
float
bool
SIOJsonObject
SIOJsonValue
String
Byte Array

Not sure which? you get auto-conversion to e.g. strings automatically. If the signature isn't supported you should now also get a warning instead of a crash.

@ziliwap

This comment has been minimized.

Copy link
Author

commented Nov 8, 2017

Kudos! This makes it a lot more user-friendly. Thanks again for an amazing plugin.

@getnamo

This comment has been minimized.

Copy link
Owner

commented Nov 8, 2017

Still waiting on a few fixes before posting a 4.18 binary.
Closing issue. If you find any bugs with the new version consider re-opening.

@getnamo getnamo closed this Nov 8, 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.