[JIRA] (JENKINS-12753) Instant update of plugins doesn't work in nfs directory

115 views
Skip to first unread message

alexlehm@gmail.com (JIRA)

unread,
Feb 13, 2012, 7:07:24 PM2/13/12
to jenkinsc...@googlegroups.com
Alex Lehmann created JENKINS-12753:
--------------------------------------

Summary: Instant update of plugins doesn't work in nfs directory
Key: JENKINS-12753
URL: https://issues.jenkins-ci.org/browse/JENKINS-12753
Project: Jenkins
Issue Type: Bug
Components: plugin
Environment: linux, nfs, jenkins 1.450, any plugin
Reporter: Alex Lehmann
Priority: Minor


Got the question from the irc channel, this was initially discussed on the fosdem jenkins booth.

Updating plugins doesn't work when the jenkins home directory is located on nfs, the failure looks like this

Caused by: java.io.IOException: Unable to delete /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/.nfs00000000000e897d00000096

The .nfs files appear when deleting a file on nfs that is still open, in this case the jar files in the lib directory are still open and cannot be deleted.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


kk@kohsuke.org (JIRA)

unread,
Feb 13, 2012, 7:27:24 PM2/13/12
to jenkinsc...@googlegroups.com

[ https://issues.jenkins-ci.org/browse/JENKINS-12753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=158980#comment-158980 ]

Kohsuke Kawaguchi commented on JENKINS-12753:
---------------------------------------------

This appears to indicate that we are trying to overwrite a plugin currently in use, and that won't work regardless, NFS or not.



> Instant update of plugins doesn't work in nfs directory

> -------------------------------------------------------

jenkins-ci.org@michael-prokop.at (JIRA)

unread,
Feb 19, 2012, 9:18:24 AM2/19/12
to jenkinsc...@googlegroups.com

[ https://issues.jenkins-ci.org/browse/JENKINS-12753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159257#comment-159257 ]

Michael Prokop commented on JENKINS-12753:
------------------------------------------

Being the one who raised this issue on IRC (thanks to Alex for reporting it here): this seems to be a locking issue caused by NFS. I can't reproduce the very same issue without NFS and the open .nfs000000... file handle indicates that there's something going wrong with file deletion.



> Instant update of plugins doesn't work in nfs directory

> -------------------------------------------------------

alexlehm@gmail.com (JIRA)

unread,
Feb 19, 2012, 10:56:24 AM2/19/12
to jenkinsc...@googlegroups.com

[ https://issues.jenkins-ci.org/browse/JENKINS-12753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159258#comment-159258 ]

Alex Lehmann commented on JENKINS-12753:
----------------------------------------

the way open files are handled is different on local filesystems and nfs, the issue may be nfs specific, however if Kohsuke is right, it doesn't work on local storage either but it doesn't give an obvious error message in that case.

if the plugin is in use, the different jar files for the plugin are all loaded into the jvm and are open (this is visible with lsof), if the plugin is updated, the files are still open even though they are already delete (this is perfectly ok on local filesystems), e.g. like this (this is the output of lsof|grep java.*xunit.*guice as one example file):

before:
{code}
java 1430 lehmann mem REG 8,1 807021 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
java 1430 lehmann 237r REG 8,1 807021 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
{code}

after:
{code}
java 1430 lehmann DEL REG 8,1 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
java 1430 lehmann 237r REG 8,1 807021 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar (deleted)
{code}

the jars will not be reloaded even if they were written to the directory in a new version.

on nfs, open deleted files are not directly possible, so instead each file is changed to a .nfs file which causes the exception when trying to delete the directory, but reloading wouldn't work either if the files could be deleted (or e.g. are moved to another dir and delete later).

When updating a plugin when the directory is on a local filesystem, the update page still says "xunit plugin is already installed. Jenkins needs to be restarted for the update to take effect" with a yellow ball, so the update process notices that it cannot update the files and forces suggests to restart. With nfs he never gets to the stage where the message appears, but the problem is the same in both cases.



> Instant update of plugins doesn't work in nfs directory

> -------------------------------------------------------

alexlehm@gmail.com (JIRA)

unread,
Feb 19, 2012, 11:00:24 AM2/19/12
to jenkinsc...@googlegroups.com

[ https://issues.jenkins-ci.org/browse/JENKINS-12753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159258#comment-159258 ]

Alex Lehmann edited comment on JENKINS-12753 at 2/19/12 3:59 PM:
-----------------------------------------------------------------

the way open files are handled is different on local filesystems and nfs, the issue may be nfs specific, however if Kohsuke is right, it doesn't work on local storage either but it doesn't give an obvious error message in that case.

if the plugin is in use, the different jar files for the plugin are all loaded into the jvm and are open (this is visible with lsof), if the plugin is updated, the files are still open even though they are already delete (this is perfectly ok on local filesystems), e.g. like this (this is the output of lsof|grep java.*xunit.*guice as one example file):

(removed some columns from the lsof output to fit into the page width)

before:
{code}
mem REG 8,1 807021 4067923 .../plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
237r REG 8,1 807021 4067923 .../plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
{code}

after:
{code}
DEL REG 8,1 4067923 .../plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
237r REG 8,1 807021 4067923 .../plugins/xunit/WEB-INF/lib/guice-2.0.1.jar (deleted)
{code}

the jars will not be reloaded even if they were written to the directory in a new version.

on nfs, open deleted files are not directly possible, so instead each file is changed to a .nfs file which causes the exception when trying to delete the directory, but reloading wouldn't work either if the files could be deleted (or e.g. are moved to another dir and delete later).

When updating a plugin when the directory is on a local filesystem, the update page still says "xunit plugin is already installed. Jenkins needs to be restarted for the update to take effect" with a yellow ball, so the update process notices that it cannot update the files and forces suggests to restart. With nfs he never gets to the stage where the message appears, but the problem is the same in both cases.



was (Author: alexlehm):


the way open files are handled is different on local filesystems and nfs, the issue may be nfs specific, however if Kohsuke is right, it doesn't work on local storage either but it doesn't give an obvious error message in that case.

if the plugin is in use, the different jar files for the plugin are all loaded into the jvm and are open (this is visible with lsof), if the plugin is updated, the files are still open even though they are already delete (this is perfectly ok on local filesystems), e.g. like this (this is the output of lsof|grep java.*xunit.*guice as one example file):

before:
{code}
java 1430 lehmann mem REG 8,1 807021 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
java 1430 lehmann 237r REG 8,1 807021 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
{code}

after:
{code}
java 1430 lehmann DEL REG 8,1 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar
java 1430 lehmann 237r REG 8,1 807021 4067923 /home/lehmann/.jenkins/plugins/xunit/WEB-INF/lib/guice-2.0.1.jar (deleted)
{code}

the jars will not be reloaded even if they were written to the directory in a new version.

on nfs, open deleted files are not directly possible, so instead each file is changed to a .nfs file which causes the exception when trying to delete the directory, but reloading wouldn't work either if the files could be deleted (or e.g. are moved to another dir and delete later).

When updating a plugin when the directory is on a local filesystem, the update page still says "xunit plugin is already installed. Jenkins needs to be restarted for the update to take effect" with a yellow ball, so the update process notices that it cannot update the files and forces suggests to restart. With nfs he never gets to the stage where the message appears, but the problem is the same in both cases.


> Instant update of plugins doesn't work in nfs directory

> -------------------------------------------------------

jglick@cloudbees.com (JIRA)

unread,
May 20, 2014, 11:07:05 AM5/20/14
to jenkinsc...@googlegroups.com

It seems that the problem has been misstated because the bug itself masks the problem. When you already have a plugin installed, you cannot dynamically load its update, ever. Normally Jenkins stops you from trying to do so by throwing a RestartRequiredException. Unfortunately when PluginManager.dynamicLoad is checking whether the plugin is already installed, it calls ClassicPluginStrategy.createPluginWrapper which actually unpacks the *.hpi right away, and when on a filesystem with locks, that fails—and the IOException then is reported as if this were the real error, when the error is simply a user misunderstanding.

Change By: Jesse Glick (20/May/14 3:05 PM)
Summary: Instant update of plugins doesn't work in nfs directory PluginManager.dynamicLoad on installed plugin fails on NFS with IOException not RestartRequiredException
Labels: lock plugin
Component/s: core
Component/s: plugin
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

jglick@cloudbees.com (JIRA)

unread,
May 20, 2014, 11:09:06 AM5/20/14
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-12753

Here is a typical stack trace:

java.nio.file.FileSystemException: /…/plugins/credentials/WEB-INF/lib/.nfs000000000000…: Device or resource busy 
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91) 
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) 
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) 
	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244) 
	at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) 
	at java.nio.file.Files.delete(Files.java:1077) 
	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 hudson.Util.deleteFile(Util.java:238) 
	at hudson.Util.deleteRecursive(Util.java:301) 
	at hudson.Util.deleteContentsRecursive(Util.java:203) 
	at hudson.Util.deleteRecursive(Util.java:300) 
	at hudson.Util.deleteContentsRecursive(Util.java:203) 
	at hudson.Util.deleteRecursive(Util.java:292) 
	at hudson.Util.deleteContentsRecursive(Util.java:203) 
	at hudson.Util.deleteRecursive(Util.java:292) 
	at hudson.ClassicPluginStrategy.explode(ClassicPluginStrategy.java:423) 
	at hudson.ClassicPluginStrategy.createPluginWrapper(ClassicPluginStrategy.java:128) 
	at hudson.PluginManager.dynamicLoad(PluginManager.java:412) 
	at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1300)
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

