You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are encountering a crash in the NATS Swift client, specifically when the app is in the background for extended periods or idle without activity. The crash log shows the following error: Fatal error: SWIFT TASK CONTINUATION MISUSE: sendClientConnectInit() tried to resume its continuation more than once, throwing NatsServerError(description: 'Authentication Timeout')
It appears that the continuation in the sendClientConnectInit() method is being resumed more than once, possibly due to background disconnections or authentication timeouts.
This happens after leaving the app idle for extended periods or when it is in the background. The crash is not consistently reproducible but occurs intermittently, sometimes while the app is still in the background and sometimes when it’s brought back to the foreground.
Here's the code:
`public class NatsManager {
static let shared = NatsManager()
let serverURL = "nats://dev-events-aub.mintoak.com:4222"
private var client: NatsClient?
func connect() {
let client = NatsClientOptions()
.url(URL(string: serverURL)!)
.nkey("SUAHCEFNHKYV7DDFH4XHBPJUWNRSLB6I5QEXZUIXEQNSS3BJSMR5DFU2MI")
.build()
client.on(.connected) { event in
print("NATS connection established")
}
let task = Task.init {
do {
try await client.connect()
self.client = client
print("Successfully connected to NATS server")
} catch {
print("Failed to connect to NATS server: \(error)")
}
}
}`
Note: The crash seems to occur more frequently when the app is left idle or in the background for long periods but without a specific pattern that consistently reproduces it.
Thank you!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Observed behavior
We are encountering a crash in the NATS Swift client, specifically when the app is in the background for extended periods or idle without activity. The crash log shows the following error:
Fatal error: SWIFT TASK CONTINUATION MISUSE: sendClientConnectInit() tried to resume its continuation more than once, throwing NatsServerError(description: 'Authentication Timeout')It appears that the continuation in the sendClientConnectInit() method is being resumed more than once, possibly due to background disconnections or authentication timeouts.
This happens after leaving the app idle for extended periods or when it is in the background. The crash is not consistently reproducible but occurs intermittently, sometimes while the app is still in the background and sometimes when it’s brought back to the foreground.
Here's the code:
`public class NatsManager {
static let shared = NatsManager()
let serverURL = "nats://dev-events-aub.mintoak.com:4222"
private var client: NatsClient?
Note: The crash seems to occur more frequently when the app is left idle or in the background for long periods but without a specific pattern that consistently reproduces it.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions