United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6791245 Tune handling of LAP files
JDK-6791245 : Tune handling of LAP files

Details
Type:
Bug
Submit Date:
2009-01-07
Status:
Closed
Updated Date:
2010-09-26
Project Name:
JDK
Resolved Date:
2009-05-13
Component:
deploy
OS:
generic
Sub-Component:
deployment_toolkit
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u14 (b02)

Related Reports
Backport:

Sub Tasks

Description
There are several issues related to LAP files:

1) Using procmon tool to monitor file system access on XP i see 26 requests to read parts of the same lap file while starting DisplayShelf FX demo with populated cache. We should reduce number of system calls as 
total length of LAP file is small.

2) Tracing readLAP calls i see that AppPolicy.grantUnrestrictedAccess() tries to check some conditions related to desktop integration for each jnlp file but this only has sense for main jnlp file.
As result we have number of failing open file requests.

3) in my experiments refreshIfNecessary rereads lap that was just read in and there are no other processes that touched lap file. May be something is not correct in the logic there

4) starting cached webstart application triggers writing LAP file. This might be ok (if it saves last run time) but this probably can be done in background reducing amount of work done before starting main application class.

====== List of read operations from procmon log
"47620","11:31:13.6361286 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"47621","11:31:13.6361737 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"47622","11:31:13.6362579 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 2"
"47623","11:31:13.6363288 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"47624","11:31:13.6364610 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 161"
"47625","11:31:13.6364723 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 4,096"
"47627","11:31:13.6365490 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"47628","11:31:13.6365598 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 64"
"47629","11:31:13.6366126 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"47636","11:31:13.6368132 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 161"
"47637","11:31:13.6368399 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 4"
"47648","11:31:13.6372245 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 161, Length: 32,768"
"47742","11:31:13.6412847 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 161, Length: 32,768"
"66656","11:31:14.4629647 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 256"
"66659","11:31:14.4630159 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"66660","11:31:14.4630608 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"66665","11:31:14.4631552 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 2"
"66668","11:31:14.4632270 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"66671","11:31:14.4633508 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 161"
"66672","11:31:14.4633619 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 4,096"
"66673","11:31:14.4634380 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"66674","11:31:14.4635073 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 64"
"66675","11:31:14.4635634 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 512"
"66677","11:31:14.4637579 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 161"
"66678","11:31:14.4637815 PM","javaw.exe","4788","FASTIO_CHECK_IF_POSSIBLE","C:\Users\igor\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\24\294f8c18-6.0.lap","SUCCESS","Operation: Read, Offset: 0, Length: 4"

                                    

Comments
EVALUATION

Regarding AppPolicy.grantUnrestrictedAccess():

no desktop integration is actually done here, this is just preparing the ainfo structure for call to TrustDecider.isAllPermissionGranted(), however it is true that this  is done overly eargerly.
Instead of passing the proper ainfo structure to this method (which only needs it if it in fact displays the TrustDeciderDialog) we could pass an instance of an interface that could fill it in, and leave the filling in till the dialog (actually the more information dialog of the TrustDecider dialog) till it is needed, this would avoid repeating this for multiple jars signed with the same certificates, or at all when certificate is permanently trusted.
                                     
2009-01-07
EVALUATION

DefaultLocalApplicationProperties.refreshIfNecessary always performed refresh
because lastAccessed was never set. As we have one timestampt and can read data 
from 2 caches i've decided to set timestampt after we read from both caches
and also when we update LAP file. This helps to reduce number of reads of LAP file.

We should also avoid attempts to refine aInfo in the AppPolicy with data from the LAP file if it is not the main jnlp file. For non-main jnlp files there will not be LAP files and therefore dti will be always false. On FX runtime this saves us about 10 failed file lookups.

There are also couple of other minor possibilities - in some cases we still read LAP file twice (read and then update, e.g. if we need to update anything in cache) - we can probably refactor Launcher code to update cache first (if needed) and then create LAP files. 

We also save data to LAP file on each start (usage timestampt, etc.). 
This easily can be done AFTER main application thread is launcher.

As last two changes are about refactoring of Launcher code and there are other things to refactor in the Launcher, therefore i've left them to be addressed later on.
                                     
2009-02-03
SUGGESTED FIX

http://sa.sfbay.sun.com/projects/deployment_data/6u14/6791245/
                                     
2009-02-03



Hardware and Software, Engineered to Work Together