Yuan Luo created YARN-12059:
-------------------------------
Summary: Fix equality checks in ContainerSignalContext
Key: YARN-12059
URL: https://issues.apache.org/jira/browse/YARN-12059
Project: Hadoop YARN
Issue Type: Bug
Components: nodemanager
Reporter: Yuan Luo
h2. Problem
* {{ContainerSignalContext.equals()}} mixes {{&&}} and {{||}} without grouping
each field comparison. A later matching field can override an earlier mismatch,
allowing contexts with different PIDs, signals, or containers to compare equal
and become inconsistent with {{hashCode()}}.
* The incorrect equality checks also mask invalid PID and container
expectations in six {{TestDefaultOOMHandler}} tests.
h2. Solution
* Compare PID, signal, container, and user with null-safe {{Objects.equals()}}
checks joined by {{&&}}. Keep {{hashCode()}} unchanged.
* Add {{TestContainerSignalContext}} coverage for equal contexts, individual
field mismatches, null fields, unrelated object types, and equal-object hash
codes.
* Correct the expected PID/container pairs in the affected OOM tests. Leave OOM
selection and signaling behavior unchanged.
h2. Validation
* Local macOS 14.7.6, JDK 17.0.8, Maven Wrapper 3.9.15; no native profile.
* Before the production fix, {{TestContainerSignalContext}} runs 7 tests with 3
failures, 0 errors, and 0 skipped. The failures cover different PIDs, signals,
and containers.
* With the complete fix: {{TestContainerSignalContext}} (7),
{{TestDefaultOOMHandler}} (18), {{TestContainerReapContext}} (2), and
{{TestContainerCleanup}} (3): 30 tests, 0 failures, 0 errors, 0 skipped.
* Focused Checkstyle on all three changed files reports 5 violations in
unchanged production code: one {{JavadocPackage}} and four {{HiddenField}}
findings. Both test files have 0 violations.
* Whitespace checks pass for the tracked changes and the new test file.
* The full NodeManager test suite and community CI have not been run.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]