openhab/openhab-ios

App crashing using custom icons v2.4.41

Closed this issue · 9 comments

iOS openHAB app crashes when displaying custom icons with latest version 2.4.41 (iOS 15.3.1). This doesn't happen with version 2.4.36 (same sitemap), iPadOS 15.3.1

Describe the bug
App crashes, when using custom icons.

Following error shows in openhab.log

2022-02-14 11:22:35.166 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - Problem with writing the data, class org.openhab.core.io.rest.sitemap.internal.PageDTO, ContentType: application/json 2022-02-14 11:22:35.167 [ERROR] [internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request. java.io.IOException: Close SendCallback@15c6dbd[PROCESSING][i=HTTP/1.1{s=200,h=2,cl=-1},cb=org.eclipse.jetty.server.HttpChannel$SendCallback@d62ab9] in state PROCESSING at org.eclipse.jetty.util.IteratingCallback.close(IteratingCallback.java:428) ~[bundleFile:9.4.43.v20210629] at org.eclipse.jetty.server.HttpConnection.onClose(HttpConnection.java:519) ~[bundleFile:9.4.43.v20210629] at org.eclipse.jetty.io.ssl.SslConnection.onClose(SslConnection.java:378) ~[bundleFile:9.4.43.v20210629] at org.eclipse.jetty.io.SelectorManager.connectionClosed(SelectorManager.java:345) ~[bundleFile:9.4.43.v20210629] at org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint.run(ManagedSelector.java:1104) ~[bundleFile:9.4.43.v20210629] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.43.v20210629] at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.43.v20210629] at java.lang.Thread.run(Thread.java:834) [?:?]

Sitemap line causing the crash:
Text item=Sonos_Arbeitszimmer_Titel label="Sonos Titel [%s]"

item definition:
String Sonos_Arbeitszimmer_Titel "Titel" <sonos_title> (gEG_Arbeitszimmer) {channel="sonos:PLAY3:RINCON_:currenttitle"}

When i change the icon to e.g. the app won't crash. I have icon definitions for png and svg in the $OPENHAB_CONF/icons/classic folder, permissions 664 openhab:openhab.

To Reproduce
Every time a sitemap is accessed with a custom icon the app crashes. This does not happen in the old ios version or in web browser.

Expected behavior
Sitemap display without crash.

Screenshots
Openhab_app_screenshot
Openhab_MainUI_Item_Channel

App (please complete the following information):

  • Version 2.4.41 creates crash, version 2.4.36 works fine.

Smartphone (please complete the following information):

  • Device: iPhone 11

openHAB (please complete the following information):

  • Version 3.2.0

Additional context
sonos_title
sonos_title

We have numerous reports on our app crashing on non-compliant SVG icons.
We however rely on SVGKit and the limitations of this framework.
I just committed an attempt to get the rendering more robust. @weakfl : Can you build a TestFlight release out of develop branch.
On another tone: your SVG embeds a PNG. What is the advantage of using SVG over PNG in this case?

Thanks for your quick feedback. What makes the svg icon non-compliant or how can i create a compliant svg icon?

I use both icons as in the past years some UI's used png some svg (Android, iOS, Web).

SVGKit reports the following error @exception = Found an SVG tag that points to a non-existent element. Missing element: id = _Image2". This error can be easily solved by reordering the content of the file. For instance like this:
jingle_valid.

@dirkbe Please try latest testflight
It should handle uncompliant svg gracefully.

Thanks for following up Tim. The testflight app doesn't crash anymore but also doesn't display the icon - probably the expected behavior. I'll see if i can rearrange the file content to display correct according to your example above.

I could also workaround by changing the icon app settings to png but on another iphone i don't see that option (more investigation on app version, etc. needed...)

Yes, OH iOS app 2.4.42 latest beta handles gracefully a non-compliant SVG file, and will replace it by blank icon. We could give more feedback to the user. 🤔 you could open a new issue if this is relevant

@timbms I think displaying some kind of "broken SVG" icon as a placeholder would be good. Makes it a lot easier for the users to know what's going wrong.

Yes we could use OH error icon

Yes, good idea.