Bug 147966 - acroread takes long time to start
Summary: acroread takes long time to start
Status: RESOLVED WORKSFORME
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: X11 Applications (show other bugs)
Version: RC 5
Hardware: i586 Other
: P1 - Urgent : Critical (vote)
Target Milestone: ---
Assignee: George Horlacher
QA Contact: Stefan Dirsch
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-03 11:49 UTC by Takashi Iwai
Modified: 2007-10-11 13:17 UTC (History)
7 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Log of strace -t (4.23 MB, text/plain)
2006-02-03 11:50 UTC, Takashi Iwai
Details
strace output (364.00 KB, application/x-gzip)
2006-02-21 17:08 UTC, Ladislav Michnovic
Details
nld10 beta4.2 -- strace -t (2.32 MB, text/plain)
2006-02-21 20:07 UTC, Juergen Weigert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Iwai 2006-02-03 11:49:55 UTC
acroread takes long time (ca 30 sec) to start.  It hogs 100% CPU.
Comment 1 Takashi Iwai 2006-02-03 11:50:56 UTC
Created attachment 66324 [details]
Log of strace -t
Comment 2 Michael Gross 2006-02-03 11:53:50 UTC
This is probably the fontconfig problem (bug #147292). Updated packages for Beta 3 are available here:
http://download.opensuse.org/distribution/SL-10.1-OSS-beta3/fixed-rpms

Please reopen this bug if this does not fix the problem.
Comment 3 Takashi Iwai 2006-02-03 11:56:23 UTC
No, fontconfig is alredy the latest one.
Comment 4 Michael Gross 2006-02-03 12:23:59 UTC
Maby the problem isn't as fixed as it should be... I will mark this one as a duplicate because this is most likely the cause here (the original bug #143715 is still not marked as solved).

*** This bug has been marked as a duplicate of 143715 ***
Comment 5 Robert Boehm 2006-02-21 11:32:47 UTC
Has anyone noticed that Acroread 7.0.5 is still slow to start?  In Beta 4 now, the fontconfig problem seems solved....all X aplications start normalle EXCEPT Acroread.  This is true for SUSE 10.0 AND 10.1 for Acroread 7.0.5.  Acroread 7.0.1 starts normally in BOTH versions of SUSE...something is different with 7.0.5.  Can someone please check this and confirm.  I still think that there is an issue with acroread.  For information, Acroread 7.0.5 seems to start up fine in CentOS 4.2 but NOT SUSE 10.0 or 10.1 beta.

Also, once acroread finally starts, it seems to work fine...it's just the start-up time and a LOT of hard drive activity....this has been confirmed with several computers for SUSE 10.0 and the test computer with SUSE 10.1 beta through 4 (with the fixed fongconfig issue).
Comment 6 Takashi Iwai 2006-02-21 15:22:55 UTC
It still happens on beta4, so it's definitely not that fontconfig problem.

The oprofile shows that it takes most time in libBIB.so (in Acrobat7/*/*/lib).

Is acroread still used as the default browser on NLD or any else?  If yes, we should increase the severity of this bug to CRITICAL or BLOCKER.
Comment 7 Michael Gross 2006-02-21 15:29:41 UTC
Acroread should definitely work... let's see if other people also experience problems here.

Takashi: Are you opening the bare program or are you trying to open a file? Does it always take so long to start?
Comment 8 Takashi Iwai 2006-02-21 15:31:48 UTC
Just starting "acroread".  Yes, it always take minutes to appear the window.
Comment 9 Takashi Iwai 2006-02-21 15:34:32 UTC
BTW, do you know any machine with 10.1 on which acroread is working without problems?  It'll be helpful to track down the problem...
Comment 10 Michael Gross 2006-02-21 15:37:18 UTC
This appears not to be an isolated problem. Raising severity.
Comment 12 Ladislav Michnovic 2006-02-21 17:08:45 UTC
Created attachment 69616 [details]
strace output

On my computer start of strace -o log acroread took aprox 56 seconds. I have Beta 4.
Comment 13 Takashi Iwai 2006-02-21 19:48:10 UTC
OK, I found a workaround.

Acroread creates a stupidly long list of all available fonts in ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst.  Making this an empty file reduces the start-up time significantly.  That is,

    % rm ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst
    % touch ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst

I'm not 100% sure whether any side-effects occur, but I bet it won't.  At least, browsing PDF files seems OK.
Comment 14 Michael Gross 2006-02-21 19:51:22 UTC
When does Acroread generate that list? At the (first) startup?
Comment 15 Juergen Weigert 2006-02-21 20:07:59 UTC
Created attachment 69648 [details]
nld10 beta4.2 -- strace -t 

No problem here:
acroread starts in less than 10 seconds on my NLD beta4.2, it is a poor PIII 800Mhz machine. 

As fast as my SL10.0 acroread on a more powerful machine.
Comment 16 Takashi Iwai 2006-02-21 20:14:31 UTC
#14: I think yes.  Possibly, a cache file generated by a version with a broken version/combination did something wrong.

#15: A possible difference is that home is NFS or not - or the number of fonts you installed.  Anyway, try to make the file mentioned in #13 empty.  It can be much faster :)
Comment 17 Johannes Meixner 2006-02-22 09:29:57 UTC
Did you check whether it depends on an existing old ~/.adobe/ directory?
I.e. does it work well after "mv ~/.adobe ~/.adobe.old"? 
Comment 18 Takashi Iwai 2006-02-22 10:58:26 UTC
No, it happens even after removing the whole ~/.adobe.

Acroread recreates ~/.adobe/* at the frist start.  Interestingly, the first start is really quick.
Then, start acroread again, and it takes minutes.
Comment 19 Johannes Meixner 2006-02-22 13:05:35 UTC
George,
as far as I know our special license for the Adobe Reader,
we should be allowed to adapt the start script
/usr/X11R6/bin/acroread
to workaround the problem, e.g. by adding something like
cat /dev/null 1>~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst 2>/dev/null || true
Comment 20 George Horlacher 2006-02-22 16:21:11 UTC
I believe we can add that work around as long as the consensus is that we won't be breaking any functionality.  Will it still be able to handle all the fonts it needs? If so I think its OK. 
Comment 21 Takashi Iwai 2006-02-22 18:19:38 UTC
The fonts included in acroread package are listed in AcroFnt07.lst.  It seems that UnixFnt07.lst contains only the list of external fonts.

Though, I don't know whether these external fonts are really used or not.

Also I'm not sure whether we should add this workaround _unconditionally_.  Acroread is working without hack for some (or most?) users...  Maybe more investigation is needed.
Comment 22 Mike Fabian 2006-02-27 14:01:25 UTC
I can reproduce the problem with the slow startup as well.

Takashi> Acroread creates a stupidly long list of all available fonts in
Takashi> ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst.  Making this an empty file reduces
Takashi> the start-up time significantly.  That is,
Takashi> 
Takashi>     % rm ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst
Takashi>     % touch ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst
Takashi> 
Takashi> I'm not 100% sure whether any side-effects occur, but I bet it won't.  At
Takashi> least, browsing PDF files seems OK.

I can get the same speedup by only removing UnixFnt07.lst, the touch
is not necessary.

When using the touch, the file UnixFnt07.lst still has 0 bytes
when acroread has started.

After deleting the file but omitting the touch, Acroread starts
equally fast and when it has started the file is not empty.

Therefore I guess by omitting the touch one can reduce the probability
for side-effects.

Comment 23 Mike Fabian 2006-02-27 14:03:10 UTC
Takashi> Acroread recreates ~/.adobe/* at the frist start.
Takashi> Interestingly, the first start is really quick.  Then, start
Takashi> acroread again, and it takes minutes.

I.e. acroread seem to be able to generate the file UnixFnt07.lst quite
fast. Only if the file is already there the slowness problem occurs.

Comment 24 George Horlacher 2006-03-07 00:22:43 UTC
So do I understand you guys correctly when assuming we should simply always
remove that file upon startup, so acroread regenerates it every time, instead
of using time evaluating Cache data?
Comment 25 Takashi Iwai 2006-03-07 15:07:31 UTC
Yes.
Comment 26 George Horlacher 2006-03-18 00:17:00 UTC
So I put in the acroread script:
rm ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst

I get these warnings...  
----------
(acroread:20359): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",
FC: cache for /usr/X11R6/lib/Acrobat7/Resource/Font is outdated,
    consider running "fc-cache" as root!
FC: cache for /usr/X11R6/lib/Acrobat7/Resource/Font/PFM is outdated,
    consider running "fc-cache" as root!

The Gtk-WARNING is there regardless, if I run "fc-cache" as root then it doesnt complain after that...  Do you think I should check it in this way?  The speed is faster for loading, but on my fast box it goes from about 10 seconds to 3
Comment 27 James Ogley 2006-03-20 07:14:57 UTC
I can confirm that adding that rm line to the acroread script inproves the startup time on my machine.  Running fc-cache as root also seems to improve it.
?
Perhaps fc-cache should be run at the end of SuSEconfig.fonts?
Comment 28 Mike Fabian 2006-03-20 11:24:40 UTC
George Horlacher> FC: cache for /usr/X11R6/lib/Acrobat7/Resource/Font is outdated,
George Horlacher>     consider running "fc-cache" as root!
George Horlacher> FC: cache for /usr/X11R6/lib/Acrobat7/Resource/Font/PFM is outdated,
George Horlacher>     consider running "fc-cache" as root!

These warnings have been disabled in fontconfig for the final release
anyway.  We added a patch to fontconfig to produce these warnings only
for debugging purposes during the beta phase. You can ignore these
warnings.

George Horlacher> The Gtk-WARNING is there regardless, if I run
George Horlacher> "fc-cache" as root then it doesnt complain after
George Horlacher> that...  Do you think I should check it in this way?

Yes.
Comment 29 Mike Fabian 2006-03-20 11:31:31 UTC
James Ogley> Perhaps fc-cache should be run at the end of SuSEconfig.fonts?

This is already done.

SuSEconfig.fonts does nothing but call the Perl-script /usr/sbin/fonts-config
which does the main work.

And fonts-config does run "fc-cache".

It is run *after* generating fonts.dir/fonts.scale, because running
"fc-cache" before that would be meaningless because changing
fonts.dir/fonts.scale changes the time-stamps again and fontconfig
will still think that fc-cache needs to be run.

But it is not run at the end of fonts-config because fonts-config does
a few things which already use fontconfig (generation of fontmap for
Ghostscript, generating Java fontsetup, ...) and this would be slow
if done before running fc-cache.


Comment 30 Rasmus Plewe 2006-03-21 14:37:30 UTC
Suse Linux 10.1, beta8 (updated from 10.0):

a) Out of the box:
   Acroread starts in about 30s.
b) When removing and touching ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst
   Acroread starts in about 4s, that file stays at 0byte. 
c) When removing ~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst
   Acroread starts in about 4s, that file is created with 2MB (GOTO a))

Comment 31 Johannes Meixner 2006-03-21 15:03:47 UTC
I do not understand the "GOTO a" in the above comment
because each start of the Adobe Reader should run the
/usr/X11R6/bin/acroread start-script which removes the file again.

But removing the file could cause another problem:
What happens when the same user runs the Adobe Reader
several times concurrently (in particular what happens
when the browser plugin runs concurrently)?

The first Adobe Reader process would remove and re-create the file
and I assume Adobe Reader now depends on the content of the file
but a subsequent Adobe Reader process would remove and re-create it
with perhaps different content (when fonts have changed)
or the first process may try to read from the file just when it
is removed but not yet fully re-created.

Therefore it is perhaps more safe to do only a
  cat /dev/null >~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst
which only clears the content without any file removal.
Comment 32 Mike Fabian 2006-03-21 15:14:36 UTC
As I wrote in comment #22, I guess that making the file empty
instead of removing it will be more likely to cause side effects.
This is just a guess though.
Comment 33 Rasmus Plewe 2006-03-21 15:18:56 UTC
Nor do I (understand the GOTO). But it's the way it is. Update problems? Not sure what the script should look like, I get:

grep " rm " /usr/X11R6/bin/acroread
    rm -f $CERTNAME
    rm -f $CERTDATA
    rm -f $LOGFILE
(acroread-7.0.5-6)

We could also simply link this file to /dev/null...
Comment 34 Mike Fabian 2006-03-21 15:25:38 UTC
I guess if acroread goes through all the trouble to generate such
a file, it probably has a purpose. Therefore I guess
it might cause side effects to make it empty, link it to /dev/null,
or similar things.
Comment 36 Takashi Iwai 2006-03-21 15:59:14 UTC
Johannes has a good point.  The acroread plugin shows the very same problem if the cache file exists, and there is no wrapper script for the plugin.  Setting a zero file is a good workaround, IMO (although if you use only plugin, this workaround will be never enabled).

BTW, looking at strace, acroread creates the file with O_EXCL, i.e. once after the file is created, it'll be never rewritten.  This implies that acroread even doesn't care about the changes of system fonts once if they are registered in that cache file.  A bad implementation :-<
Comment 37 George Horlacher 2006-03-27 21:36:17 UTC
I've submitted to autobuild an updated with the fix:
cat /dev/null >~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst

In testing it looks like the startup speed is really fast now.
I'll also work with acroread on this as I'm starting to get a look 
at the 7.0.7 pre-release canidate to see if it's a problem for it too.
Comment 38 Andreas Klein 2006-04-30 16:30:50 UTC
RC3:
First acroread start after booting takes 90 (!) seconds on a IBM R50p which is rather new hardware. A second start takes 2 seconds.
If I do cat /dev/hda > /dev/null, so that the acroread files are thrown out of the cache, the next acroread start takes again 90 seconds.
Comment 39 George Horlacher 2006-05-01 23:09:22 UTC
I've looked in 10.1 RC3 acroread startup file and it has:
cat /dev/null >~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst

It seems to be working well for me speed wise.  If it's missing for 
you please verify your running the latest version and if you have 
that line in the /usr/X11R6/bin/acroread script (and that is the one your 
using to start up acroread). The package I got from 10.1 RC3 is: acroread-7.0.5-13.i586.rpm
Comment 40 Zhe Su 2006-05-09 02:58:28 UTC
This issue still exists in SUSE Linux 10.1 RC5. Though SUSE Linux 10.1 is GM, please fix it in SLE 10.
Comment 41 George Horlacher 2006-05-17 16:36:22 UTC
Have you verfied that the fix "cat /dev/null >~/.adobe/Acrobat/7.0/Cache/UnixFnt07.lst"  in the acroread startup script is not working?  Have you tried with and without that line in the startup script?  From my testing I saw a lot quicker results with that line added.  I wonder if an upgrade or some install issue is preventing the acroread script from getting the patch.  Can you confirm that the patched acroread script is there and how it runs with/without that line in it?
Comment 42 Michael Nelson 2006-05-28 14:21:14 UTC
The 10.1 released version of /usr/X11R6/bin/acroread does contain a fix for this issue, and in fact changes the startup time from over a minute to only about 8 seconds on my system, which is a massive improvement.

However, in stracing the startup, I see that it is still using some wacky method to decide where to find libc.so.6, and that is bound to be slowing things down since it does this many many times during startup:

3264  access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) <0.000020>
3264  open("/opt/gnome/lib/tls/i686/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.00
0041>
3264  open("/opt/gnome/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.00001
7>
3264  open("/opt/gnome/lib/tls/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000016>
3264  open("/opt/gnome/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000016>
3264  open("/opt/gnome/lib/i686/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000023
>
3264  open("/opt/gnome/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000016>
3264  open("/opt/gnome/lib/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000021>
3264  open("/opt/gnome/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000024>
3264  open("/lib/tls/i686/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000027>
3264  open("/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000014>
3264  open("/lib/tls/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000014>
3264  open("/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000014>
3264  open("/lib/i686/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000020>
3264  open("/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000015>
3264  open("/lib/tm/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000021>
3264  open("/lib/libc.so.6", O_RDONLY)  = 3 <0.000020>

I don't have an LD_LIBRARY_PATH variable set in my environment, and those paths dont exist in /etc/ld.so.conf or in /etc/ld.so.conf.d/.  It seems to me that if the search algorithm was sane, it would START searching at /lib.  I don't understand where this search path is getting set.
Comment 43 Michael Nelson 2006-05-28 15:15:22 UTC
I spoke too soon.  I ran /usr/X11R6/bin/acroread once and it started up
in 8 seconds.  On every subsequent attempt it takes over a minute to
start, so the fixes are NOT working on my system.  I am continuing to
analyze the trace file and finding LOTS of stuff that looks wrong to me,
but I don't really understand this stuff that well.

I hope someone who does can look at the tracelogs.  I've put new ones
out at wget http://home.comcast.net/~michaelnel/acroread_traces.tar.gz

Thanks
Michael
Comment 44 Michael Nelson 2006-05-28 15:19:28 UTC
In analyzing the tracelog, I see thousands instances of opens trying to open things that are clearly NOT directories while using the O_DIRECTORY flag on the open:

open("/usr/X11R6/lib/X11/fonts/CID/encodings.dir", (O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = -1 ENOTDIR (Not a directory)
<0.000021>

I am over my head here, but I did read in the open(2) man page the
following:

O_DIRECTORY   If pathname is not a directory, cause the open to fail.  This
              flag is Linux-specific, and was added in kernel version
              2.1.126, to avoid denial-of-service problems if opendir(3) is
              called on a FIFO or tape device, but should not be used
              outside of the implementation of opendir.

...so, it looks to this non programmer that they shouldn't be using the
O_DIRECTORY flag on an open() call, but what do I know?  I'm just trying
to figure out why it takes this thing so long to open.
Comment 45 Michael Nelson 2006-05-30 13:51:07 UTC
I have also tried the following things:

rpm -e the program, followed by using locate to make sure all remnants of it are gone, then reinstalling.

Tried installing Adobe's version (AdobeReader) from their website (same problem, if not perhaps worse).

Created a new test user with a clean environment, same problem.
Comment 46 Michael Nelson 2006-05-30 14:14:43 UTC
I found acroread-7.0.1-4.i586.rpm and installed that.  It comes up in 4 seconds.  I ran traces on it and put them along with the 7.05 traces in a new archive:

http://home.comcast.net/~michaelnel/acro_traces_701_705.tar.gz

One major thing I note in the summary is that the 7.05 version makes about 32,000 open() calls while starting up, but the 7.01 version only does 3459 open() calls.
Comment 47 Andreas Jaeger 2006-05-30 14:20:58 UTC
Mike, any comments on #44?
Comment 48 Michael Nelson 2006-05-30 14:24:42 UTC
I don't think I can figure out what's wrong here, but if I can provide any more info or test anything else please let me know.
Comment 49 Takashi Iwai 2006-05-30 14:42:39 UTC
Nothing wrong in our side.  It's a bug in acroread, more exactly, a bug in the binary-only library included in acroread 7.05.  So, we cannot fix it.

At _every_ start, acroread tries to parse down the X11 font path _recusrively_ by unknown reason.  At the first time after boot (or resume), the kernel directory cache is cold.  That's why it takes long time.  At the second start, it's faster just because of hot kernel cache.

This happens no matter what fonts.conf you set and no matter what fonts cache exist.  No way to prevent it, AFAIK.

The "fix" in our package prevents a different problem.  Acroread tries to parse its own cache file containing all the system fonts, which eventually results in reading all font files on the system at every time.
Comment 50 Michael Nelson 2006-05-30 14:48:20 UTC
Will someone at SuSE report this to Adobe?

I also don't understand why some 10.1 users are not having any problem with acroread 7.05, but others have these long delays in startup.
Comment 51 Michael Nelson 2006-05-30 15:07:41 UTC
Another data point to ponder:  If I grab AdobeReader_enu-7.0.5-1.i386.rpm from the Adobe website and then rpm -e the SuSE-supplied 7.05 acrobat rpm and install the Adobe one in its place, I get the same slow startup.

But I can install that very same AdobeReader_enu-7.0.5-1.i386.rpm on my test machine which is a far less powerful hardware platform (Celeron 700MHz, 768MB RAM, single 9GB scsi drive) running CentOS 4, and it starts up in 3 seconds.

Sounds to me like there is something specific to SuSE that it doesn't like.
Comment 52 Mike Fabian 2006-05-30 15:23:30 UTC
Andreas> Mike, any comments on #44?

Takashi already gave the information in his comment #49.
→ removing NEEDINFO.

Comment 53 George Horlacher 2006-05-30 16:38:08 UTC
I've given the current details to an Adobe engineer working on acroread. Hopefully they can help...
Comment 54 Michael Nelson 2006-05-30 16:40:58 UTC
Thanks for doing that, George.  I realize this is proprietary software and that SuSE can't directly fix it.
Comment 55 Michael Nelson 2006-06-04 11:46:18 UTC
Any further developments and / or progress on this bug?
Comment 56 Adrian Schröter 2006-06-12 09:16:50 UTC
this should be tracked at Adobe, acroread is closed source, so there is nothing what we can do.
Comment 57 Mike Fabian 2007-10-11 13:01:54 UTC
The workaround used here causes problems with bug #275088.

I’m currently updating acroread to version 8.1.1 and if I continue
using that workaround, acroread will only find external fonts only
if the font directories are specified in PSRESOURCEPATH.

If I remove that workaround, acroread finds all fonts even if
PSRESOURCEPATH is not changed from the default.

Therefore, I’ll remove that workaround from our acroread 8.1.1
package.

The first startup is slow then because acroread creates the list
/home/mfabian/.adobe/Acrobat/8.0/Cache/UnixFnt08.lst but subsequent
starts are fast.

When trying to view the test document from bug #275088

    acroread Recovery_Manual.pdf

it will still look wrong when trying this immediately when first
starting acroread. Apparently acroread generates this font list
but uses it only during the next start. After starting acroread
again, the document looks correct.