Bug 567271

Summary: IResource.refreshLocal() needs to be synchronous when run from a job
Product: [Eclipse Project] Platform Reporter: Marvin Fröhlich <eclipse>
Component: ResourcesAssignee: Platform-Resources-Inbox <platform-resources-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: loskutov
Version: 4.17Keywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Marvin Fröhlich CLA 2020-09-23 03:29:03 EDT
I am pretty sure, the behavior changed in 4.17. I had a hard night trying to figure out a solution.

When IResource.refreshLocal() is run from within a Job, it needs to be synchronous or at least there needs to be a synchronous variant to be called.

If I have a Job, that updates some resources (not through the API, but on the filesystem) and I have to refresh that resource, the refresh is actually performaed AFTER my Job has finished and all other Jobs, that were in the queue before my call to refreshLocal().

This can be pretty hard. I need the resource to be in sync right at this time. I already tried to split up my Job, but this didn't do the trick.

I made this bug a blocker, because it really is for me.
Comment 1 Andrey Loskutov CLA 2020-09-23 03:41:05 EDT
Please provide a standalone reproducible example project / test case.
Comment 2 Andrey Loskutov CLA 2020-09-23 04:02:33 EDT
(In reply to Marvin  Fröhlich from comment #0)
> I am pretty sure, the behavior changed in 4.17.

IResource.refreshLocal() and its implementation have no changes in 4.17. Most recent (and unrelated) changes were in 4.14. 

So whatever problem you have is probably coming from somewhere else - please provide a reproducer so we can check what is actually causing troubles.
Comment 3 Marvin Fröhlich CLA 2020-09-23 04:26:42 EDT
Ok, I will do that. But before I do, can you confirm, that refreshLocal() does not start working before the last Job is done, that was in the queue before that call?

And is there a way around it?

I know, this is not a support forum. But if the above is true, this is clearly something to be fixed.
Comment 4 Andrey Loskutov CLA 2020-09-23 04:38:34 EDT
(In reply to Marvin  Fröhlich from comment #3)
> Ok, I will do that. But before I do, can you confirm, that refreshLocal()
> does not start working before the last Job is done, that was in the queue
> before that call?

refreshLocal() doesn't know anything about any jobs, it uses workspace locks. So I can't confirm anything without a code example.
Comment 5 Marvin Fröhlich CLA 2020-09-23 06:25:34 EDT
Looks like it's not the refreshLocal(), which is delayed after the last Job, but the resource change event is.
Comment 6 Marvin Fröhlich CLA 2020-09-23 06:25:58 EDT
I helper myself with a small threshold. Not a good solution, but a workaround.
Comment 7 Eclipse Genie CLA 2020-09-28 04:47:26 EDT Comment hidden (obsolete)
Comment 8 Eclipse Genie CLA 2020-09-29 08:05:43 EDT Comment hidden (obsolete)
Comment 9 Eclipse Genie CLA 2020-09-30 10:23:02 EDT Comment hidden (obsolete)