Skip to content

Loop between "Building" and "Downloading Sources and Javadoc" #252

Closed

Description

@mickaelistria

While I'm coding for Tycho, on snapshot branch, I see a lot of CPU used by Eclipse IDE and the Progress view seems to loop between "Building" and "Downloading Sources and Javadoc" pretty often.

Activity

  1. mickaelistria commented on Jun 28, 2021

    @mickaelistria
    ContributorAuthor

    It might just be a symptom of #123

  2. laeubi commented on Jun 28, 2021

    @laeubi
    Member

    Yep that seems to be a reincarnation of that bug. As mentioned there, it some time magically 'happens' but goes away without a clear indication why.

  3. mickaelistria commented on Jun 30, 2021

    @mickaelistria
    ContributorAuthor

    That typically happens when having some Tycho modules (incl tycho-core and most of content of tycho-bundles) open, but not all, and opening a new module.

  4. reckart commented on Jul 12, 2021

    @reckart

    Happens for me a lot as well after updating to m2e 1.18.1 - different workspaces, some with Maven modules that are bundles, some only containing regular JAR/WAR/POM Maven modules.

  5. reckart commented on Jul 22, 2021

    @reckart

    Downgrading to m2e 0.17.2 seems to fix the issue.

  6. mickaelistria commented on Jul 22, 2021

    @mickaelistria
    ContributorAuthor

    I merged a patch that may improve things yesterday. Maybe it's also worth trying the latest snapshot of 1.18.2.

  7. reckart commented on Jul 22, 2021

    @reckart

    Do you have the update site URL handy?

  8. mickaelistria commented on Jul 22, 2021

    @mickaelistria
    ContributorAuthor
  9. reckart commented on Jul 22, 2021

    @reckart

    I have installed m2e - Maven Integration for Eclipse (includes Incubating components) 1.18.2.20210721-064 - loops are still there. The funny thing is that "Download Artifact Sources" and "Download Artifact JavaDoc" are even both turned off in the preferences. "automatically update configuration" is also off. Still it loops on "Download sources and javadoc" <-> "Building" until I manually break the loop by killing the "Download sources and javadoc" task.

  10. mickaelistria commented on Jul 22, 2021

    @mickaelistria
    ContributorAuthor

    @reckart thanks for trying. Do you have a minimal project that can reproduce this issue in a predictable manner?

  11. reckart commented on Jul 22, 2021

    @reckart

    Unfortunately not.

  12. a1dutch commented on Jul 22, 2021

    @a1dutch

    m2e - Maven Integration for Eclipse (includes Incubating components) 1.18.2.20210721-0646 fixed the endless building/downloading sources for my maven projects

  13. ciros88 commented on Jul 28, 2021

    @ciros88

    I confirm build 1.18.2.20210721-0646 fixed that annoying problem

  14. HannesWell commented on Aug 21, 2021

    @HannesWell
    Contributor

    I think the actual cause of this problem is that after the sources/javadoc of a project were downloaded that classpath is updated and during the classpath update a download of the attached sources/javadoc is triggered again.
    The following stack-trace illustrates this (a BuildPathManager references its DownloadSourcesJob and vice-versa).

    	DownloadSourcesJob.addDownloadRequest(IProject, IPackageFragmentRoot, ArtifactKey, boolean, boolean) line: 352	
    	DownloadSourcesJob.scheduleDownload(IProject, IPackageFragmentRoot, ArtifactKey, boolean, boolean) line: 338	
    	DownloadSourcesJob.scheduleDownload(IProject, ArtifactKey, boolean, boolean) line: 361	
    	BuildPathManager.scheduleDownload(IProject, MavenProject, ArtifactKey, boolean, boolean) line: 899	
    	BuildPathManager.configureAttachedSourcesAndJavadoc(IMavenProjectFacade, Properties, ClasspathDescriptor, IProgressMonitor) line: 342	
    	BuildPathManager.getClasspath(IMavenProjectFacade, int, Properties, boolean, IProgressMonitor) line: 269	
    	BuildPathManager.getClasspath(IProject, int, boolean, IProgressMonitor) line: 393	
    	BuildPathManager.getClasspath(IProject, int, IProgressMonitor) line: 373	
    	BuildPathManager.getClasspath(IProject, IProgressMonitor) line: 401	
    	BuildPathManager.updateClasspath(IProject, IProgressMonitor) line: 205	
    	DownloadSourcesJob.updateClasspath(BuildPathManager, Set<IProject>, Map<IPackageFragmentRoot,Attachments>, IProgressMonitor) line: 209	
    	DownloadSourcesJob.run(IProgressMonitor) line: 187	
    	Worker.run() line: 63
    

    While Mickaels change fixed the problem for the most cases the logic in BuildPathManager.configureAttachedSourcesAndJavadoc leads to an endless loop in case for a SNAPSHOT version of a maven artifact the sources were last-modified before the main-artifact (don't ask me how this happened in my local Maven repo, but it happened).
    So in my case the DownloadSources-job runs forever every second and sleeps in between. But I think this can be fixed easily if a job maintains a Set of DownloadRequest of the current run and checks if a request about to be added to the queue is in that set.
    This way we should be safe in all circumstances.

    I'm about to prepare a PR for this.

  15. 38 remaining items

  16. AndreasFagschlunger commented on Jul 19, 2023

    @AndreasFagschlunger

    I run into this issue a lot during my work. It mostly happens when I'm working on projects of one big maven project with around 300 modules. I only import the few projects I need and sometimes this whole loop starts. The Maven Workspace Build view only showed one projects which was rebuilding over and over. Is there a way I can provide information for solving this issue?

  17. laeubi commented on Jul 19, 2023

    @laeubi
    Member

    Is there a way I can provide information for solving this issue?

    See

    for a list of useful information in such case, "one big maven project with around 300 modules" is very hard to investigate on :-)

    Of course you should make sure to use the latest m2e release and maybe can extract some information from the mentioned view what is triggering the rebuild.

  18. reckart commented on Jul 19, 2023

    @reckart

    I have one of these large projects (actual several) and while I do not have the infinite build problem right now (I have it sometimes), I can see that the parent module (type pom) of which all other modules are submodules has a very high build count. Opening it, I see that its delta section includes basically all the files from the target folders of submodules. Does that make sense? I mean, if a file is already triggering a delta build of a submodule, should it also trigger a delta build of higher-level reactor modules?

  19. laeubi commented on Jul 19, 2023

    @laeubi
    Member

    It depends on the delta, basically m2e assumes that if the parent changes there is a high chance that childs are affected (otherwise one won't reference it as a parent), since the last release m2e has some improvements to not build unnecessarily, but this might need still improvements.

  20. reckart commented on Jul 19, 2023

    @reckart

    You say if the parent changes, the child needs to be build - that sounds correct.

    But if I read the view correctly, then the parent is built because files in the target folders of its submodules change - that seems odd. Maybe I am readying the view wrong - I assume the files listed under the delta section are the triggers for the build and not the files updated by the build.

  21. laeubi commented on Jul 19, 2023

    @laeubi
    Member

    Yes these are triggers for a build, but due to the eclipse resource-model m2e will receive deltas for all child items of the parent project so you will see a long list here, but this should not trigger the build as m2e ignores such deltas here if the occur in a submodule:

    private boolean hasRelevantDelta(IMavenProjectFacade projectFacade, IResourceDelta resourceDelta)

    if you can't share your project here, the best bet is to start Eclipse with remote debugging enabled (via eclipse.ini) and then attach a debugger from another instance (you don't need a full m2e workspace for that, just the sources of interest and even those not need to compile for debugging). As said the feature is quite new and there might be cases where it still fails to detect, also the test coverage is very low in the area of "rebuilds", so adding test-cases for an identified issue would be great as well.

  22. reckart commented on Jul 19, 2023

    @reckart

    Sorry for using this as a support/feature request thread... but is there some way of seeing through which way a file was scheduled as a delta trigger? For example, I have some files here in src/main/resources appearing in the delta section, But these particular files should be static (i.e. they should not be touched/written to in any way during builds). Yet they have an increased count in the build # column - which I interpret as them having triggered as many incremental builds - which seems very strange if they are static.

  23. laeubi commented on Jul 19, 2023

    @laeubi
    Member

    but is there some way of seeing through which way a file was scheduled as a delta trigger

    Not really, depending on your OS you might want to use native tools to watch this particular file (e.g. inotify https://serverfault.com/a/780522 ), basically if the file is touched (even if content stays the same) it is assumed as a delta.

  24. reckart commented on Jul 19, 2023

    @reckart

    As said the feature is quite new and there might be cases where it still fails to detect, also the test coverage is very low in the area of "rebuilds", so adding test-cases for an identified issue would be great as well.

    I'll update my m2e to the lastest version before making any further observations... what I am seeing now is old behavior.

  25. laeubi commented on Jul 19, 2023

    @laeubi
    Member

    By the way, there is one bug in resource plugin itself that make things a bit more worse but it has not gotten much attention yet:

  26. reckart commented on Jul 19, 2023

    @reckart

    After upgrading to m2e 2.3.0, numbers in the build view look considerably more sane. Although in many cases, I now see entries that have neither delta nor execution children - so it is unclear what triggered those builds.

  27. reckart commented on Jul 19, 2023

    @reckart

    ... it also seems that many builds are not recorded anymore at all ... E.g. I see builds happing via the progress view, but they do not seem to be added to the Maven Workspace Build view.

  28. laeubi commented on Jul 19, 2023

    @laeubi
    Member

    "build" is not a exclusive m2e term, it could be anything, including java source compiles, verification and so on...

  29. reckart commented on Jul 19, 2023

    @reckart

    Ok, but I clearly can see "Invoking Maven Project Builder" flashing through rapidly in the progress view but the "Maven Workspace Build" view does not seem to be updated accordingly.

  30. AndreasFagschlunger commented on Jul 21, 2023

    @AndreasFagschlunger

    For me the "Maven Workspace Build" doesn't show anything. The loop in the "Progress" view is:

    (m2) Download sources and javadoc...
    Associate javadoc and sources with classpath - <project 1-n>
    

    Then a few

    JPA Project Change Event Handler (Waiting) ...
    

    then

    Building <project x>
    

    And then it starts over with downloading Javadoc & Sources.
    It loops pretty fast, is there a log of the progress available?

    If I disable "Build automatically" the "Building" step is gone, but it loops between "Download sources and javadoc" and "JPA Project Change Event Handler".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions