Repository navigation
[JENKINS-55738] NodeMonitor out of disk space message is wrong for master #20229
Description
When the master goes out of disk space, it is put offline by the hudson.node_monitors.AbstractDiskSpaceMonitor system.
The message has a blank where the node name should be:
Putting back online as there is enough disk space again
I think this is just because c.getName() returns an empty string in
jenkins/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java
Lines 43 to 71 in 9d61a9a
| public Object data(Computer c) { | |
| DiskSpace size = markNodeOfflineIfDiskspaceIsTooLow(c); | |
| // mark online (again), if free space is over threshold | |
| if(size!=null && size.size > getThresholdBytes() && c.isOffline() && c.getOfflineCause() instanceof DiskSpace) | |
| if(this.getClass().equals(((DiskSpace)c.getOfflineCause()).getTrigger())) | |
| if(getDescriptor().markOnline(c)) { | |
| LOGGER.info(Messages.DiskSpaceMonitor_MarkedOnline(c.getName())); | |
| } | |
| return size; | |
| } | |
| /** | |
| * Marks the given node as offline if free disk space is below the configured threshold. | |
| * @param c the node | |
| * @return the free space | |
| * @since 1.521 | |
| */ | |
| @Restricted(NoExternalUse.class) | |
| public DiskSpace markNodeOfflineIfDiskspaceIsTooLow(Computer c) { | |
| DiskSpace size = (DiskSpace) super.data(c); | |
| if(size!=null && size.size < getThresholdBytes()) { | |
| size.setTriggered(this.getClass(), true); | |
| if(getDescriptor().markOffline(c,size)) { | |
| LOGGER.warning(Messages.DiskSpaceMonitor_MarkedOffline(c.getName())); | |
| } | |
| } | |
| return size; | |
| } |
Acceptance criteria
- This should show master instead of a space as the node name, i.e.
Putting back master online as there is enough disk space
Originally reported by
batmat, imported from: NodeMonitor out of disk space message is wrong for master
- assignee:
nisarg14
- status: Resolved
- priority: Trivial
- component(s): core
- label(s): evergreen-triggered, fosdem2019, newbie-friendly
- resolution: Fixed
- resolved: 2019-02-11T22:50:51+00:00
- votes: 0
- watchers: 3
- imported: 2025-11-24
Raw content of original issue
When the master goes out of disk space, it is put offline by the hudson.node_monitors.AbstractDiskSpaceMonitor system.
The message has a blank where the node name should be:
Putting back online as there is enough disk space again
I think this is just because c.getName() returns an empty string in
.jenkins/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java
Lines 43 to 71 in 9d61a9a
public Object data(Computer c) { DiskSpace size = markNodeOfflineIfDiskspaceIsTooLow(c); // mark online (again), if free space is over threshold if(size!=null && size.size > getThresholdBytes() && c.isOffline() && c.getOfflineCause() instanceof DiskSpace) if(this.getClass().equals(((DiskSpace)c.getOfflineCause()).getTrigger())) if(getDescriptor().markOnline(c)) { LOGGER.info(Messages.DiskSpaceMonitor_MarkedOnline(c.getName())); } return size; } /** * Marks the given node as offline if free disk space is below the configured threshold. * @param c the node * @return the free space * @since 1.521 */ @Restricted(NoExternalUse.class) public DiskSpace markNodeOfflineIfDiskspaceIsTooLow(Computer c) { DiskSpace size = (DiskSpace) super.data(c); if(size!=null && size.size < getThresholdBytes()) { size.setTriggered(this.getClass(), true); if(getDescriptor().markOffline(c,size)) { LOGGER.warning(Messages.DiskSpaceMonitor_MarkedOffline(c.getName())); } } return size; } Acceptance criteria
- This should show master instead of a space as the node name, i.e.
Putting back master online as there is enough disk space

Activity
jenkins-infra-bot commentedon Jan 23, 2019
Raw content of original comment:
I would like to work on this issue. So can I assign this to me?
jenkins-infra-bot commentedon Jan 23, 2019
Raw content of original comment:
nisarg14 absolutely, please do. Thanks! If you need help, please reach out to us either on IRC, on on the developers mailing list.
Thanks again!
jenkins-infra-bot commentedon Jan 23, 2019
Raw content of original comment:
Sure. Thank you!!
Actually I am new to open source and also very much excited to contribute.
jenkins-infra-bot commentedon Jan 23, 2019
Raw content of original comment:
I think it would suffice to use Computer.getDisplayName, which is overridden for MasterComputer.
jenkins-infra-bot commentedon Jan 23, 2019
Raw content of original comment:
I want to ask few doubts. So which gitter room should I join to discuss? Or should I ask and discuss here?
jenkins-infra-bot commentedon Jan 23, 2019
Raw content of original comment:
https://gitter.im/jenkinsci/jenkins is always available for live chat, though I generally feel that if you have a specific question about a specific JIRA issue, commenting in that issue is best unless you think it is a broader topic that many people might want to participate in.
jenkins-infra-bot commentedon Jan 23, 2019
Raw content of original comment:
Okay. Thanks
I will go through some necessary part of the code and will post comments here if required.
jenkins-infra-bot commentedon Jan 24, 2019
Raw content of original comment:
If we pass "Putting back online as there is enough disk space again" in Logger.info() then would it be a better behaviour and would it work? As if we change getName() method of Computer class than it would create a problem as this method is used in many places.
jenkins-infra-bot commentedon Jan 24, 2019
Raw content of original comment:
I suspect replacing the two occurrences of c.getName() in the abovementioned code section with c.getDisplayName() would fix this. Most of the work would be figuring out how to verify the fix.
jenkins-infra-bot commentedon Jan 24, 2019
Raw content of original comment:
Yes it may be. But i looked each and every line where c.getName() is called and i think that it would create issue editing that method. So either we have to call another Display method or we should pass directly the string as it is. And in c.getDisplayName() it gets override by returning nodeName which exactly c.getName() does. So I am not sure but it may probably not work. There are two functions of getDisplayName in which one gets override by returning nodeName.
jenkins-infra-bot commentedon Jan 24, 2019
Raw content of original comment:
The reported issue is about MasterComputer, which overrides getDisplayName as previously noted.
jenkins-infra-bot commentedon Jan 24, 2019
Raw content of original comment:
Yes issue is of MasterComputer. But if we replace c.getName() with c.getDisplayName() than would it fix this issue?
jenkins-infra-bot commentedon Jan 24, 2019
Raw content of original comment:
Maybe you should try it and find out.
jenkins-infra-bot commentedon Jan 25, 2019
Raw content of original comment:
#3863
In these pull request 4 existing tests got failed. Can you please help me in figuring out what happened? As no code of that modules were changed.
jenkins-infra-bot commentedon Jan 25, 2019
Raw content of original comment:
Can anyone tell me how can I run tests on my local computer?
12 remaining items
jenkins-infra-bot commentedon Feb 7, 2019
Raw content of original comment:
Answered in the open GitHub Pull Request.
jenkins-infra-bot commentedon Feb 8, 2019
Raw content of original comment:
batmat
I have tested he fix and attaching screenshot of the output of Jenkins Window and CLI.
And I think this fix has resolved the issue of displaying null message.
jenkins-infra-bot commentedon Feb 8, 2019
Raw content of original comment:
nisarg14 the goal here is to fix the message explained in the description.
See the acceptance criteria above.
You need to see how Jenkins reacts when you remove the big files and have enough disk space again.
jenkins-infra-bot commentedon Feb 8, 2019
Raw content of original comment:
batmat
I am attaching the screenshot of the message before the fix :
I have marked the issue with red marker.
jenkins-infra-bot commentedon Feb 8, 2019
Raw content of original comment:
batmat
I am attaching the screenshot of message after the fix.
And I think the issue is solved as per acceptance criteria.
jenkins-infra-bot commentedon Feb 11, 2019
Raw content of original comment:
The fix has been released in Jenkins 2.164. Thanks nisarg14!