Open edcolmar opened 1 year ago
I worked around this by adding a check for obj_ptr. It avoids the crash, and seems to be working. I'm not sure what effect this might have to the rest of the codebase.
sio_socket.cpp line 407:
const object_message* obj_ptr = static_cast<const object_message*>(p.get_message().get());
if (obj_ptr)
{
const map<string, message::ptr>* values = &(obj_ptr->get_map());
auto it = values->find("sid");
if (it != values->end()) {
m_socket_id = static_pointer_cast<string_message>(it->second)->get_string();
}
}
Likely needs more context (e.g. socket.io host type) because it appears the packet you receive on connection has an empty object returned, which isn't standard socket.io server spec IIRC. The if barrier is valid workaround, but it does mean m_socket_id might not be filled in your connection setup, which means if you access socketid later on it will likely be invalid.
Likely needs more context (e.g. socket.io host type) because it appears the packet you receive on connection has an empty object returned, which isn't standard socket.io server spec IIRC. The if barrier is valid workaround, but it does mean m_socket_id might not be filled in your connection setup, which means if you access socketid later on it will likely be invalid.
Thanks for the response. Is this due to incorrect setup client side? Or a server running an old/incompatible version?
Suspecting a non standard server, e.g. a incomplete spec python server maybe? Check that it support socket.io protocol v3+
I'm updating my code to 5.1.0 and I'm getting a crash on connect. I'm using NativeClient within c++
Win10 development client build, VS 2022
Exception thrown: read access violation. obj_ptr was nullptr.
Top of the call stack:
My Code:
FSIOConnectParams Params; Params.AddressAndPort = InAddressAndPort; //Params.Path = InPath; //Params.AuthToken = InAuthToken; Params.Query = USIOMessageConvert::JsonObjectToFStringMap(Query); Params.Headers = USIOMessageConvert::JsonObjectToFStringMap(Headers); NativeClient->Connect(Params);
Also maybe related?
NativeClient->OnConnectedCallback = [this](const FString& InSocketId, const FString& InSessionId ) { FCULambdaRunnable::RunShortLambdaOnGameThread([this, InSocketId, InSessionId] { if (this) { bIsConnected = true; SessionId = InSessionId; SocketId = InSocketId; bIsHavingConnectionProblems = false; } }); };