How to debug a suddenly closing/crashing appdesigner app

13 次查看(过去 30 天)
I am working on an more or less complex appdesigner application wich controls a test stand in a laboratory. So I can not give an example or reproduce the error.
After a random runtime of 10 min. to 2 h the app closes without any message, so I am not sure if I should call this a "crash". The first error message comes from a listener that can not execute since the object was deleted.
By setting a breakpoint in the delete(app) function, created by appdesigner, I was able get a callstack.
"MyApp.mlapp fcn: MyApp.delete ;line 1686"
"FigureController.m fcn: FigureController.onViewKilled ;line 820"
"FigurePlatformHost.m fcn: FigurePlatformHost.onViewKilled ;line 59"
"CEFFigurePlatformHost.m fcn: @(event,data)this.onViewKilled() ;line 94"
"Callback.m fcn: Callback.execute ;line 128"
"webwindow.m fcn: webwindow.onCustomEvent ;line 1528"
"webwindow.m fcn: @(source,data)obj.onCustomEvent(data.Type,data.Data) ;line 349"
"Channel.m fcn: Channel.onCustomEvent ;line 575"
"Channel.m fcn: @(source,data)obj.onCustomEvent(data.Type,data.Data) ;line 473"
The Channel file is \+matlabshared\+asyncio\+internal\Channel.m
In the last line of the callstack, the "Custom" Event of the Channel is raised. The event data is
data.Type = "processExit"
data.Data = struct with fields: exitStatus: 3
The event source is a asyncioimpl.Channel, which is a c++ implementation of the Channel and the debugger can not look into this.
Is there any way of tracing the cause of this error?
Thank you for your help!

回答(1 个)

Aniket
Aniket 2024-8-16
Hi @Marco,
I understand from your description that the App Designer application is closing unexpectedly after certain time, which might be related to memory issues.
When an application frequently updates its components, it can lead to increased memory consumption over time. This can sometimes cause the application to close without warning if the system runs out of available memory.
In this case, if the app is using label fields, there's a known issue where these fields can cache previous values, contributing to memory buildup. This can eventually lead to the application closing unexpectedly.
To address this, a workaround is to replace label fields with edit fields or to remove label fields from grid layouts. This change can help manage memory usage more effectively and prevent unexpected closures.
This bug has been resolved in MATLAB R2023b update 6 and R2024a. For more details, you can check the bug report at:
Hope it helps!

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by