You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jan Sievers (JIRA)" <ji...@codehaus.org> on 2011/11/30 11:31:39 UTC

[jira] Created: (MNG-5206) plexus container never disposed

plexus container never disposed
-------------------------------

                 Key: MNG-5206
                 URL: https://jira.codehaus.org/browse/MNG-5206
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Plugin API
    Affects Versions: 3.0.3
            Reporter: Jan Sievers
         Attachments: plexusDisposeBug.zip

When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
Since maven is creating the plexus container, it should also dispose it (on maven session end?).

Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html

Attached sample project demonstrates the issue.

Steps to reproduce:

1. 'mvn install' sample project
2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'

=> plexus component is injected but never disposed.




--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MNG-5206) plexus container never disposed

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy closed MNG-5206.
-----------------------------

    Resolution: Fixed
      Assignee: Olivier Lamy

fixed r1211692.
Thanks!

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>            Assignee: Olivier Lamy
>             Fix For: 3.0.5
>
>         Attachments: MNG-5206.20111206.patch, MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5206) plexus container never disposed

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=284905#comment-284905 ] 

Olivier Lamy commented on MNG-5206:
-----------------------------------

oh I tested with a mojo which implemented disposable but not with a component injected in a mojo.
this need more investigations and changes in sisu.
With the provided patch you can at least implements Disposable in the mojo and call dispose of the injected component.

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>         Attachments: MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-5206) plexus container never disposed

Posted by "Stuart McCulloch (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart McCulloch updated MNG-5206:
----------------------------------

    Attachment: MNG-5206.20111206.patch

AFAICT the 'container' member variable in MavenCli is only used by the ITs, hence it will never get set when Maven is called from the command-line (this variable could also do with a more specific name imho).

The attached patch will dispose of per-request containers while still allowing the ITs to use a cached container for multiple requests.

You could also consider adding a dispose method to dispose of the cached container which could be used by the ITs if necessary.

With this patch, the component from the example plugin is disposed as expected.

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>         Attachments: MNG-5206.20111206.patch, MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5206) plexus container never disposed

Posted by "Tamás Cservenák (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=284893#comment-284893 ] 

Tamás Cservenák commented on MNG-5206:
--------------------------------------

AFAIK, Maven CLI does not call PlexusContainer.dispose(), it simply exists the JVM. Meaning, no "clean shutdown" happens wrt Plexus in this case.

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>         Attachments: plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (MNG-5206) plexus container never disposed

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy updated MNG-5206:
------------------------------

    Fix Version/s: 3.0.5

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>             Fix For: 3.0.5
>
>         Attachments: MNG-5206.20111206.patch, MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5206) plexus container never disposed

Posted by "Jan Sievers (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=284904#comment-284904 ] 

Jan Sievers commented on MNG-5206:
----------------------------------

I tried the above steps to reproduce with a locally built maven-3 with your patch applied.

Unfortunately it seems that it does not solve the problem for this case.

>From debugging MavenCli it seems that this is because MavenCli#classWorld == null and thus also MavenCli#container == null and so won't be disposed.

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>         Attachments: MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5206) plexus container never disposed

Posted by "Jan Sievers (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=284997#comment-284997 ] 

Jan Sievers commented on MNG-5206:
----------------------------------

yes, I can confirm that mojos which implement Disposable are disposed.
However, this worked before already (I checked it works with maven 3.0.3).

So the issue with injected plexus components not being disposed is unfortunately not solved by the patch.

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>         Attachments: MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-5206) plexus container never disposed

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy updated MNG-5206:
------------------------------

    Attachment: MNG-5206.patch

attach a patch

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>         Attachments: MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5206) plexus container never disposed

Posted by "Jan Sievers (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=285101#comment-285101 ] 

Jan Sievers commented on MNG-5206:
----------------------------------

Thanks Stuart!

I can confirm the patch MNG-5206.20111206.patch solves the issue demonstrated by the plexusDisposeBug.zip attachment.

.

> plexus container never disposed
> -------------------------------
>
>                 Key: MNG-5206
>                 URL: https://jira.codehaus.org/browse/MNG-5206
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.3
>            Reporter: Jan Sievers
>         Attachments: MNG-5206.20111206.patch, MNG-5206.patch, plexusDisposeBug.zip
>
>
> When I use a plexus component which implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, dispose() is never called.
> Since maven is creating the plexus container, it should also dispose it (on maven session end?).
> Also see discussion on sisu-dev: http://dev.eclipse.org/mhonarc/lists/sisu-dev/msg00001.html
> Attached sample project demonstrates the issue.
> Steps to reproduce:
> 1. 'mvn install' sample project
> 2. Use the test mojo: 'mvn org.apache.maven.plugins.test:plexusDisposeBug:0.0.1-SNAPSHOT:test'
> => plexus component is injected but never disposed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira