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 after re-invoking startAsync() after stop() function is called #54

Open
N7k opened this issue Jul 25, 2024 · 2 comments
Open

Crash after re-invoking startAsync() after stop() function is called #54

N7k opened this issue Jul 25, 2024 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers test Tests implementation

Comments

@N7k
Copy link

N7k commented Jul 25, 2024

Hello!

We are utilizing the Eclipse Hara DDIClient library alongside the HawkBit server to perform OTA updates on our devices. Our implementation adheres to the examples provided in the repository. The update process works well with the startAsync() function. However, we encounter issues when using the stop() function. Let me describe the process in detail.

  1. We invoke the startAsync() function to begin the OTA update process.
  2. During the update, if we call the stop() function to interrupt the process (e.g., when a file has started downloading), for instance, by UX needs, then re-invoke startAsync() (after reinitializing the HaraClient as per the documentation), and at some point during the following downloading process, the application crashes.

Steps to Reproduce:

  1. Initialize the HaraClient.
  2. Call startAsync() to begin the OTA update process.
  3. During the update (e.g., when a file is downloading), call the stop() function to interrupt the process.
  4. Reinitialize the HaraClient.
  5. Call startAsync() again, then wait.

The application crashes with the following exception:

FATAL EXCEPTION: DefaultDispatcher-worker-4
Process: com.hara.test.haratest, PID: 1206
kotlinx.coroutines.channels.ClosedSendChannelException: Channel was closed
    at kotlinx.coroutines.channels.Closed.getSendException(AbstractChannel.kt:1107)
    at kotlinx.coroutines.channels.AbstractSendChannel.helpCloseAndResumeWithSendException(AbstractChannel.kt:230)
    at kotlinx.coroutines.channels.AbstractSendChannel.access$helpCloseAndResumeWithSendException(AbstractChannel.kt:19)
    at kotlinx.coroutines.channels.AbstractSendChannel.sendSuspend(AbstractChannel.kt:220)
    at kotlinx.coroutines.channels.AbstractSendChannel.send(AbstractChannel.kt:136)
    at kotlinx.coroutines.channels.ChannelCoroutine.send(Unknown Source:2)
    at org.eclipse.hara.ddiclient.api.actors.FileDownloader.feedback(FileDownloader.kt:178)
    at org.eclipse.hara.ddiclient.api.actors.FileDownloader.access$feedback(FileDownloader.kt:31)
    at org.eclipse.hara.ddiclient.api.actors.FileDownloader$checkDownloadProgress$1$1.invokeSuspend(FileDownloader.kt:161)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@1f2110f, Dispatchers.Default]

Additionally, after calling the stop() function, the following logs appear:

2024-07-25 11:30:57.237   946-1029  System.err              com.hara.test.haratest               W  [DefaultDispatcher-worker-5] INFO org.eclipse.hara.ddiclient.api.actors.RootActor - Actor rootActor exiting.
2024-07-25 11:30:57.241   946-1029  System.err              com.hara.test.haratest               W  [DefaultDispatcher-worker-5] INFO org.eclipse.hara.ddiclient.api.actors.NotificationManager - Actor notificationManager exiting.
2024-07-25 11:30:57.242   946-1078  System.err              com.hara.test.haratest               W  [DefaultDispatcher-worker-4] INFO org.eclipse.hara.ddiclient.api.actors.ConnectionManager - Actor connectionManager exiting.
2024-07-25 11:30:57.245   946-1030  System.err              com.hara.test.haratest               W  [DefaultDispatcher-worker-6] INFO org.eclipse.hara.ddiclient.api.actors.ActionManager - Actor actionManager exiting.
2024-07-25 11:31:19.229   946-1030  System.err              com.hara.test.haratest               W  [DefaultDispatcher-worker-6] ERROR org.eclipse.hara.ddiclient.api.actors.DownloadManager - Error processing message in actor downloadManager, actor exiting. error: class java.util.concurrent.CancellationException message: ActorCoroutine was cancelled
2024-07-25 11:31:19.230   946-1078  System.err              com.hara.test.haratest               W  [DefaultDispatcher-worker-4] ERROR org.eclipse.hara.ddiclient.api.actors.DeploymentManager - Error processing message in actor deploymentManager, actor exiting. error: class java.util.concurrent.CancellationException message: ActorCoroutine was cancelled
2024-07-25 11:31:19.233   946-1078  System.err              com.hara.test.haratest               W  [DefaultDispatcher-worker-4] ERROR org.eclipse.hara.ddiclient.api.actors.UpdateManager - Error processing message in actor updateManager, actor exiting. error: class kotlinx.coroutines.JobCancellationException message: Parent job is Cancelling

Environment:

Library version: 2.0.0
Android version: 34
Devices: Emulators, EVT Device

@N7k N7k changed the title Crash on re-invoking startAsync() after stop() function is called Crash after re-invoking startAsync() after stop() function is called Jul 25, 2024
SaeedRe added a commit that referenced this issue Aug 5, 2024
This commit fixes the crash when haraClient is stopped during the
 Downloading/Updating state due to actors were not closed properly.
 (Reported in #54)

UF-930
Signed-off-by: Saeed Rezaee <saeed.rezaee@kynetics.it>
SaeedRe added a commit that referenced this issue Aug 5, 2024
This commit fixes the crash when haraClient is stopped during the
 Downloading/Updating state due to actors were not closed properly.
 (Reported in #54)

UF-930
Signed-off-by: Saeed Rezaee <saeed.rezaee@kynetics.it>
SaeedRe added a commit that referenced this issue Aug 5, 2024
This commit fixes the crash when haraClient is stopped during the
 Downloading/Updating state due to actors were not closed properly.
 (Reported in #54)
Added unit tests for the applied fix

UF-930
Signed-off-by: Saeed Rezaee <saeed.rezaee@kynetics.it>
SaeedRe added a commit that referenced this issue Aug 5, 2024
This commit fixes the crash when haraClient is stopped during the
 Downloading/Updating state due to actors were not closed properly.
 (Reported in #54)
Added unit tests for the applied fix

UF-930
Signed-off-by: Saeed Rezaee <saeed.rezaee@kynetics.it>
@diegorondini diegorondini self-assigned this Aug 7, 2024
@diegorondini diegorondini added bug Something isn't working good first issue Good for newcomers test Tests implementation labels Aug 7, 2024
@diegorondini
Copy link
Contributor

Hello @N7k

thanks for reporting this issue!

Can you please try the latest build from the dev branch (https://github.com/eclipse-hara/hara-ddiclient/tree/dev) that includes a fix for this?
https://jitpack.io/#eclipse-hara/hara-ddiclient/dev-de34262b2d-1

Looking forward to your feedback.

@N7k
Copy link
Author

N7k commented Sep 3, 2024

Hello @diegorondini,

Sorry for the delayed response, and thank you for addressing the issue! I've tested the latest build from the dev branch and am pleased to confirm that it resolves the problem. Everything appears to be working smoothly now.

Could you also let me know when the next official release is planned? It would be helpful for our deployment timeline.

Thanks again for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers test Tests implementation
Projects
None yet
Development

No branches or pull requests

2 participants