-
Notifications
You must be signed in to change notification settings - Fork 9.1k
YARN-11584. Safely fail on leaf queue with empty name #6148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Prevents auto-creation of a leaf queue with an empty string as the shortname in CapacityScheduler, which caused FATAL exception in RM.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Test failures seem intermittent and unrelated to this change. Same tests pass on my local machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bgoerlitz for this PR! Seems perfect for me. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bgoerlitz for the patch! I was wondering about a possible simplification, see my comments.
if (StringUtils.isEmpty(leafQueueName)) { | ||
throw new SchedulerDynamicEditException( | ||
"Trying to create new queue=" + queue.getFullPath() | ||
+ ", which has empty leaf shortname."); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this part is necessary. QueueManager.createQueue(QueuePath) is only called from CapacityScheduler.getOrCreateQueueFromPlacementContext (at least from production code), and it has the following check right before this call:
//we need to make sure there are no empty path parts present
if (queuePath.hasEmptyPart()) {
LOG.error("Application submitted to invalid path due to empty parts: " +
"'{}'", queuePath);
return null;
}
So essentially we should not be able to reach this from production code, only from tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with this. This path currently does fail due to the fact that QueuePath.hasEmptyParts()
does not actually return true for an empty leaf name, but the added unit test for QueueManager.createQueue(QueuePath)
is not necessary, so I will remove that in the next commit.
if (StringUtils.isEmpty(queueShortName)) { | ||
throw new SchedulerDynamicEditException( | ||
"Trying to create new queue=" + childQueuePath | ||
+ ", which has empty leaf shortname."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this. Going up the callchain:
AbstractParentQueue.createNewQueue
is only called fromParentQueue.addDynamicChildQueue
,- which (through another method) is called from
CapacitySchedulerQueueManager.createAutoQueue
, - which is called from
CapacitySchedulerQueueManager.createQueue
, where my second comment should apply
There is one difference: upon determining whether we're using legacy auto creation or the flexible one we're using different methods, and the flexible auto queue creation (method: CapacitySchedulerQueueManager.createQueue .createAutoQueue(queue)
) manipulates the QueuePath using List<String> parentsToCreate = determineMissingParents(queue)
. If an empty string part can be added to the list, or can slip through I think it's probably there, which I think should be a better place for these checks.
Thanks for the comments @brumi1024. In fact it turns out that |
… for empty leaf shortname As QueuePath.hasEmptyPart() is already called in previously patched code paths, the explicit checks for empty leaf shortname are removed. Additionally, the Unit Test for CapacityScheudulerQueueManager.createQueue(QueuePath) is unnecessary, so was removed.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@bgoerlitz thanks for the update, the latest change LGTM. Merging to trunk. @K0K0V0K thanks for the review. |
Prevents auto-creation of a leaf queue with an empty string as the shortname in CapacityScheduler, which caused FATAL exception in RM.
Description of PR
Auto-creation of a leaf queue does not check that the leaf queue's shortname is non-empty. This PR adds checks in both legacy and AQCv2 paths to catch this scenario and safely throw an exception.
How was this patch tested?
Two new unit tests added.