jglick@cloudbees.com (JIRA)

unread,
May 20, 2014, 12:07:04 PM5/20/14
to jenkinsc...@googlegroups.com
Change By: Jesse Glick (20/May/14 4:05 PM)
Assignee: Jesse Glick
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

jglick@cloudbees.com (JIRA)

unread,
May 20, 2014, 12:07:04 PM5/20/14
to jenkinsc...@googlegroups.com
Jesse Glick started work on Bug JENKINS-12753
Change By: Jesse Glick (20/May/14 4:05 PM)
Status: Open In Progress
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

jglick@cloudbees.com (JIRA)

unread,
May 20, 2014, 12:28:05 PM5/20/14
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-12753

Tried to reproduce on Windows, where I would expect this to also be a problem, but did not get that far: only Download now and install after restart is offered in /pluginManager/ to begin with.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

scm_issue_link@java.net (JIRA)

unread,
May 20, 2014, 1:57:07 PM5/20/14
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
core/src/main/java/hudson/ClassicPluginStrategy.java
core/src/main/java/hudson/PluginManager.java
core/src/main/java/hudson/PluginStrategy.java
core/src/main/java/hudson/PluginWrapper.java
test/src/test/java/hudson/PluginManagerTest.java
http://jenkins-ci.org/commit/jenkins/7f856b56082b0b164c94bafc108408dfc4b4b138
Log:
[FIXED JENKINS-12753] Added PluginStrategy.getShortName to avoid actually trying to unpack a plugin before throwing RestartRequiredException.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

