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

Crash in ConnectionHandler.connect() Method of nats.swift file resuming the app from the background or in Idle for random time #86

Open
MayankMintoak opened this issue Sep 27, 2024 · 8 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@MayankMintoak
Copy link

MayankMintoak commented Sep 27, 2024

Observed behavior

Description: The app crashes in the ConnectionHandler.connect() method of nats.swift when the app is either idle for an extended random period or has been moved to the background. Upon resuming or interacting with the app after this idle period, the app crashes, and the crash report points to the connect() method in nats.swift.

Crash Details:

File: nats.swift
Method: ConnectionHandler.connect()
Line: Occurs during reconnection attempt (as seen in the attached screenshot).

Observed Behavior:

The app crashes and navigates to the ConnectionHandler.connect() method in the nats.swift file.

ss

Expected behavior

The connection handler should gracefully handle reconnections or retries without crashing, even after idle or background sessions.

Server and client version

0.3.0

Host environment

No response

Steps to reproduce

Steps to Reproduce:

Open the app.
Let the app remain idle for an unspecified period of time (can vary randomly).
Alternatively, put the app in the background after it is connected.
After the idle period or when resuming the app from the background, try interacting with the app.
The app crashes, and the crash report indicates the ConnectionHandler.connect() method in nats.swift.

@MayankMintoak MayankMintoak added the defect Suspected defect such as a bug or regression label Sep 27, 2024
@piotrpio
Copy link
Contributor

Hello @MayankMintoak, thank you for reporting the issue. I have a few questions:

  1. Could you provide the crash report? That would make it easier for us to reproduce.
  2. Are you suspending and resuming connection when putting the app in background? You can do it in SceneDelegate so that the app does not heep the connection alive when in background:
    func sceneDidBecomeActive(_ scene: UIScene) {
        Task {
            try await natsClient?.resume()
            print("resumed")
        }
    }

    func sceneWillResignActive(_ scene: UIScene) {
        Task {
            try await natsClient?.suspend()
            print("suspended")
        }
    }
  1. What do you mean by "unspecified period of time"? Are there e.g. nats server restarts during this period or any reconnection attempts?

@MayankMintoak
Copy link
Author

MayankMintoak commented Nov 11, 2024 via email

@Jarema
Copy link
Member

Jarema commented Nov 11, 2024

I do not see the crash report.

Please check if it happens with latest release 0.4 - it contains a lot of improvements.

@MayankMintoak
Copy link
Author

MayankMintoak commented Nov 11, 2024 via email

@Jarema
Copy link
Member

Jarema commented Nov 11, 2024

I do not think you are attaching the crash report.

@MayankMintoak
Copy link
Author

MayankMintoak commented Nov 11, 2024 via email

@Jarema
Copy link
Member

Jarema commented Nov 12, 2024

Please try doing it through github.com, not via mail, as neither the report nor the screenshot is attached correctly.

@MayankMintoak
Copy link
Author

Archive 2.zip

Hello @Jarema Please find attached zip file that contains the crash logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

3 participants