Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Daemon invoker lifespan must be shared with daemon process lifespan #1196

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Nov 8, 2024

As long daemon is alive, the daemon invoker must be kept alive as it holds the "resident" object graph of Maven.

As long daemon is alive, the daemon invoker must be kept
alive as it holds the "resident" object graph of Maven.
@cstamas cstamas requested a review from gnodet November 8, 2024 11:23
@cstamas cstamas self-assigned this Nov 8, 2024
@cstamas cstamas changed the title fix: Daemon lifecycle must be shared with daemon invoker fix: Daemon invoker must be shared with daemon process Nov 8, 2024
@cstamas cstamas changed the title fix: Daemon invoker must be shared with daemon process fix: Daemon invoker lifespan must be shared with daemon process lifespan Nov 8, 2024
@cstamas cstamas marked this pull request as ready for review November 8, 2024 11:47
@gnodet
Copy link
Contributor

gnodet commented Nov 8, 2024

I just tried the fix, but it leads to another problem:

➜  camel git:(jbang-shell) ~/work/git/mvnd/dist/target/maven-mvnd-2.0.0-beta-2-SNAPSHOT-darwin-aarch64/bin/mvnd foo -X
Apache Maven Daemon (mvnd) 2.0.0-beta-2-SNAPSHOT darwin-aarch64 native client (0447f95a3c37d2f61632ef4d5d8046f26bd4984a)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.osx.OsXNativePty
Apache Maven 4.0.0-beta-5 (6e78fcf6f5e76422c0eb358cd11f0c231ecafbad)
Maven home: /Users/gnodet/work/git/mvnd/dist/target/maven-mvnd-2.0.0-beta-2-SNAPSHOT-darwin-aarch64/mvn
Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /Users/gnodet/.sdkman/candidates/java/21.0.4-tem
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "15.0.1", arch: "aarch64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Message scheme: color
[DEBUG] Message styles: trace debug info warning error success failure strong mojo project
[DEBUG] Reading installation settings from '/Users/gnodet/work/git/mvnd/dist/target/maven-mvnd-2.0.0-beta-2-SNAPSHOT-darwin-aarch64/mvn/conf/settings.xml'
[DEBUG] Reading project settings from '/Users/gnodet/work/git/camel/.mvn/settings.xml'
[DEBUG] Reading user settings from '/Users/gnodet/.m2/settings.xml'
[DEBUG] Reading installation toolchains from '/Users/gnodet/work/git/mvnd/dist/target/maven-mvnd-2.0.0-beta-2-SNAPSHOT-darwin-aarch64/mvn/conf/toolchains.xml'
[DEBUG] Reading user toolchains from '/Users/gnodet/.m2/toolchains.xml'
[INFO] Processing build on daemon a7f2f620
[INFO] Daemon status dump:
[INFO] CWD: /Users/gnodet/work/git/camel
[INFO] MAVEN_HOME: /Users/gnodet/work/git/mvnd/dist/target/maven-mvnd-2.0.0-beta-2-SNAPSHOT-darwin-aarch64/mvn
[INFO] USER_HOME: /Users/gnodet
[INFO] topDirectory: /Users/gnodet/work/git/camel
[INFO] rootDirectory: Optional[/Users/gnodet/work/git/camel]
[DEBUG] Using local repository at /Users/gnodet/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/gnodet/.m2/repository
[ERROR] org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
[ERROR]       role: org.eclipse.aether.repository.WorkspaceReader
[ERROR]   roleHint: reactor
org.apache.maven.api.services.LookupException: org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
      role: org.eclipse.aether.repository.WorkspaceReader
  roleHint: reactor
    at org.apache.maven.internal.impl.DefaultLookup.lookup(DefaultLookup.java:60)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:225)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:149)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.doExecute(DefaultMavenInvoker.java:470)
    at org.apache.maven.cli.DaemonMavenInvoker.doExecute(DaemonMavenInvoker.java:146)
    at org.apache.maven.cli.DaemonMavenInvoker.doExecute(DaemonMavenInvoker.java:42)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:108)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:76)
    at org.apache.maven.cling.invoker.LookupInvoker.doInvoke(LookupInvoker.java:238)
    at org.apache.maven.cling.invoker.LookupInvoker.invoke(LookupInvoker.java:213)
    at org.apache.maven.cli.DaemonMavenCling.main(DaemonMavenCling.java:75)
    at org.mvndaemon.mvnd.daemon.Server.handle(Server.java:615)
    at org.mvndaemon.mvnd.daemon.Server.client(Server.java:292)
    at org.mvndaemon.mvnd.daemon.Server.lambda$accept$2(Server.java:254)
    at java.lang.Thread.run(Thread.java:1583)
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
      role: org.eclipse.aether.repository.WorkspaceReader
  roleHint: reactor
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:269)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257)
    at org.apache.maven.internal.impl.DefaultLookup.lookup(DefaultLookup.java:58)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:225)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:149)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.doExecute(DefaultMavenInvoker.java:470)
    at org.apache.maven.cli.DaemonMavenInvoker.doExecute(DaemonMavenInvoker.java:146)
    at org.apache.maven.cli.DaemonMavenInvoker.doExecute(DaemonMavenInvoker.java:42)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:108)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:76)
    at org.apache.maven.cling.invoker.LookupInvoker.doInvoke(LookupInvoker.java:238)
    at org.apache.maven.cling.invoker.LookupInvoker.invoke(LookupInvoker.java:213)
    at org.apache.maven.cli.DaemonMavenCling.main(DaemonMavenCling.java:75)
    at org.mvndaemon.mvnd.daemon.Server.handle(Server.java:615)
    at org.mvndaemon.mvnd.daemon.Server.client(Server.java:292)
    at org.mvndaemon.mvnd.daemon.Server.lambda$accept$2(Server.java:254)
    at java.lang.Thread.run(Thread.java:1583)
