[JIRA] (JENKINS-7116) Doesn't take custom workspace into account

13 views
Skip to first unread message

pjdarton@gmail.com (JIRA)

unread,
Jul 15, 2019, 9:18:03 AM7/15/19
to jenkinsc...@googlegroups.com
pjdarton updated an issue
 
Jenkins / Bug JENKINS-7116
Doesn't take custom workspace into account
Change By: pjdarton
Summary: Clean workspace removes workspace if Doesn' t take custom workspace into account
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

pjdarton@gmail.com (JIRA)

unread,
Jul 15, 2019, 9:20:01 AM7/15/19
to jenkinsc...@googlegroups.com
pjdarton updated an issue
The existing code assumes that the workspace being used by the job that's running the cleanup process is unique to that build, and hence can safely be removed from all other slaves.  This assumption is incorrect.

If two jobs are defined with the same "custom workspace folder" then their independent cleanup processes will both be hitting the same folder on all slaves, so one can knock out the workspace of the other.

== Steps to reproduce ==
* define two jobs using the same, custom workspace (/var/hudson/custom). At least, that's what I did. One job should also be sufficient.
* launch a (UNIX) slave, tie two previously mentioned jobs to it
* build both projects
* drink (potentially lots) of coffee ;
- ) and wait for the workspace cleaner to visit the slave

== Actual result ==
* the workspace (/var/hudson/custom) is wiped when the clean workspace job has run. If the first workspace doesn't use a custom workspace, the problem does not occur. It seems that the cleaner doesn't take the custom workspace configuration into account to determine which workspaces are stale.

== Expected result ==
* The custom workspace /var/hudson/custom remains intact after clean workspace job has run.

pjdarton@gmail.com (JIRA)

unread,
Jul 15, 2019, 9:24:02 AM7/15/19
to jenkinsc...@googlegroups.com
pjdarton commented on Bug JENKINS-7116
 
Re: Doesn't take custom workspace into account

Anyone working on a fix for this should take a look at JENKINS-43269 as well as, when fixing one, it might be fairly easy to fix both.

pjdarton@gmail.com (JIRA)

unread,
Aug 21, 2019, 7:12:03 AM8/21/19
to jenkinsc...@googlegroups.com
pjdarton commented on Bug JENKINS-7116

My optimism was misplaced - when the code runs, it has a fairly myopic view of the world and only sees the project/job that it's running within.

To fix this issue properly, it would be necessary for the code, once it has an idea of what workspaces (on what slaves) it might want to remove, to then iterate across the entire Jenkins configuration, asking each project in turn where their "current" workspace is, and then removing this from the list of workspaces to be cleaned. That's unlikely to be quick.
...and I guess it should also iterate across all currently-running builds and ensure that their workspaces aren't cleaned either (as, in the case of concurrent builds, it's possible to have the same build folder being used on multiple slave nodes).

So, while my recent changes will have made this issue easier to fix, they've not fixed it; right now, the only workaround is for users to refrain from enabling the workspace cleanup on jobs that share both workspaces and slaves.
One could argue that, in such a case, there's little point in enabling the plugin for those builds as they're re-using the same workspaces anyway, so the end-user impact of not be able to enable the plugin safely in such situations is of limited significance and hence of "minor" significance rather than "major".

pjdarton@gmail.com (JIRA)

unread,
Aug 21, 2019, 7:12:03 AM8/21/19
to jenkinsc...@googlegroups.com
pjdarton updated an issue
Change By: pjdarton
Priority: Major Minor

pjdarton@gmail.com (JIRA)

unread,
Aug 21, 2019, 7:13:03 AM8/21/19
to jenkinsc...@googlegroups.com
pjdarton assigned an issue to Unassigned
Change By: pjdarton
Assignee: tspengler

pjdarton@gmail.com (JIRA)

unread,
Aug 29, 2019, 8:24:03 AM8/29/19
to jenkinsc...@googlegroups.com
pjdarton closed an issue as Won't Fix
 

Jenkins runs on the assumption that, when it runs a build, that build has sole ownership of the workspace folder it's running in.
If you've got two jobs that both hit the same folder on the same slaves then you've got a problem that you're going to have to resolve yourself (a) by not enabling this plugin for those builds and (b) by ensuring that those builds don't run at the same time.

So, given that, in such circumstances, resource collisions are inevitable unless the user takes responsibility for ensuring that nothing goes awry, I think it's reasonable for the user to take steps to avoid this situation.

I don't think it's reasonable to expect this plugin to go scanning all jobs loaded by Jenkins looking for workspaces that might collide - that could take a long time.

...although, if someone wants to write code that'll do that and make it an optional thing (so not every build has to do that) then I guess that'd be an option.

Change By: pjdarton
Status: Open Closed
Resolution: Won't Fix
Reply all
Reply to author
Forward
0 new messages