Bug 513093 - Lot of DLTK model exceptions when installing Composer project dependencies
Summary: Lot of DLTK model exceptions when installing Composer project dependencies
Status: REOPENED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-03 14:12 EST by Bartlomiej Laczkowski CLA
Modified: 2020-05-14 10:16 EDT (History)
2 users (show)

See Also:


Attachments
Small chunk of log file (832.50 KB, application/octet-stream)
2017-03-03 14:13 EST, Bartlomiej Laczkowski CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bartlomiej Laczkowski CLA 2017-03-03 14:12:22 EST
Hi All,

Recently we found an issue that is causing a huge number of entries being logged in the .log file (just a piece of it attached). I was investigating the issue and I have noticed that the problem is related to the way how composer deals with unpacking downloaded archives and how Eclipse reacts on resources that are created outside of workspace. Below is the step by step description of what is going on and why we have such huge amount of DLTK model exceptions being logged.

While triggering "Install Dependencies" action (i.e. on Zend Framework project from GitHub) there is a job that runs the appropriate command to install Composer dependencies. When dependencies are installed and there are some archives being fetched, Composer uses \vendor\composer directory as a intermediate directory for unpacking the contents before moving them into appropriate locations. If Eclipse has "Refresh using native hooks or polling" option enabled in preferences, it may trigger the refresh job while composer is having this temporary/unpacked sources in \vendor\composer directory. If aforementioned refresh is performed, resource change notifications are triggered for different source files that are only available for the time of unpacking the archives by composer. Those events are causing i.e. DLTK indexer job to schedule indexing operations for those sources. Eventually, indexing job will start to perfom indexing operations but in the meantime composer finishes unpacking and removes the intermediate directories, in that case DLTK model elements are no longer having the corresponding files available which causes the exceptions to be thrown.

Generally I can not find any good solution that will help preventing those Composer intermediate directories/files to be NOT taken into account while refreshing Eclipse workspace and so triggering the resource change events. Using WorkspaceJob instead of Job as a base for ComposerJob class doesn't help as refresh is performed by a separate thread/job that is triggered by the fact of externally added files/folders (we can not take control over it, skip it, block it or just exclude \vendor\composer directory in that process for Composer operation time, etc. etc.). Disabling "Refresh using native hooks or polling" preference in the code for the time of composer operation solves the problem but I think it is not a good solution...

The best solution would be to tell Composer to create those intermediate directories outside the workspace project but after taking some closer look at Composer sources it looks like it is not possible (some time ago the TMPDIR env var value was used for that purpose but they changed this behavior due to this bug: https://github.com/composer/composer/issues/1765).

So basically I stucked and maybe some of you guys will have any good idea how to solve this issue?
Comment 1 Bartlomiej Laczkowski CLA 2017-03-03 14:13:11 EST
Created attachment 267103 [details]
Small chunk of log file
Comment 2 Thierry BLIND CLA 2017-03-03 14:39:52 EST
So there is no way to tell the DLTK indexer job to not index some (intermediate) directories? :/
Comment 3 Bartlomiej Laczkowski CLA 2017-03-03 14:48:58 EST
(In reply to Thierry BLIND from comment #2)
> So there is no way to tell the DLTK indexer job to not index some
> (intermediate) directories? :/

At first glance I can not see anything that may do such thing. Anyway, even if it would be possible to tell indexer to skip some modules then what about other features that might be affect in a very same way?
Comment 4 Dawid Pakula CLA 2017-03-03 14:51:03 EST
Did you try eclipse directory filters?
Comment 5 Thierry BLIND CLA 2017-03-03 15:19:15 EST
Yes, maybe Resource Filters...
Right-click on the php project and choose Properties -> Resource -> Resource Filters.
Comment 6 Eclipse Genie CLA 2017-03-06 13:32:01 EST
New Gerrit change created: https://git.eclipse.org/r/92407
Comment 8 Bartlomiej Laczkowski CLA 2017-03-07 18:11:07 EST
Fixed. Thank you guys for hints!
Comment 9 Eclipse Genie CLA 2017-03-10 08:14:05 EST
New Gerrit change created: https://git.eclipse.org/r/92774
Comment 11 Bartlomiej Laczkowski CLA 2017-03-10 10:10:00 EST
Reverted the previous change as it causes severe side-effects (bug 513432).
Comment 12 Eclipse Genie CLA 2019-11-30 17:33:55 EST
New Gerrit change created: https://git.eclipse.org/r/153599