Caused by: java.util.NoSuchElementException
    at org.eclipse.sisu.plexus.RealmFilteredBeans$FilteredItr.next(RealmFilteredBeans.java:123)
    at org.eclipse.sisu.plexus.RealmFilteredBeans$FilteredItr.next(RealmFilteredBeans.java:69)
    at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:78)
    at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:58)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:265)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257)
    at org.apache.maven.internal.impl.DefaultLookup.lookup(DefaultLookup.java:58)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:225)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:149)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.doExecute(DefaultMavenInvoker.java:470)
    at org.apache.maven.cli.DaemonMavenInvoker.doExecute(DaemonMavenInvoker.java:146)
    at org.apache.maven.cli.DaemonMavenInvoker.doExecute(DaemonMavenInvoker.java:42)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:108)
    at org.apache.maven.cling.invoker.mvn.DefaultMavenInvoker.execute(DefaultMavenInvoker.java:76)
    at org.apache.maven.cling.invoker.LookupInvoker.doInvoke(LookupInvoker.java:238)
    at org.apache.maven.cling.invoker.LookupInvoker.invoke(LookupInvoker.java:213)
    at org.apache.maven.cli.DaemonMavenCling.main(DaemonMavenCling.java:75)
    at org.mvndaemon.mvnd.daemon.Server.handle(Server.java:615)
    at org.mvndaemon.mvnd.daemon.Server.client(Server.java:292)
    at org.mvndaemon.mvnd.daemon.Server.lambda$accept$2(Server.java:254)
    at java.lang.Thread.run(Thread.java:1583)
[ERROR] 
➜  camel git:(jbang-shell) 

This is a bug in resident invoker
Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm it works !

@gnodet gnodet added this to the 2.0.0-beta-2 milestone Nov 8, 2024
@gnodet gnodet merged commit 7726c16 into apache:master Nov 8, 2024
5 checks passed
@cstamas cstamas deleted the daemon-lifecycle branch November 12, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants