Bug 226034

Summary: creation of pdf thumbnails/previews randomly fails
Product: [Frameworks and Libraries] kio Reporter: Andriy Gapon <avg>
Component: thumbnailAssignee: Malte Starostik <malte>
Status: RESOLVED FIXED    
Severity: normal CC: rakuco
Priority: NOR    
Version: 4.3   
Target Milestone: ---   
Platform: FreeBSD Ports   
OS: FreeBSD   
Latest Commit: Version Fixed In:

Description Andriy Gapon 2010-02-09 16:24:19 UTC
Version:            (using KDE 4.3.5)
OS:                FreeBSD
Installed from:    FreeBSD Ports

I think that I observe an issue quite similar to what is described and resolved in Bug 44098.
Creation of PDF thumbnails/previews randomly works/fails.
I've obtained some FreeBSD ktrace data for this problem:
  3453 100510 kdeinit4 CALL  wait4(0xd88,0x7fffffffcb3c,<invalid>0,0)
  3453 100510 kdeinit4 RET   wait4 -1 errno 4 Interrupted system call
  3453 100510 kdeinit4 PSIG  SIGCHLD caught handler=0x8007ce0b0 mask=0x0 code=0x0
As you can see, waitpid returns with EINTR because of SIGCHLD from a terminating child.
POSIX does not prohibit such behavior.
I suggest to change the waitpid code in kdegraphics/thumbnailers/ps/gscreator.cpp, so that it loos like the following:
int ret;
do {
  ret = waitpid(pid, &status, 0);
} while (ret == -1 && errno == EINTR);
if (ret != pid || (status != 0  && status != 256))
  ok = false;

The idea is to ignore spurious EINTR returns.
With this change PDF thumbnails/previews are created reliably for me.
Comment 1 Raphael Kubo da Costa 2010-02-17 21:00:43 UTC
SVN commit 1091886 by rkcosta:

Ignore spurious EINTR errors in waitpid when creating the PS preview.

Patch by Andriy Gapon, thanks!

CCMAIL: avg@icyb.net.ua
BUG: 226034


 M  +5 -1      gscreator.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1091886
Comment 2 Raphael Kubo da Costa 2010-02-17 21:19:24 UTC
I've also backported it to the 4.4 branch, but Bugzilla didn't receive the commit e-mail.