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

Socket.sendHeartbeat() EXC_BAD_ACCESS (KERN_INVALID_ADDRESS) #253

Open
michael-simonetta opened this issue Feb 1, 2024 · 3 comments
Open

Comments

@michael-simonetta
Copy link

Seeing an intermittent crash with SwiftPhoenixClient on Socket.sendHeartbeat()

Version: SwiftPhoenixClient 5.3.2

@dsrees
Copy link
Collaborator

dsrees commented Feb 12, 2024

do you have a stacktrace?

@KaylaBrady
Copy link

I have encountered this issue as well with the below stack trace

HeartbeatTimer.start (HeartbeatTimer.swift:81)
Socket.resetHeartbeat (Socket.swift:799)
Socket.onConnectionOpen (Socket.swift:660)
Socket.onOpen (Socket.swift:852)
Socket (<compiler-generated>:851)
URLSessionTransport.urlSession (PhoenixTransport.swift:248)

@KaylaBrady
Copy link

I have seen some other potentially related heartbeat errors:

EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)
PhoenixTransport?
Socket.connectionState.getter (Socket.swift:243)
Socket.isConnected.getter (Socket.swift:238)
Socket.sendHeartbeat (Socket.swift:807)
closure in Socket.resetHeartbeat (Socket.swift:800)
SIGABRT
 Object 0x303285e60 of class HeartbeatTimer deallocated with non-zero retain count 3. This object's deinit, or something called from it, may have created a strong reference to self which outlived deinit, resulting in a dangling reference

Socket (<compiler-generated>:851)
Socket.onOpen (Socket.swift:852)
Socket.onConnectionOpen (Socket.swift:660)
Socket.resetHeartbeat (<compiler-generated>)

I haven't been able to reproduce locally, but one theory is that it may be from calling socket.onOpen in quick succession.

Socket.swift#L252 Checks if the socket is connected, but if the socket is in .connecting state, perhaps that creates some heartbeat-related race conditions when calling Socket.connect() in quick succession? The js client checks if the conn exists, not whether it has connected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants