Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323299 - [files] remote file view adapter needs to use the latest version of IRemoteFile
Summary: [files] remote file view adapter needs to use the latest version of IRemoteFile
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.2   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-20 18:29 EDT by David McKnight CLA
Modified: 2010-11-09 08:25 EST (History)
1 user (show)

See Also:
mober.at+eclipse: pmc_approved+
kjdoyle: review+


Attachments
patch to use the latest remote file (2.26 KB, patch)
2010-08-20 18:32 EDT, David McKnight CLA
no flags Details | Diff
updated patch to also synchronize on the file (5.92 KB, patch)
2010-08-23 12:16 EDT, David McKnight CLA
no flags Details | Diff
updated patch to make sure cached file is stale when original is stale (1.26 KB, patch)
2010-08-24 11:51 EDT, David McKnight CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David McKnight CLA 2010-08-20 18:29:17 EDT
It's possible for views to hold onto old versions of IRemoteFile.  By old, I mean these instances are not the same as the cached version in the RemoteFileSubSystem.  One problem with this is that when a view containing an older version of an IRemoteFile gets refreshed, it's possible that, since it's not marked as stale, it invalid cached contents can be returned.
Comment 1 David McKnight CLA 2010-08-20 18:32:46 EDT
Created attachment 177150 [details]
patch to use the latest remote file
Comment 2 David McKnight CLA 2010-08-20 18:33:05 EDT
Kevin, could you review this patch?  Thanks.
Comment 3 Kevin Doyle CLA 2010-08-23 11:13:51 EDT
Review +.
Comment 4 David McKnight CLA 2010-08-23 12:16:56 EDT
Created attachment 177235 [details]
updated patch to also synchronize on the file

It's also possible to two or more concurrent queries to be made on the same remote file.  That can cause problems with the caching, so I've added a synchronize block on the remote file that is being queried to prevent a possible duplicate query.
Comment 5 David McKnight CLA 2010-08-23 12:17:27 EDT
Thanks for the review, Kevin.  Could you also review the updated patch?
Comment 6 Kevin Doyle CLA 2010-08-23 14:36:22 EDT
Review + for updated patch.
Comment 7 David McKnight CLA 2010-08-23 15:07:11 EDT
Thanks for the review.  I've committed the change to cvs.
Comment 8 David McKnight CLA 2010-08-24 11:48:30 EDT
Reopening this to handle the case where a refresh is issued on a remote file that is not the cached file but the cached file is not stale.  The original file is marked stale as a result of the refresh so the cached file should also be marked stale.
Comment 9 David McKnight CLA 2010-08-24 11:51:58 EDT
Created attachment 177336 [details]
updated patch to make sure cached file is stale when original is stale
Comment 10 David McKnight CLA 2010-08-24 11:52:49 EDT
Sorry to bug you again, Kevin.  Could you please take a look at this last modification?  Thanks!
Comment 11 Kevin Doyle CLA 2010-08-24 12:19:27 EDT
Looks good.  Review +.
Comment 12 David McKnight CLA 2010-08-24 12:21:52 EDT
I've committed the update.
Comment 13 Martin Oberhuber CLA 2010-09-07 06:34:57 EDT
I'm concerned about the "synchronized" block since it calls out to unknown client code (ss.resolveFilterString, file.getContents, filterChildren).

Assuming that such client code does a Display.syncExec() which for some reason ends up running into that query block again, this would deadlock. In general, large synchronized blocks calling out to foreign code should be avoided.

Even assuming that there are multiple queries on the same file, I cannot quite see why this would be a problem (other than asking the same information twice, which should be acceptable).

Can you remove the large synchronized block?
Comment 14 David McKnight CLA 2010-09-07 13:44:50 EDT
(In reply to comment #13)
> I'm concerned about the "synchronized" block since it calls out to unknown
> client code (ss.resolveFilterString, file.getContents, filterChildren).
> 
> Assuming that such client code does a Display.syncExec() which for some reason
> ends up running into that query block again, this would deadlock. In general,
> large synchronized blocks calling out to foreign code should be avoided.
> 
> Even assuming that there are multiple queries on the same file, I cannot quite
> see why this would be a problem (other than asking the same information twice,
> which should be acceptable).
> 
> Can you remove the large synchronized block?

I was hoping to avoid duplicate queries by synchronizing so that only one query gets through while others wait and return the cached results.  Since we're late in the release cycle, I'll take out the synchronized block to mitigate any potential risk.
Comment 15 Martin Oberhuber CLA 2010-09-08 04:20:05 EDT
Thanks, I released for 3.2.1rc4.
Comment 16 Martin Oberhuber CLA 2010-11-09 08:25:34 EST
Verified that this has been released to 3.3m3 as well.