socket.io-client-swift icon indicating copy to clipboard operation
socket.io-client-swift copied to clipboard

v16 EXC_BAD_ACCESS

Open danylovaolha opened this issue 4 years ago • 5 comments

Hello,

We expirience an issue after updating to v16.0.0.

Previously we used v15.2 and this code worked:

var connectParams = ["apiKey": apiKey, "clientId": clientId, "userToken": userToken]
self.socketManager = SocketManager(socketURL: url, config: ["path": path, "connectParams": connectParams])                    
self.socketManager?.reconnects = false
self.socket = self.socketManager?.socket(forNamespace: path)

But after updating to v16 this issue occurs:

socket

Even if I try to create a totally new socket manager and socket - it crashes. Also I've noticed that something weird happens when trying to print out the config right after creating the SocketManager - it goes to the setConfigs method and crashes with invaliderror:

Screenshot 2021-02-11 at 13 16 23

Maybe we have something wrong with our config, but it worked fine with v15.2.

Could you please help? Thanks!

danylovaolha avatar Feb 11 '21 10:02 danylovaolha

Make sure you're only changing properties on the handleQueue. Any interaction with the manager/client should happen on that queue.

Also, your server needs to be socket.io 3, or pass .version(.two) as an option.

nuclearace avatar Feb 12 '21 16:02 nuclearace

Could you please clarify about the handleQueue? Doesn't the previous version 15.2 work the same way?

danylovaolha avatar Feb 15 '21 12:02 danylovaolha

@olgadanylova In theory yes, but it's always a good idea to make sure you're on the same queue to avoid races. Is that error message from a debug build? Sometimes optimized builds can give erroneous crash points because of the optimizations.

Also what version is your server?

nuclearace avatar Feb 16 '21 14:02 nuclearace

We use v2 on our server. But I don't think the issue is connected to the server version.. Just can't figure out right now what is the reason of crash and why it works fine with v15.2 and crashes with 16.0. Anyway its ok for us right now to stay on v15.2 and we'll try to fix this issue somehow for the future. Just wanted to clarify if there should be any code changes to make it work.

danylovaolha avatar Feb 18 '21 08:02 danylovaolha

@olgadanylova v16 client would require .version(.two) to connect with a socket.io 2 server. There were some changes to engine message parsing that could cause issues like this.

nuclearace avatar Feb 18 '21 14:02 nuclearace