-
Notifications
You must be signed in to change notification settings - Fork 40
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
Sending large amount of data disconnects socket with CLOSE_REASON_NORMAL #10
Comments
That is a strange one, if you run the project in c++ debug mode, you can pop a breakpoint on e.g. https://github.com/getnamo/socketio-client-ue4/blob/master/Source/SocketIOClient/Private/SocketIONative.cpp#L375 and catch it when it closes and then traverse up the stack to get a bit more information. I do suspect some buffer limit, but at least on local tests I've done, I haven't had issues with ~25meg dumps between socket.io connections, there might be something else that is adding to this issue. What unreal and plugin versions are you using? Are you connecting on a local network or across the internet? This might help trying to repro issue |
I am running unreal engine 4.27.2 (Version: 4.27.2-18319896+++UE4+Release-4.27), and most recent commits in ml-remote-server c0d6c90 I am running the server locally. Trace back (note this does not always happen, it seems sending even larger images fails without even hitting the "CLOSE_REASON_NORMAL" path.
seems to be failing on
Not sure how to access the "External Code" Because that seems to trigger this. Thanks! |
Try latest socketio plugin (v1.10 for ue4.27 or v2.3.0 for ue5) and see if issue persists |
Thanks for the help (and useful libraries)! I tried this for both UE4.27.2 UE5 5.0.1, both fail in the same way. Right now I'm working around this by writing the image to disk, but that's slow and generally not great. More reproduction details and failed attempts (has anyone tried reproducing?): The UE5 project failed to compile,
I commented out that line ( //Socket->ClearCallbacks();), and it compiled, but still had the bug on large files. I created a simple test script in the Server/ml-remote-server/Scripts from mlpluginapi import MLPluginAPI
import unreal_engine as ue
#MLPluginAPI
class ExampleAPI(MLPluginAPI):
#optional api: setup your model for training
def on_setup(self):
ue.log('hello on_setup')
pass
#optional api: parse input object and return a result object, which will be converted to json for UE4
def on_json_input(self, input):
ue.log('hello on_json_input')
return {}#{'something':'something'}
#optional api: parse input object and return a result object, which will be converted to json for UE4
def add_image(self, input):
ue.log('hello add_image. len(input): ' + str(len(input)))
return "Return"
#optional api: start training your network
def on_begin_training(self):
ue.log('hello on_begin_training')
pass
#NOTE: this is a module function, not a class function. Change your CLASSNAME to reflect your class
#required function to get our api
def get_api():
#return CLASSNAME.get_instance()
return ExampleAPI.get_instance() I tried with python 3.9.12 python -m venv .venv37
source .venv/Scripts/activate
python -m pip install python-socketio==4.3.1
python -m pip install aiohttp==3.6.1 Using python-socketio==4.3.1 created this error:
Upgrading python-socketio with
I'll also dump a blueprint code that will generate a large array to crash it (same as screenshot above, except using SIOJLibrary instead of RealTimeImport
|
Ok really useful and detailed feedback, thanks. I'll try to compile an updated matched version and do some large data tests, but it will likely be a week before I have some results due to full schedule. |
Hello, I was experiencing a similar issue to this and doing the following fixed it for me Hope this helps. |
Thanks @jacobay43! Curiously this fix boosts the size I can send without disconnect ~3x, but not more. Changing these values to be very large does not seem to have further improvement. I also tested This makes me wonder if there's some deeper max buffer size, though grepping for this doesn't lead to anything obvious. Of course these values could be dependent on my particular hardware / setup. That setting is a definite improvement, though its still pretty small images without compression. |
You are right. After extensive testing, I found it only boosted the size without disconnecting to a maximum of 4 - 5 times. But I feel a solution may be in a certain configuration of parameters for EngineIO in the AsyncServer constructor |
@reidsanders, I tried approaching the problem from another angle and it seems to work. Rather than looking for a way to prevent it from disconnecting, I implemented a custom reconnect function, although this will require that you edit the source code of the plugin and rebuild the solution. Then go to your project directory and open the following file in your editor Add the following method prototype to the class declaration: Then open the following file Add the following method body Then build your project solution in Visual Studio or XCode After that Create an Hope this helps! |
In UE logs all I see is
On the server end:
Basic function used to capture 512x512 TextureRenderTarget2D (using Realtime Import)
Or with no other plugins (need to increase the "infinite loop" detector threshold to ~1e9).
Unfortunately this is very little to go on. Are there other logs that may help shed light on this (and where are they located)? A verbose mode?
I suspect some sort of max buffer size or timeout, but I haven't been able to find anything like that.
Thanks!
The text was updated successfully, but these errors were encountered: