Bug 452596

Summary: Comics widget does not show image
Product: [Plasma] kdeplasma-addons Reporter: Twisted Lucidity <lucidlytwisted>
Component: ComicAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: alexander.lohnau, geoff, kishore96, nate, plasma-bugs, qydwhotmail
Priority: NOR    
Version: 5.24.4   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.5
Attachments: Output when running plasmashell from the terminal

Description Twisted Lucidity 2022-04-14 07:44:48 UTC
SUMMARY
The Comic Strip widget has stopped showing the strip images, noticed after update last night. Other widgets (Weather, System Monitor) seem to be OK.

STEPS TO REPRODUCE
1. Add Comic Strip widget
2. Click on "Configure..."
3. Click on "Get New Comics..."
4. Search for "XKCD" (Note: Errors may be reported)
5. Select "xkcd by mfuchs"
6. Click on "Install"
7. Close the dialog
8. Ensure "XKCD" is ticked in the "General" tab
9. Click "OK"

OBSERVED RESULT
No XKCD image is shown, all you see is the "Configure..." button
Other affected strips include APOD, Calvin and Hobbes, Dilbert, and Garfield

EXPECTED RESULT
To see the selected strip image

SOFTWARE/OS VERSIONS
* Operating System: KDE neon 5.24
* KDE Plasma Version: 5.24.4
* KDE Frameworks Version: 5.93.0
* Qt Version: 5.15.3
* Kernel Version: 5.13.0-39-generic (64-bit)

ADDITIONAL INFORMATION
When I look in the logs I see log of error messages like this:
    Apr 12 08:49:18 neon plasmashell[2193]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/dilbert/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
    Apr 12 08:49:18 neon plasmashell[2193]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/dilbert//metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
I think they are a red herring as on 12th April the widget was working.

As for today, I can see messages like this:
    Apr 14 08:14:55 neon plasmashell[2208]: "Received comic image data."
    Apr 14 08:14:55 neon plasmashell[2208]: "Requesting image for comic 2606 from https://imgs.xkcd.com/comics/weird_unicode_math_symbols.png"
    Apr 14 08:14:55 neon plasmashell[2208]: "Data parsed successfully: {\"month\": \"4\", \"num\": 2606, \"link\": \"\", \"year\": \"2022\", \"news\": \"\", \"safe_title\": \"Weird Unicode Math Symbols\", \"transcript\": \"\", \"alt\": \"U+2A0B \\u2a0b Mathematicians need to calm down\", \"img\": \"https://imgs.xkcd.com/comics/weird_unicode_math_symbols.png\", \"title\": \"Weird Unicode Math Symbols\", \"day\": \"13\"}"
    Apr 14 08:14:55 neon plasmashell[2208]: "Received data from the XKCD API with ID 257"
    Apr 14 08:14:55 neon plasmashell[2208]: "Requesting data for latest comic from https://xkcd.com/info.0.json"
So it looks like something is happening, but no image is getting dislayed.

Finally, I have just seen this when trying to switch to the XKCD tab:
    Apr 14 08:28:15 neon plasmashell[2208]: Either no identifier was specified or the engine could not be created: id "xkcd" engine valid: false
    Apr 14 08:28:15 neon plasmashell[2208]: qml: onCurrentTabChanged:xkcd
Comment 1 Alexander Lohnau 2022-04-14 16:11:09 UTC
The issue is that a path generated by the plugin is not considered a valid URL.

The plugin requests "http://es.xkcd.com../../site_media/strips/survivorship_bias.png" as a URL, which is not considered valid. This malformed value comes from the source of the website.

>Other affected strips include APOD, Calvin and Hobbes, Dilbert, and Garfield

You mean "Square Root of Minus Garfield"? That works fine for me.

I did some big refactorings lately to the code. Maybe you have a case where one malformed comic plugin blocks the entire applet? Please try disabling the xkcd plugin, restart plasmashell and try the other comics.
Comment 2 Twisted Lucidity 2022-04-15 07:22:34 UTC
Thanks for replying, Alexander.

I meant the plain "Garfield" plugin by mfuchs: https://store.kde.org/p/1080450

I removed all comic plugins.
I also ran a full update (no changes were made).
I added "Square root of Garfield".
This failed to show any strip. 
Log:
	Apr 15 08:13:52 neon plasmashell[2204]: Either no identifier was specified or the engine could not be created: id "garfield-sromg" engine valid: false
	Apr 15 08:13:52 neon plasmashell[2204]: "garfield-sromg" has a newer strip.
	Apr 15 08:13:52 neon plasmashell[2204]: "pageRetrieved - id: 1"
	Apr 15 08:13:52 neon plasmashell[2204]: "Next identifier: 47131"
	Apr 15 08:13:52 neon plasmashell[2204]: "Previous identifier: 4712"
	Apr 15 08:13:52 neon plasmashell[2204]: "https://www.mezzacotta.net/garfield/comics/4713.png"
	Apr 15 08:13:52 neon plasmashell[2204]: "pageRetrieved - id: 0"
	Apr 15 08:13:52 neon plasmashell[2204]: "Last identifier: 4713"
	Apr 15 08:13:52 neon plasmashell[2204]: "pageRetrieved - id: 2"
	Apr 15 08:13:51 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/garfield-sromg/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:51 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/garfield-sromg//metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:51 neon plasmashell[2204]: Either no identifier was specified or the engine could not be created: id "garfield-sromg" engine valid: false
	Apr 15 08:13:51 neon plasmashell[2204]: qml: onCurrentTabChanged:garfield-sromg
	Apr 15 08:13:51 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/garfield-sromg/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:51 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/garfield-sromg/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:51 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/garfield-sromg//metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:51 neon plasmashell[2204]: Either no identifier was specified or the engine could not be created: id "" engine valid: false
	Apr 15 08:13:49 neon plasmashell[2204]: qt.qpa.xcb: QXcbConnection: XCB error: 152 (Unknown), sequence: 13257, resource id: 54526115, major code: 144 (Unknown), minor code: 2
	Apr 15 08:13:49 neon plasmashell[2204]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 13256, resource id: 54526101, major code: 143 (Unknown), minor code: 3
	Apr 15 08:13:49 neon plasmashell[2204]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 13255, resource id: 54526101, major code: 2 (ChangeWindowAttributes), minor code: 0
	Apr 15 08:13:49 neon plasmashell[2204]: qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 13254, resource id: 54526101, major code: 144 (Unknown), minor code: 1
	Apr 15 08:13:49 neon plasmashell[2204]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 13253, resource id: 54526101, major code: 143 (Unknown), minor code: 1
	Apr 15 08:13:49 neon plasmashell[2204]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 13252, resource id: 54526101, major code: 3 (GetWindowAttributes), minor code: 0
	Apr 15 08:13:46 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/garfield-sromg/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:46 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/home/name/.local/share/plasma/comics/garfield-sromg/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:46 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/tmp/plasmashell-qjulJt/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:46 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/tmp/plasmashell-unqmbd/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:46 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/tmp/plasmashell-unqmbd//metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:46 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/tmp/plasmashell-AajhFr/metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:46 neon plasmashell[2204]: kf.coreaddons.desktopparser: Unable to find service type for service "Plasma/Comic" listed in "/tmp/plasmashell-AajhFr//metadata.desktop" - service type search directories were ("/home/name/.local/share", "/usr/share/plasma", "/usr/local/share", "/usr/share", "/var/lib/snapd/desktop")
	Apr 15 08:13:43 neon plasmashell[2204]: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/AbstractApplicationItem.qml:92: TypeError: Cannot read property 'background' of null
	Apr 15 08:13:43 neon plasmashell[2204]: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/AbstractApplicationItem.qml:93: TypeError: Cannot read property 'position' of null
	Apr 15 08:13:43 neon plasmashell[2204]: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/ApplicationItem.qml:147:9: QML Shortcut: Shortcut: Only binding to one of multiple key bindings associated with 14. Use 'sequences: [ <key> ]' to bind to all of them.
	Apr 15 08:13:43 neon plasmashell[2204]: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/ApplicationItem.qml:151:9: QML Shortcut: Shortcut: Only binding to one of multiple key bindings associated with 13. Use 'sequences: [ <key> ]' to bind to all of them.
	Apr 15 08:13:43 neon plasmashell[2204]: QCoreApplication::postEvent: Unexpected null receiver
	Apr 15 08:13:43 neon plasmashell[2204]: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/templates/OverlaySheet.qml:219:38: QML FocusScope: Binding loop detected for property "contentItemMaximumWidth"

The log entry that is standing out to me is "Either no identifier was specified or the engine could not be created: id "garfield-sromg" engine valid: false". Unforunately I am not a KDE or QML developer, and so am not sure what is wrong.
Comment 3 Alexander Lohnau 2022-04-15 16:03:01 UTC
The "Unable to find service type for service" parts can be safely ignored, because the conversion still works file (fixed in master for some time now). Please install kdebugsettings, enable full debug for ork.kde.plasma.comic. Then you should get more detailed logs.

>noticed after update last night.

What version did you update from?
Comment 4 Kishore Gopalakrishnan 2022-04-16 15:48:29 UTC
(In reply to Alexander Lohnau from comment #3)
> The "Unable to find service type for service" parts can be safely ignored,
> because the conversion still works file (fixed in master for some time now).
> Please install kdebugsettings, enable full debug for ork.kde.plasma.comic.
> Then you should get more detailed logs.
> 
> >noticed after update last night.
> 
> What version did you update from?

This happened for me after a frameworks update (5.92 -> 5.93). Downgrading plasma-framework to 5.92 fixed the issue for me.
Comment 5 Kishore Gopalakrishnan 2022-04-16 15:52:48 UTC
Created attachment 148190 [details]
Output when running plasmashell from the terminal

@Alexander Lohnau, I went to kdebugsettings and clicked the 'enable all debug' button. After a reboot, output from plasmashell stopped appearing in my system logs (not sure if that's a bug in the way kdebugsettings sets things, or if it's expected behaviour). On killing plasmashell and starting it again from a terminal, this is the text output I got (attached file).
Comment 6 Kishore Gopalakrishnan 2022-04-16 16:18:44 UTC
Reverting this commit (on v5.93.0) fixes the issue for me:

commit 1ec7b42cad831444421cf6b212e61ce1cd555b5b
Author: Alexander Lohnau <alexander.lohnau@gmx.de>
Date:   Sun Mar 6 16:40:43 2022 +0100

    Port dateengine away from inperformant KPluginInfo hack
    
    We do not need to create a QVariantList only to later create a KPluginMetaData
    object from it.
    
    
    (cherry picked from commit af5785be6ac4bf5e383eba9b10dec392231d59f3)

 src/plasma/dataengine.cpp   | 6 +++++-
 src/plasma/dataengine.h     | 2 +-
 src/plasma/pluginloader.cpp | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)
Comment 7 Kishore Gopalakrishnan 2022-04-16 16:19:34 UTC
(In reply to Kishore Gopalakrishnan from comment #6)
> Reverting this commit (on v5.93.0) fixes the issue for me:
> 
> commit 1ec7b42cad831444421cf6b212e61ce1cd555b5b
> Author: Alexander Lohnau <alexander.lohnau@gmx.de>
> Date:   Sun Mar 6 16:40:43 2022 +0100
> 
>     Port dateengine away from inperformant KPluginInfo hack
>     
>     We do not need to create a QVariantList only to later create a
> KPluginMetaData
>     object from it.
>     
>     
>     (cherry picked from commit af5785be6ac4bf5e383eba9b10dec392231d59f3)
> 
>  src/plasma/dataengine.cpp   | 6 +++++-
>  src/plasma/dataengine.h     | 2 +-
>  src/plasma/pluginloader.cpp | 2 +-
>  3 files changed, 7 insertions(+), 3 deletions(-)

Forgot to mention, this is on the plasma-framework repo
Comment 8 Alexander Lohnau 2022-04-16 19:35:03 UTC
For whatever reasons the automatic mention of the MR did not work. Here is the fix: https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/508
Comment 9 Kishore Gopalakrishnan 2022-04-17 02:58:17 UTC
(In reply to Alexander Lohnau from comment #8)
> For whatever reasons the automatic mention of the MR did not work. Here is
> the fix:
> https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/508

Thanks, building from your branch fixes the issue for me.
Comment 10 Alexander Lohnau 2022-04-17 13:12:09 UTC
Git commit c90e49cc98769ca5b9275c089880b3d64f1689c5 by Alexander Lohnau.
Committed on 17/04/2022 at 13:09.
Pushed by alex into branch 'master'.

Fix check for argument length in DataEngine loader

After i wrote the initial patch, we decided that the plasma-frameworks internal code which dumped
the entire KPluginMetaData object as a variant map in the args could be removed.
However, this change was not applied to the sanity check in the latest revision of the MR.

M  +1    -1    src/plasma/dataengine.cpp

https://invent.kde.org/frameworks/plasma-framework/commit/c90e49cc98769ca5b9275c089880b3d64f1689c5
Comment 11 Alexander Lohnau 2022-04-18 04:24:14 UTC
Git commit 27710b95a3fd53019b4b053cbdf720354fd939d2 by Alexander Lohnau.
Committed on 17/04/2022 at 04:45.
Pushed by alex into branch 'Plasma/5.24'.

Remove unneeded check for comic Dataengine being valid

We do not really care, if the metadata of the plugin is valid, as long as we can
properly create the dataengine from it.

Test Plan:
With plasma-frameworks master, and this on Plasma/5.24 based revision, the dataengine can properly be loaded.

When intenitionally exporting a defunct plugin:
```cpp
class Dummy : public QObject
{
    Q_OBJECT

public:
    Dummy(QObject *parent, const QVariantList &args) {
    }
};
K_PLUGIN_CLASS_WITH_JSON(Dummy, "plasma-dataengine-comic.json")
```
The applet does not crash.

M  +2    -2    applets/comic/comic.cpp
M  +1    -1    applets/comic/comicarchivejob.cpp

https://invent.kde.org/plasma/kdeplasma-addons/commit/27710b95a3fd53019b4b053cbdf720354fd939d2
Comment 12 Nate Graham 2022-05-03 16:43:45 UTC
*** Bug 453179 has been marked as a duplicate of this bug. ***
Comment 13 Twisted Lucidity 2022-05-06 07:49:14 UTC
Just to confirm that everything is working again.
The APOD picture today is simply stunning, almost like it is having a wee celebration. :-)
Comment 14 Nate Graham 2022-05-06 12:55:29 UTC
Yes, today's is quite gorgeous! I wish I could ever see it in person, but alas I live in the northern hemisphere and my wee telescope is probably too small anyway.