Bug 329740 - Okular hangs in presentation mode when displaying PDFs when default printer is not accessible
Summary: Okular hangs in presentation mode when displaying PDFs when default printer i...
Status: CONFIRMED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 0.19.1
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 341118 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-01-09 00:25 UTC by Philipp Hagemeister
Modified: 2017-07-20 11:37 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
gdb backtrace during hang (4.08 KB, application/octet-stream)
2014-01-10 10:51 UTC, Philipp Hagemeister
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hagemeister 2014-01-09 00:25:56 UTC
When I run okular to show a PDF file (doesn't matter which,
http://www.debian.org/doc/manuals/debian-faq/debian-faq.en.pdf for example) and
select VIew -> Presentation (or press Ctrl+Shift+P), the screen that okular is
configured to present on is covered by a gray window. This only happens for PDF files, eps/ps/jpg/txt files do not exhibit the behavior.

I cannot interact with this window (Pressing B, Esc, or clicking does nothing), and the main
window stops repainting or reacting to mouse or keyboard commands as well.
strace-ing shows

open("/etc/cups/client.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 14
setsockopt(14, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(14, SOL_SOCKET, 0xf /* SO_??? */, [1], 4) = -1 ENOPROTOOPT (Protocol
not available)
setsockopt(14, SOL_TCP, TCP_NODELAY, [1], 4) = 0
fcntl(14, F_SETFD, FD_CLOEXEC)          = 0
fcntl(14, F_GETFL)                      = 0x2 (flags O_RDWR)
fcntl(14, F_SETFL, O_RDWR|O_NONBLOCK)   = 0
connect(14, {sa_family=AF_INET, sin_port=htons(631),
sin_addr=inet_addr("10.125.2.134")}, 16) = -1 EINPROGRESS (Operation now in
progress)
fcntl(14, F_SETFL, O_RDWR)              = 0
poll([{fd=14, events=POLLIN|POLLOUT}], 1, 250) = 0 (Timeout)
poll([{fd=14, events=POLLIN|POLLOUT}], 1, 250) = 0 (Timeout)
poll([{fd=14, events=POLLIN|POLLOUT}], 1, 250) = 0 (Timeout)
poll([{fd=14, events=POLLIN|POLLOUT}], 1, 250) = 0 (Timeout)
poll([{fd=14, events=POLLIN|POLLOUT}], 1, 250) = 0 (Timeout)
....


10.125.2.13 is a printer that my cups seems to have picked up automatically,
but is not reachable at the moment. After 30 seconds (or immediately if I'm not
connected to a network), okular renders the presentation and resumes working.
Printing or Print preview show the same symptoms (minus the grey window). Full
Screen works fine.

While waiting for anything from the network before rendering UI is a bad idea,
I could understand that if I would actually want to print. There should be no
need to contact the printer upon entering presentation mode.

Reproducible: Always

Steps to Reproduce:
1. Open a PDF document
2. Press Ctrl+Shift+P

Actual Results:  
Okular is unresponsible for 30 seconds

Expected Results:  
When entering presentation mode, not contact the printer in the first place.
When entering the printing dialog: Contacting the printer asynchronously or in another thread.

debian sid
Comment 1 Albert Astals Cid 2014-01-09 22:18:13 UTC
That's really weird.

Can you please do this?

Install gdb and okular debug symbols package

gdb okular
write "run" in the gdb command line
now load your pdf and enter the preview mode
when everything is unresponsive, switch back to the gdb terminal, press Ctrl+C and type "thread apply all bt" and attach the output here.
Comment 2 Philipp Hagemeister 2014-01-10 10:51:35 UTC
Created attachment 84551 [details]
gdb backtrace during hang
Comment 3 Philipp Hagemeister 2014-01-10 10:54:35 UTC
Thanks for the answer, I've attached the backtrace.
Comment 4 Albert Astals Cid 2014-01-11 12:56:30 UTC
Ok, the backtrace helps finding out what's the problem, will need some reworking to make it work, it's really an unfortunate side effect.
Comment 5 Albert Astals Cid 2014-11-24 18:22:12 UTC
*** Bug 341118 has been marked as a duplicate of this bug. ***
Comment 6 martin f. krafft 2015-04-15 18:55:36 UTC
I had also reported this bug here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740707

Any news? The problem still exists, 15 months later… :(
Comment 7 Anssi Hannula 2015-04-15 21:37:00 UTC
On Mageia, the following stopgap measure was applied in Jan 2015 until this is properly fixed:
http://svnweb.mageia.org/packages/cauldron/okular/current/SOURCES/okular-4.14.3-revert-show-paper-size-names-to-avoid-freeze.patch?revision=811673&view=markup
Comment 8 Marco Gamberoni 2015-04-29 20:44:35 UTC
Met this bug after upgrading to Kubuntu 15.04, which provides Okular Version 0.21.3 from KDE 4.14.6 (also installed Plasma 5.3 Beta from ppa:kubuntu-ppa/beta, but don't think this affects Okular).
This bug is unbearable if a pdf document has varying page sizes: Okular locks up at all transitions to a differently sized page. 
No errors (kdebugdialog used) and no CPU usage while Okular is unresponsive. 
strace has been the friend who hinted at this workaround:
   - install package printer-driver-cups-pdf, which provides a virtual (always local) PDF printer
   - set this PDF printer as the default printer in KDE Control Panel 
   - also had to remove the setting of a network printer I had in ~/.cups/lpoptions

May I hope this bug gets fixed while porting Okular to KF5?
Thanks.
Comment 9 Marco Gamberoni 2015-04-29 21:12:56 UTC
(In reply to Marco Gamberoni from comment #8)
> Met this bug after upgrading to Kubuntu 15.04, which provides Okular Version
> 0.21.3 from KDE 4.14.6 (also installed Plasma 5.3 Beta from
> ppa:kubuntu-ppa/beta, but don't think this affects Okular).
> This bug is unbearable if a pdf document has varying page sizes: Okular
> locks up at all transitions to a differently sized page. 
> No errors (kdebugdialog used) and no CPU usage while Okular is unresponsive. 
> strace has been the friend who hinted at this workaround:
>    - install package printer-driver-cups-pdf, which provides a virtual
> (always local) PDF printer
>    - set this PDF printer as the default printer in KDE Control Panel 
>    - also had to remove the setting of a network printer I had in
> ~/.cups/lpoptions
> 
> May I hope this bug gets fixed while porting Okular to KF5?
> Thanks.

Forgot to say: 
here Okular hangs in normal mode, polling the default printer if unreachable. The presentation mode the title of this bug refers to, does not matter; or the bug has worsened meanwhile.

"Upgrading to Kubuntu 15.04" from Kubuntu 14.10, which was unaffected. Probably downstream they  dropped a patch in the transition.
Comment 10 Vangelis 2015-05-05 16:44:40 UTC
Same issue on Kubuntu 14.04 64 bits.

If I install package cups-pdf and set the default printer to be the PDF printer, presentation mode works again.

  Installed: 4:4.14.2-0ubuntu1~ubuntu14.04~ppa1
  Candidate: 4:4.14.2-0ubuntu1~ubuntu14.04~ppa1
  Version table:
 *** 4:4.14.2-0ubuntu1~ubuntu14.04~ppa1 0
        500 http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     4:4.13.3-0ubuntu0.1 0
        500 http://no.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
     4:4.13.0-0ubuntu1 0
        500 http://no.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
Comment 11 Maurice Batey 2015-07-09 13:53:17 UTC
This bug report is related to the Mageia-5 bug report:

    https://bugs.mageia.org/show_bug.cgi?id=16330 

Steps to Reproduce:
1. Give Okular (V.4.14.3) a PDF file (see example above)

2. Ask it to print 'from 1 to 1'  (on local USB HP5520):  Successful.

3. Ask it to print 'from 2 to 2'. 
Nothing seems to happen, but if then call HP Print Manager, it, too, freezes with an empty window, and Okular is unresponsive.

4. Force Okular and HP Print Manager to terminate.

5. Page 2 is then printed!

[No problem if same exercise is repeated using LibreOffice Writer.]
Comment 12 Rémi Verschelde 2016-08-11 13:29:58 UTC
Still valid in Mageia 6 today with okular 16.04.3: https://bugs.mageia.org/show_bug.cgi?id=16330