maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olaf Krische (JIRA)" <j...@codehaus.org>
Subject [jira] (MNG-5629) ClosedChannelException from DefaultUpdateCheckManager.read
Date Sat, 23 Aug 2014 11:55:10 GMT

    [ https://jira.codehaus.org/browse/MNG-5629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=351740#comment-351740
] 

Olaf Krische commented on MNG-5629:
-----------------------------------

(a simple check on "lock.isValid()" before releasing it would fix it)

{code}
$ touch /tmp/bla

public static void main(String[] args) throws IOException {
  File touchfile = new File("/tmp/bla");
  FileInputStream stream = new FileInputStream( touchfile );
  FileChannel channel = stream.getChannel();
  FileLock lock = channel.lock( 0, channel.size(), true );
  System.err.println("before stream is closed: "+lock.isValid());
  stream.close();
  System.err.println("after stream is closed: "+lock.isValid());
  // will raise the exception, bcs stream is closed
  lock.release();
}
{code}

> ClosedChannelException from DefaultUpdateCheckManager.read
> ----------------------------------------------------------
>
>                 Key: MNG-5629
>                 URL: https://jira.codehaus.org/browse/MNG-5629
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.2.1
>         Environment: Windows 7, Java 7 updated 25
>            Reporter: Anthony Whitford
>         Attachments: xy.tar.gz
>
>
> I ran a build in debug mode ({{mvn -X}}) and noticed the following bug (repeatedly):
> {noformat}
> [DEBUG] Error releasing shared lock for resolution tracking file: C:\Users\awhitford\.m2\repository\org\apache\maven\plugins\maven-war-plugin\resolver-status.properties
> java.nio.channels.ClosedChannelException
> 	at sun.nio.ch.FileLockImpl.release(FileLockImpl.java:58)
> 	at org.apache.maven.repository.legacy.DefaultUpdateCheckManager.read(DefaultUpdateCheckManager.java:396)
> 	at org.apache.maven.repository.legacy.DefaultUpdateCheckManager.readLastUpdated(DefaultUpdateCheckManager.java:323)
> 	at org.apache.maven.repository.legacy.DefaultUpdateCheckManager.readLastUpdated(DefaultUpdateCheckManager.java:159)
> 	at org.apache.maven.repository.legacy.DefaultUpdateCheckManager.isUpdateRequired(DefaultUpdateCheckManager.java:148)
> 	at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolve(DefaultRepositoryMetadataManager.java:127)
> 	at org.apache.maven.project.artifact.MavenMetadataSource.retrieveAvailableVersions(MavenMetadataSource.java:435)
> 	at org.apache.maven.project.artifact.MavenMetadataSource.retrieveAvailableVersions(MavenMetadataSource.java:425)
> 	at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupArtifactVersions(DefaultVersionsHelper.java:229)
> 	at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupPluginUpdates(DefaultVersionsHelper.java:727)
> 	at org.codehaus.mojo.versions.api.DefaultVersionsHelper.lookupPluginsUpdates(DefaultVersionsHelper.java:706)
> 	at org.codehaus.mojo.versions.PluginUpdatesReport.doGenerateReport(PluginUpdatesReport.java:103)
> 	at org.codehaus.mojo.versions.AbstractVersionsReport.executeReport(AbstractVersionsReport.java:253)
> 	at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:90)
> 	at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:228)
> 	at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:319)
> 	at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:135)
> 	at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:175)
> 	at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:138)
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
> 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
> 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
> 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> {noformat}
> I traced the bug to the {{DefaultUpdateCheckManager.read}} method.  [Line 396|http://maven.apache.org/ref/3.2.1/apidocs/src-html/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.html#line.396]
is releasing a FileLock, but the {{FileInputStream}} has already been closed by [Line 381|http://maven.apache.org/ref/3.2.1/apidocs/src-html/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.html#line.381].



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Mime
View raw message