2

I have a PDF with a link to a web page, that used to work (it would open the link in firefox, via xdg-open). However, when I click it now, literally thousands of xdg-open processes are started and plasma-desktop runs at 100% cpu.

I don't know how to start troubleshooting this. What could cause this issue?

An example of a problem PDF is here.

Here is a screenshot of what happens. Note the corrupted taskbar due to thousands of xdg-open instances Here is a screenshot of what happens. Note the corrupted taskbar due to thousands of xdg-open instances

6
  • In which application are zou trying to open it. – Bruni Sep 22 '15 at 12:05
  • Firefox is my default web browser, so in this case it would be firefox. – Supernormal Sep 22 '15 at 12:08
  • I am using Kubuntu 14.04 and browsed the pdf through firefox and the link opened just fine in my case. Could you please show us a screenshot regarding your issue? – Raphael Sep 22 '15 at 12:14
  • Ubuntu 14.04, FF 40.0.3 works as expected. Same if I download and open with evince. Have you tried the latter? – Bruni Sep 22 '15 at 12:21
  • I don't think it's a problem with the PDF, but rather with my configuration of KDE, and xdg-open in particular. I've added a screenshot in the question now. – Supernormal Sep 22 '15 at 12:47
3

I just encountered the same issue, but then for opening a mailto: link. The approach to debug the problem is probably similar to yours, however.

First, find what handles the mailto (or in your case, http) scheme:

$ xdg-mime query default x-scheme-handler/mailto
kmailservice5.desktop

Now, what is kmailservice5.desktop?

$ locate kmailservice5.desktop
/usr/share/applications/kmailservice5.desktop

Opening the above file shows:

[Desktop Entry]
Type=Application
Exec=kmailservice5 %u
Icon=mail-message-new
MimeType=x-scheme-handler/mailto;

X-DocPath=kioslave5/mailto/index.html
NoDisplay=true

# KMailService is the handler for mailto URLs
Name=KMailService
...

I wonder what kmailservice5 does?

$ kmailservice5 --help
   xdg-open -- opens a file or URL in the user's preferred
   application

Synopsis

   xdg-open { file | URL }

   xdg-open { --help | --manual | --version }

Use 'man xdg-open' or 'xdg-open --manual' for additional info.

This is exactly the same output as xdg-open --help! That's weird... I looked up the source of kmailservice5 and found http://api.kde.org/frameworks-api/frameworks5-apidocs/kio/html/kmailservice_8cpp_source.html. It is a simple application that calls QDesktopServices::openUrl https://doc.qt.io/qt-5/qdesktopservices.html#openUrl (In KDE4, the mail application was explicitly invoked via KToolInvocation::invokeMailer; My partial upgrade to KDE5 is probably the reason for this breakage).

In other words, mailto:... opens the handler of mailto:, which opens the handler of mailto:, etc. This never ends and the only way to end this loop was to issue killall kde-open plasma-desktop.


To solve the issue I created a robs-mailto.desktop with the following content:

[Desktop Entry]
Type=Application
Exec=kdialog --msgbox "Rob's mailto handler: %u"
Icon=mail-message-new
MimeType=x-scheme-handler/mailto;

Name=RobsMailtoHandler

and registered it as follows:

$ xdg-mime default robs-mailto.desktop x-scheme-handler/mailto

and verified that it was correctly registered:

$ xdg-mime query default x-scheme-handler/mailto
robs-mailto.desktop

$ xdg-open mailto:test@example.com
# (opened a KDialog window that printed the email address, as I specified)
2
1

Yes, don't make xdg-open the preferred application. Because the job of xdg-open is to find out the preferred application. Infinite recursion ensues.

In other words, xdg-open is a "client" of the mime/apps preference system. One has to specify somewhere what actually is the preferred application, and that can't possibly be xdg-open itself.

Did you set xdg-open as preferred app for text/html, or was that done by your distro?

0

It seems the culprit was a bad setting in Dolphin, where the default "open as" action for html files was xdg-open, which I guess caused an infinite loop. After changing the default program to Firefox instead, it works as expected.

I would have thought that having selected Firefox in "System Settings / Default Programs" would have sufficed, but apparently not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.