scm_issue_link@java.net (JIRA)

unread,
May 20, 2014, 1:57:07 PM5/20/14
to jenkinsc...@googlegroups.com
Change By: SCM/JIRA link daemon (20/May/14 5:56 PM)
Status: In Progress Resolved
Resolution: Fixed
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

daniel@beckweb.net (JIRA)

unread,
May 20, 2014, 2:33:04 PM5/20/14
to jenkinsc...@googlegroups.com
Daniel Beck commented on Bug JENKINS-12753

Jesse: Since JENKINS-20732

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

dogfood@java.net (JIRA)

unread,
May 20, 2014, 2:55:06 PM5/20/14
to jenkinsc...@googlegroups.com
dogfood commented on Bug JENKINS-12753

Integrated in jenkins_main_trunk #3390
[FIXED JENKINS-12753] Added PluginStrategy.getShortName to avoid actually trying to unpack a plugin before throwing RestartRequiredException. (Revision 7f856b56082b0b164c94bafc108408dfc4b4b138)

Result = SUCCESS
Jesse Glick : 7f856b56082b0b164c94bafc108408dfc4b4b138
Files :

  • core/src/main/java/hudson/PluginStrategy.java
  • test/src/test/java/hudson/PluginManagerTest.java
  • core/src/main/java/hudson/PluginWrapper.java
  • core/src/main/java/hudson/PluginManager.java
  • core/src/main/java/hudson/ClassicPluginStrategy.java
  • changelog.html
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.

jglick@cloudbees.com (JIRA)

unread,
May 20, 2014, 3:30:04 PM5/20/14
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-12753

Finally did manage to reproduce the corresponding bug on Windows in 1.554.1:

May 20, 2014 3:26:21 PM INFO hudson.model.UpdateCenter$DownloadJob run
Starting the installation of Support Core Plugin on behalf of anonymous
May 20, 2014 3:26:21 PM INFO hudson.model.UpdateCenter$UpdateCenterConfiguration download
Downloading Support Core Plugin
May 20, 2014 3:26:22 PM INFO hudson.PluginManager dynamicLoad
Attempting to dynamic load C:\Documents and Settings\Jesse Glick\.jenkins\plugins\support-core.jpi
May 20, 2014 3:26:22 PM SEVERE hudson.model.UpdateCenter$DownloadJob run
Failed to install Support Core Plugin
java.io.IOException: Failed to dynamically deploy this plugin
	at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1304)
	at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1103)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:104)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.nio.file.FileSystemException: C:\Documents and Settings\Jesse Glick\.jenkins\plugins\support-core\WEB-INF\lib\animal-sniffer-annotations-1.9.jar: The process cannot access the file because it is being used by another process.

	at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
	at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
	at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
	at java.nio.file.Files.delete(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at hudson.Util.deleteFile(Util.java:238)
	at hudson.Util.deleteRecursive(Util.java:301)
	at hudson.Util.deleteContentsRecursive(Util.java:203)
	at hudson.Util.deleteRecursive(Util.java:292)
	at hudson.Util.deleteContentsRecursive(Util.java:203)
	at hudson.Util.deleteRecursive(Util.java:292)
	at hudson.Util.deleteContentsRecursive(Util.java:203)
	at hudson.Util.deleteRecursive(Util.java:292)
	at hudson.ClassicPluginStrategy.explode(ClassicPluginStrategy.java:422)
	at hudson.ClassicPluginStrategy.createPluginWrapper(ClassicPluginStrategy.java:126)
	at hudson.PluginManager.dynamicLoad(PluginManager.java:415)
	at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1300)
	... 5 more
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
Reply all
Reply to author
Forward
0 new messages