-
Notifications
You must be signed in to change notification settings - Fork 2k
Test oom case #10314
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
base: main
Are you sure you want to change the base?
Test oom case #10314
Conversation
|
/bot run --stage-list "GB200-8_GPUs-2_Nodes-PyTorch-1,GB200-4_GPUs-PyTorch-2" |
📝 WalkthroughWalkthroughThis PR adds runtime diagnostics and debug logging across shutdown methods and lifecycle events in executor, LLM API, and test infrastructure components. Changes include printing process IDs, stack traces, and diagnostic banners without modifying control flow. Test infrastructure updates add memory monitoring utilities and test parameterization. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
tensorrt_llm/executor/rpc_worker.py (1)
101-107: Fix undefinedosinRpcWorker.shutdown
shutdownprints the PID viaos.getpid(), but this module never importsos, so callingshutdown()will raiseNameError.Proposed patch
-from pathlib import Path -from queue import Queue -from threading import Event -from typing import Optional, Union - -import nvtx +from pathlib import Path +from queue import Queue +from threading import Event +from typing import Optional, Union + +import os +import nvtx @@ def shutdown(self): logger_debug(f"[worker] RpcWorker #{mpi_rank()} is shutting down", color="yellow") self.shutdown_event.set() - print( - f"====================== shutdown in RpcWorker is called pid: {os.getpid()}" - ) + print( + f"====================== shutdown in RpcWorker is called pid: {os.getpid()}" + )tests/integration/defs/accuracy/test_llm_api_pytorch.py (1)
1418-1444: Remove commented-out diagnostic code and fix f-string usage.This section contains:
- Commented-out code (lines 1419, 1436, 1442-1444) that should be removed
- f-strings without placeholders (lines 1420, 1433, 1437, 1440) that should use regular strings
- Inconsistent diagnostic prints - some are active, some are commented out
As per the coding guidelines: "Avoid using... commented-out code" and static analysis correctly flags the unnecessary f-string prefixes.
🔎 Proposed cleanup
- #time.sleep(5) - print(f"================= print mem before testing") - print_device_memory() + # Remove commented-out diagnostic code or make it conditionalFor active diagnostic prints, fix f-strings:
- print(f"================= print mem after testing") + print("================= print mem after testing") print_device_memory() - #time.sleep(5) - print(f"================= print mem after testing outside") - print_device_memory() - - print(f"++++++++++++++++++++++++++++++++++++++++\n\n\n") - - #time.sleep(60) - #print(f"================= print mem after 60s") - #print_device_memory() + # Remove or make conditional as suggested in previous comment
🧹 Nitpick comments (10)
tensorrt_llm/commands/serve.py (1)
47-49: Consider using consistent logging approach throughout the signal handler.This
print()statement is inconsistent with thelogger.info()calls used throughout the rest of this signal handler (lines 53-54, 61-62, 68-69, 73-74, 77-78).The comment on line 52 mentions "Using print for safety in signal handlers," but if
logger.info()is acceptable for the existing logging statements, consider using it here as well for consistency. Alternatively, if signal safety is a genuine concern, all logging in this handler should useprint().🔎 Suggested fix for consistency
- print( - f"================================================ server received signal {signal.Signals(signum).name}" - ) + logger.info( + f"Server received signal {signal.Signals(signum).name}. Initiating cleanup." + )tensorrt_llm/_torch/pyexecutor/py_executor_creator.py (1)
224-227: Remove commented-out debug prints or convert to gated loggingThe commented
import/traceback.print_stack()lines increate_py_executorlook like temporary debugging artifacts. Either remove them, or if you still need this information, reintroduce it vialogger/logger_debugand gate it behind an env flag orenable_llm_debug().tensorrt_llm/_torch/pyexecutor/py_executor.py (1)
451-460: Gate shutdown stack/ PID diagnostics behind debug controls
PyExecutor.shutdown()now always prints a full stack trace and PID to stdout. That’s useful for debugging but very noisy in normal runs, especially since this path is hit on every executor teardown. Consider:
- Using
logger/logger_debuginstead of baretraceback.print_stack().- Gating these diagnostics behind
enable_llm_debug()or a dedicated env flag so production users don’t get unexpected console spam.tensorrt_llm/executor/base_worker.py (1)
640-641: Route worker shutdown banner through logger or debug flag
BaseWorker.shutdown()now unconditionally prints a banner to stdout. For consistency with the rest of the executor stack and to avoid polluting user stdout (especially sinceshutdown()can be called from__del__), consider switching this tologger.debug/logger.info(orlogger_debug) and/or gating it behind a debug flag.tensorrt_llm/executor/proxy.py (1)
293-295: Avoid unconditional stdout prints inGenerationExecutorProxy.shutdownThe shutdown path now prints PID banners to stdout at both the beginning and end. This is helpful when debugging but can be quite noisy for normal users and in multi-process setups.
Consider:
- Replacing these with
logger_debug/logger.infomessages, or- Wrapping them in a debug check (e.g.,
enable_llm_debug()or an env flag),so that default behavior relies on the existing logging/tracing stack instead of raw
Also applies to: 331-333
tensorrt_llm/executor/rpc/rpc_server.py (1)
137-139: Use logger for RPCServer shutdown diagnostics instead of bare print
RPCServer.shutdown()now prints a banner withis_remote_calldirectly to stdout. Since this class already useslogger_debug, and shutdown can be triggered frequently (including via remote calls), it would be cleaner to:
- Log this via
logger_debug(orlogger.info) with the same message, and/or- Guard the extra logging behind a debug flag.
That keeps diagnostics while avoiding unconditional stdout noise.
tensorrt_llm/executor/ray_executor.py (1)
296-299: Prefer logger-based shutdown diagnostics inRayExecutor.shutdownThe Ray executor now prints the PID directly in
shutdown(). Since you already log"Shutting down RayExecutor"vialogger_debug, consider folding the PID into that log (or another logger call) and/or guarding it behind a debug flag instead of usingtensorrt_llm/llmapi/mpi_session.py (1)
162-167: Consider simplifying diagnostic prints (f-strings without interpolation)Both
MpiPoolSession.shutdownandMpiCommSession.shutdownadd plain banner prints using f-strings but without any placeholders. This is harmless but trips Ruff’s F541 and is slightly noisy.If you want to keep linters quiet while retaining the diagnostics, you can drop the
fprefix:print("==================================== shutdown MPI pool session") ... print("==================================== shutdown is called MPI comm session")Also applies to: 238-249
tensorrt_llm/llmapi/llm.py (1)
175-178: Diagnostics are very verbose and repeatedly importos/tracebackThese additions provide helpful visibility (PID and stack traces) around LLM lifecycle and shutdown, but a few caveats:
shutdown,_shutdown_wrapper,__exit__, and__del__will now always print stack traces and banners, which can be quite noisy in normal usage and in libraries embedded in larger apps.os(andtraceback) are re-imported inside methods even thoughosis already imported at module level; this is harmless but unnecessary.If these are primarily for debugging OOM or CI issues, consider:
- Guarding them behind an env flag or
enable_llm_debug()-style switch.- Reusing the module-level
osimport and a singleimport tracebackat top of file.Also applies to: 821-829, 854-859, 871-876, 883-886
tensorrt_llm/executor/rpc_proxy.py (1)
189-200: Shutdown debug prints may be excessively noisy
GenerationExecutorRpcProxy.shutdownnow always:
- Dumps a full stack trace, and
- Prints PID banners twice per shutdown.
Behavior is unchanged, but for regular runs this may clutter logs significantly.
If these are for targeted debugging, consider gating them behind a debug env variable or using
logger_debuginstead of unconditionaltraceback.print_stack().
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
tensorrt_llm/_torch/pyexecutor/py_executor.pytensorrt_llm/_torch/pyexecutor/py_executor_creator.pytensorrt_llm/commands/serve.pytensorrt_llm/executor/base_worker.pytensorrt_llm/executor/proxy.pytensorrt_llm/executor/ray_executor.pytensorrt_llm/executor/ray_gpu_worker.pytensorrt_llm/executor/rpc/rpc_server.pytensorrt_llm/executor/rpc_proxy.pytensorrt_llm/executor/rpc_worker.pytensorrt_llm/executor/utils.pytensorrt_llm/executor/worker.pytensorrt_llm/llmapi/llm.pytensorrt_llm/llmapi/mpi_session.pytests/integration/defs/accuracy/test_llm_api_pytorch.pytests/integration/defs/conftest.pytests/integration/test_lists/test-db/l0_gb200_multi_nodes.ymltests/integration/test_lists/waives.txt
💤 Files with no reviewable changes (1)
- tests/integration/test_lists/waives.txt
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: Code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces. Do not use tabs
Always maintain the namespace when importing in Python, even if only one class or function from a module is used
Python files should use snake_case naming:some_file.py
Python classes should use PascalCase naming:class SomeClass
Python functions and methods should use snake_case naming:def my_awesome_function():
Python local variables should use snake_case naming:my_variable = ...
Python variable names that start with a number should be prefixed with 'k':k_99th_percentile = ...
Python global variables should use upper snake_case with prefix 'G':G_MY_GLOBAL = ...
Python constants should use upper snake_case naming:MY_CONSTANT = ...
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Python comments should be reserved for code within a function, or interfaces that are local to a file
Use Google style docstrings in Python for classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with type and description
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except to the smallest set of errors possible
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible, using the else block for logic
Files:
tensorrt_llm/executor/rpc_proxy.pytensorrt_llm/executor/proxy.pytensorrt_llm/executor/utils.pytensorrt_llm/executor/base_worker.pytensorrt_llm/executor/worker.pytensorrt_llm/llmapi/llm.pytensorrt_llm/commands/serve.pytensorrt_llm/_torch/pyexecutor/py_executor_creator.pytensorrt_llm/executor/rpc/rpc_server.pytensorrt_llm/_torch/pyexecutor/py_executor.pytensorrt_llm/llmapi/mpi_session.pytests/integration/defs/conftest.pytensorrt_llm/executor/ray_executor.pytensorrt_llm/executor/ray_gpu_worker.pytests/integration/defs/accuracy/test_llm_api_pytorch.pytensorrt_llm/executor/rpc_worker.py
**/*.{cpp,h,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the year of its latest meaningful modification
Files:
tensorrt_llm/executor/rpc_proxy.pytensorrt_llm/executor/proxy.pytensorrt_llm/executor/utils.pytensorrt_llm/executor/base_worker.pytensorrt_llm/executor/worker.pytensorrt_llm/llmapi/llm.pytensorrt_llm/commands/serve.pytensorrt_llm/_torch/pyexecutor/py_executor_creator.pytensorrt_llm/executor/rpc/rpc_server.pytensorrt_llm/_torch/pyexecutor/py_executor.pytensorrt_llm/llmapi/mpi_session.pytests/integration/defs/conftest.pytensorrt_llm/executor/ray_executor.pytensorrt_llm/executor/ray_gpu_worker.pytests/integration/defs/accuracy/test_llm_api_pytorch.pytensorrt_llm/executor/rpc_worker.py
🧠 Learnings (10)
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagam
Repo: NVIDIA/TensorRT-LLM PR: 6487
File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12
Timestamp: 2025-08-06T13:58:07.506Z
Learning: In TensorRT-LLM, test files (files under tests/ directories) do not require NVIDIA copyright headers, unlike production source code files. Test files typically start directly with imports, docstrings, or code.
Applied to files:
tensorrt_llm/llmapi/llm.pytests/integration/defs/accuracy/test_llm_api_pytorch.py
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
Repo: NVIDIA/TensorRT-LLM PR: 6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.
Applied to files:
tensorrt_llm/llmapi/llm.pytests/integration/test_lists/test-db/l0_gb200_multi_nodes.ymltests/integration/defs/accuracy/test_llm_api_pytorch.py
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 7645
File: tests/integration/test_lists/qa/llm_function_core.txt:648-648
Timestamp: 2025-09-09T09:40:45.658Z
Learning: In TensorRT-LLM test lists, it's common and intentional for the same test to appear in multiple test list files when they serve different purposes (e.g., llm_function_core.txt for comprehensive core functionality testing and llm_function_core_sanity.txt for quick sanity checks). This duplication allows tests to be run in different testing contexts.
Applied to files:
tensorrt_llm/llmapi/llm.pytests/integration/test_lists/test-db/l0_gb200_multi_nodes.ymltests/integration/defs/accuracy/test_llm_api_pytorch.py
📚 Learning: 2025-08-19T12:45:11.997Z
Learnt from: amitz-nv
Repo: NVIDIA/TensorRT-LLM PR: 7033
File: tensorrt_llm/_torch/pyexecutor/model_engine.py:0-0
Timestamp: 2025-08-19T12:45:11.997Z
Learning: In tensorrt_llm/_torch/pyexecutor/model_engine.py, DoRA (Delta Orthogonal Rank Adaptation) functionality was removed from the PyTorch flow to eliminate issues with inverted DoRA detection logic. The original is_dora condition was checking if scaling_vec_pointer == 0, which was potentially incorrect.
Applied to files:
tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
📚 Learning: 2025-12-12T03:27:08.565Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 9655
File: tensorrt_llm/_torch/pyexecutor/sampler.py:3031-3031
Timestamp: 2025-12-12T03:27:08.565Z
Learning: In files under tensorrt_llm/_torch/pyexecutor, avoid accessing torch.Tensor objects inside for-loops when iterating over requests. Convert batched tensors to Python lists beforehand using tensor.tolist(), and then iterate over those lists. This improves performance by reducing tensor-bound operations inside hot loops. Apply this pattern to similar code paths that process batches to access simple Python data structures (lists) inside loops.
Applied to files:
tensorrt_llm/_torch/pyexecutor/py_executor_creator.pytensorrt_llm/_torch/pyexecutor/py_executor.py
📚 Learning: 2025-09-17T02:48:52.732Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 7781
File: tests/integration/test_lists/waives.txt:313-313
Timestamp: 2025-09-17T02:48:52.732Z
Learning: In TensorRT-LLM, `tests/integration/test_lists/waives.txt` is specifically for waiving/skipping tests, while other test list files like those in `test-db/` and `qa/` directories are for different test execution contexts (pre-merge, post-merge, QA tests). The same test appearing in both waives.txt and execution list files is intentional - the test is part of test suites but will be skipped due to the waiver.
Applied to files:
tests/integration/test_lists/test-db/l0_gb200_multi_nodes.yml
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nv
Repo: NVIDIA/TensorRT-LLM PR: 7192
File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72
Timestamp: 2025-08-26T09:49:04.956Z
Learning: In TensorRT-LLM test configuration files, the test scheduling system handles wildcard matching with special rules that prevent duplicate test execution even when the same tests appear in multiple yaml files with overlapping GPU wildcards (e.g., "*b200*" and "*gb200*").
Applied to files:
tests/integration/test_lists/test-db/l0_gb200_multi_nodes.ymltests/integration/defs/accuracy/test_llm_api_pytorch.py
📚 Learning: 2025-08-13T11:07:11.772Z
Learnt from: Funatiq
Repo: NVIDIA/TensorRT-LLM PR: 6754
File: tests/integration/test_lists/test-db/l0_a30.yml:41-47
Timestamp: 2025-08-13T11:07:11.772Z
Learning: In TensorRT-LLM test configuration files like tests/integration/test_lists/test-db/l0_a30.yml, TIMEOUT values are specified in minutes, not seconds.
Applied to files:
tests/integration/test_lists/test-db/l0_gb200_multi_nodes.yml
📚 Learning: 2025-08-29T14:07:45.863Z
Learnt from: EmmaQiaoCh
Repo: NVIDIA/TensorRT-LLM PR: 7370
File: tests/unittest/trt/model_api/test_model_quantization.py:24-27
Timestamp: 2025-08-29T14:07:45.863Z
Learning: In TensorRT-LLM's CI infrastructure, pytest skip markers (pytest.mark.skip) are properly honored even when test files have __main__ blocks that call test functions directly. The testing system correctly skips tests without requiring modifications to the __main__ block execution pattern.
Applied to files:
tests/integration/defs/accuracy/test_llm_api_pytorch.py
📚 Learning: 2025-08-11T20:09:24.389Z
Learnt from: achartier
Repo: NVIDIA/TensorRT-LLM PR: 6763
File: tests/integration/defs/triton_server/conftest.py:16-22
Timestamp: 2025-08-11T20:09:24.389Z
Learning: In the TensorRT-LLM test infrastructure, the team prefers simple, direct solutions (like hard-coding directory traversal counts) over more complex but robust approaches when dealing with stable directory structures. They accept the maintenance cost of updating tests if the layout changes.
Applied to files:
tests/integration/defs/accuracy/test_llm_api_pytorch.py
🧬 Code graph analysis (4)
tensorrt_llm/executor/base_worker.py (3)
tensorrt_llm/_torch/device_mesh.py (1)
rank(36-37)tensorrt_llm/mapping.py (2)
rank(199-200)rank(203-210)tensorrt_llm/_torch/distributed/communicator.py (2)
rank(40-41)rank(451-452)
tensorrt_llm/executor/worker.py (2)
tensorrt_llm/_utils.py (1)
mpi_rank(537-544)tensorrt_llm/llmapi/utils.py (1)
logger_debug(106-120)
tensorrt_llm/llmapi/llm.py (10)
tensorrt_llm/executor/base_worker.py (1)
shutdown(640-649)tensorrt_llm/executor/proxy.py (1)
shutdown(292-341)tensorrt_llm/executor/ray_executor.py (1)
shutdown(290-345)tensorrt_llm/executor/ray_gpu_worker.py (2)
shutdown(153-158)shutdown(298-339)tensorrt_llm/executor/rpc_proxy.py (1)
shutdown(189-235)tensorrt_llm/executor/rpc_worker.py (1)
shutdown(101-110)tensorrt_llm/executor/utils.py (1)
shutdown(103-107)tensorrt_llm/executor/worker.py (1)
shutdown(86-127)tensorrt_llm/llmapi/mpi_session.py (2)
shutdown(100-101)shutdown(162-166)tensorrt_llm/scaffolding/worker.py (3)
shutdown(35-36)shutdown(118-120)shutdown(260-262)
tests/integration/defs/accuracy/test_llm_api_pytorch.py (1)
tests/integration/defs/conftest.py (2)
parametrize_with_ids(1832-1858)print_device_memory(2046-2063)
🪛 Ruff (0.14.10)
tensorrt_llm/executor/utils.py
105-105: f-string without any placeholders
Remove extraneous f prefix
(F541)
tensorrt_llm/executor/worker.py
343-343: Use raise without specifying exception name
Remove exception name
(TRY201)
tensorrt_llm/llmapi/llm.py
881-881: Avoid specifying long messages outside the exception class
(TRY003)
tensorrt_llm/llmapi/mpi_session.py
163-163: f-string without any placeholders
Remove extraneous f prefix
(F541)
242-242: f-string without any placeholders
Remove extraneous f prefix
(F541)
tests/integration/defs/conftest.py
2015-2015: Function call with shell=True parameter identified, security issue
(S604)
2029-2029: Abstract raise to an inner function
(TRY301)
2029-2029: Avoid specifying long messages outside the exception class
(TRY003)
2040-2040: Do not use bare except
(E722)
2056-2056: f-string without any placeholders
Remove extraneous f prefix
(F541)
2057-2057: Starting a process with a partial executable path
(S607)
tests/integration/defs/accuracy/test_llm_api_pytorch.py
538-538: Unused method argument: pp_size
(ARG002)
1361-1361: f-string without any placeholders
Remove extraneous f prefix
(F541)
1420-1420: f-string without any placeholders
Remove extraneous f prefix
(F541)
1433-1433: f-string without any placeholders
Remove extraneous f prefix
(F541)
1437-1437: f-string without any placeholders
Remove extraneous f prefix
(F541)
1440-1440: f-string without any placeholders
Remove extraneous f prefix
(F541)
2295-2295: f-string without any placeholders
Remove extraneous f prefix
(F541)
2343-2343: f-string without any placeholders
Remove extraneous f prefix
(F541)
tensorrt_llm/executor/rpc_worker.py
106-106: Undefined name os
(F821)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (4)
tensorrt_llm/executor/worker.py (2)
86-128: Additional shutdown diagnostics inGenerationExecutorWorkerlook safeThe new PID-annotated prints around worker and engine shutdown are side-effect-only and don’t alter the existing shutdown sequencing or guards (
doing_shutdown, engine cleanup). Safe to keep for troubleshooting.
175-176: Worker main-loop diagnostics are reasonableThe extra log/print when:
- entering/exiting
worker_main, and- exiting the request loop or error path,
help clarify shutdown paths without changing control flow. The final
logger_debugon exit is also low-risk.Also applies to: 326-344
tests/integration/test_lists/test-db/l0_gb200_multi_nodes.yml (1)
35-38: Isolated scheduling flags for DeepSeekR1 multi-node tests look consistentAdding
ISOLATIONto these long-runningtest_nvfp4_multi_gpus[...]cases under thepost_mergeblock matches the existing TIMEOUT-style syntax and should help keep them from overlapping with other heavy jobs. No functional impact on the tests themselves.tests/integration/defs/accuracy/test_llm_api_pytorch.py (1)
17-17: Consider the intended lifespan of this diagnostic code.Based on the PR title "Test oom case" and the commit messages about logging device memory, this appears to be diagnostic code for investigating OOM scenarios. However, the current implementation has several concerns for production use:
- Performance impact: Sleep times totaling 240+ seconds per test run
- Incomplete implementation: Unused
pp_sizeparameter (line 538)- Code quality: Commented-out code, f-strings without placeholders
- Manual resource management: Unusual gc.collect() patterns
Recommendations:
If this is temporary debugging:
- Consider keeping in a separate branch or behind a feature flag
- Document in the PR description that it's for diagnostic purposes only
- Plan for cleanup before merge
If this needs to be permanent:
- Make all diagnostics conditional via environment variable
- Fix the unused
pp_sizeparameter- Remove commented-out code and fix f-strings
- Investigate why manual GC is needed and fix root cause
- Reduce or make sleep times configurable
Would you like help refactoring this to use conditional diagnostics or pytest fixtures for cleaner integration?
Also applies to: 63-65
⛔ Skipped due to learnings
Learnt from: djns99 Repo: NVIDIA/TensorRT-LLM PR: 6915 File: cpp/tensorrt_llm/kernels/cutlass_kernels/moe_gemm/moe_kernels.cu:4010-4012 Timestamp: 2025-08-14T23:23:27.449Z Learning: For MOE (Mixture of Experts) code reviews in TensorRT-LLM, avoid repeatedly suggesting finalize fusion validation checks and safety assertions. The user djns99 has indicated these suggestions are repetitive and unwanted across multiple MOE-related changes.
| def shutdown(self): | ||
| print( | ||
| f"====================== shutdown in RayWorkerWrapper is called pid: {os.getpid()}" | ||
| ) | ||
| if hasattr(self, 'worker'): | ||
| self.worker.shutdown() | ||
|
|
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.
Fix mislabelled shutdown message and consider logger/gating for Ray worker prints
Two shutdown paths now print directly to stdout:
RayWorkerWrapper.shutdown()prints a PID banner.RayGPUWorker.shutdown()also prints a PID banner, but the message string still says"shutdown in RayWorkerWrapper"— which is confusing and looks like a copy–paste error.
I’d recommend:
- Correcting the label in
RayGPUWorker.shutdown()to match the class name. - (Optionally) routing both banners through
loggerinstead of bareprintand/or gating them behind a debug flag, to avoid noisy stdout from Ray actors.
Proposed fix for the mislabelled message
def shutdown(self):
-
if self.doing_shutdown:
return
else:
self.doing_shutdown = True
- print(
- f"====================== shutdown in RayWorkerWrapper is called pid: {os.getpid()}"
- )
+ print(
+ f"====================== shutdown in RayGPUWorker is called pid: {os.getpid()}"
+ )Also applies to: 304-306
🤖 Prompt for AI Agents
In tensorrt_llm/executor/ray_gpu_worker.py around lines 153-159 (and similarly
lines 304-306), the shutdown banner messages are printed to stdout and one
message is mislabelled as "shutdown in RayWorkerWrapper" inside
RayGPUWorker.shutdown; change the string to reference the correct class name
(RayGPUWorker) and replace bare print calls with the module logger (e.g.,
logger.info or logger.debug) or gate the messages behind a debug flag so actor
stdout is not noisy; ensure you still call self.worker.shutdown() when present
and keep the PID included in the log for diagnostics.
| def shutdown(self): | ||
| print( | ||
| f"==================================== shutdown ProcessPoolExecutor session" | ||
| ) | ||
| self.mpi_pool.shutdown(wait=True) |
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.
Fix redundant f-string and consider routing shutdown banner through logger
The new shutdown banner is an f-string without any placeholders (Ruff F541) and uses a bare print. Please drop the unnecessary f and, if you intend to keep this long‑term, consider moving it to the logging infrastructure or gating it behind a debug flag to avoid noisy stdout in production.
Proposed minimal fix for F541
def shutdown(self):
- print(
- f"==================================== shutdown ProcessPoolExecutor session"
- )
+ print("==================================== shutdown ProcessPoolExecutor session")
self.mpi_pool.shutdown(wait=True)🧰 Tools
🪛 Ruff (0.14.10)
105-105: f-string without any placeholders
Remove extraneous f prefix
(F541)
🤖 Prompt for AI Agents
In tensorrt_llm/executor/utils.py around lines 103 to 107, remove the redundant
f-prefix from the shutdown banner string and replace the bare print with the
logging infrastructure (e.g., logger.debug or logger.info) or gate it behind a
debug flag; ensure you reference an existing module/class logger (or add one via
logging.getLogger(__name__)) and keep the self.mpi_pool.shutdown(wait=True) call
as-is.
| @pytest.mark.parametrize("pp_size", [2, 4], ids=["pp2", "pp4"]) | ||
| def test_auto_dtype(self, pp_size): |
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.
Critical: pp_size parameter is unused in the test body.
The test is parameterized with pp_size values [2, 4], but this parameter is never used when creating the LLM instance or configuring the test. This appears to be incomplete implementation.
Based on the parameter name and the PR context for testing OOM cases, you likely intended to test different pipeline parallel configurations. Please either:
- Use the parameter:
pipeline_parallel_size=pp_sizein the LLM constructor - Remove the parameterization if it's not needed
🔎 Proposed fix to use the parameter
@pytest.mark.parametrize("pp_size", [2, 4], ids=["pp2", "pp4"])
def test_auto_dtype(self, pp_size):
print_device_memory()
- with LLM(self.MODEL_PATH) as llm:
+ with LLM(self.MODEL_PATH, pipeline_parallel_size=pp_size) as llm:
task = CnnDailymail(self.MODEL_NAME)
task.evaluate(llm)Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Ruff (0.14.10)
538-538: Unused method argument: pp_size
(ARG002)
🤖 Prompt for AI Agents
In tests/integration/defs/accuracy/test_llm_api_pytorch.py around lines 537-538,
the parameter pp_size is declared in the pytest.mark.parametrize decorator but
never used in the test body; update the test to pass
pipeline_parallel_size=pp_size into the LLM constructor (or any factory/config
used to create the model) so the test actually exercises pp_size values [2,4],
ensuring the pipeline parallel configuration is applied, or if varying pipeline
size is not intended, remove the parametrize decorator and pp_size parameter
from the test signature.
| def test_auto_dtype(self): | ||
| @pytest.mark.parametrize("pp_size", [2, 4], ids=["pp2", "pp4"]) | ||
| def test_auto_dtype(self, pp_size): | ||
| print_device_memory() |
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.
🛠️ Refactor suggestion | 🟠 Major
Clean up or make diagnostic code conditional.
Multiple print_device_memory() calls and a 60-second sleep have been added for OOM diagnostics. While understandable for debugging, this code should be:
- Removed after debugging if this is temporary investigation code
- Made conditional using an environment variable or pytest marker if needed long-term
- Documented with comments explaining why it's necessary
The 60-second sleep at line 1360 will significantly slow down test execution in CI.
💡 Example: Make diagnostic code conditional
import os
ENABLE_OOM_DIAGNOSTICS = os.getenv("TRTLLM_OOM_DIAGNOSTICS", "0") == "1"
def maybe_print_device_memory():
if ENABLE_OOM_DIAGNOSTICS:
print_device_memory()
# Then use:
maybe_print_device_memory()Or use a pytest marker:
@pytest.mark.parametrize("pp_size", [2, 4], ids=["pp2", "pp4"])
def test_auto_dtype(self, pp_size):
if os.getenv("TRTLLM_OOM_DIAGNOSTICS"):
print_device_memory()
...Also applies to: 1334-1334, 1358-1362
🤖 Prompt for AI Agents
In tests/integration/defs/accuracy/test_llm_api_pytorch.py around lines 539,
1334 and 1358-1362, the unconditional print_device_memory() calls and the
60-second sleep used for OOM diagnostics should be removed or made conditional;
update the file to either remove these debug calls if temporary, or guard them
with a clear feature flag (environment variable like TRTLLM_OOM_DIAGNOSTICS) or
a pytest marker, add a short comment explaining the purpose of the diagnostics
flag, and ensure the long sleep is only executed when the diagnostics flag is
enabled to avoid slowing CI.
| import gc | ||
| gc.collect() | ||
| torch.cuda.empty_cache() | ||
|
|
||
| print(f"\n--- nvidia-smi start to test ---") | ||
| print_device_memory() |
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.
🧩 Analysis chain
🏁 Script executed:
# First, locate and examine the file
fd "test_llm_api_pytorch.py" tests/Repository: NVIDIA/TensorRT-LLM
Length of output: 118
🏁 Script executed:
# Once found, examine the context around lines 2291-2296
head -2300 tests/integration/defs/accuracy/test_llm_api_pytorch.py | tail -40 | cat -nRepository: NVIDIA/TensorRT-LLM
Length of output: 1964
🏁 Script executed:
# Check if this file has copyright header
head -20 tests/integration/defs/accuracy/test_llm_api_pytorch.pyRepository: NVIDIA/TensorRT-LLM
Length of output: 802
🏁 Script executed:
# Search for similar GC patterns in test files
rg "gc\.collect\(\)" tests/ -A 2 -B 2Repository: NVIDIA/TensorRT-LLM
Length of output: 5108
🏁 Script executed:
# Search for torch.cuda.empty_cache patterns
rg "torch\.cuda\.empty_cache" tests/ -B 2 -A 2Repository: NVIDIA/TensorRT-LLM
Length of output: 18228
🏁 Script executed:
# Check the full test method to understand context better
sed -n '2270,2330p' tests/integration/defs/accuracy/test_llm_api_pytorch.py | cat -nRepository: NVIDIA/TensorRT-LLM
Length of output: 3094
Use a regular string instead of an f-string without placeholders.
Line 26: print(f"\n--- nvidia-smi start to test ---") should be print("\n--- nvidia-smi start to test ---") since there are no variable placeholders in the string.
The manual gc.collect() and torch.cuda.empty_cache() calls are standard practice in this codebase's multi-GPU tests to ensure clean memory state and reduce OOM errors, as documented in other similar tests (e.g., test_multimodal.py).
🧰 Tools
🪛 Ruff (0.14.10)
2295-2295: f-string without any placeholders
Remove extraneous f prefix
(F541)
🤖 Prompt for AI Agents
In tests/integration/defs/accuracy/test_llm_api_pytorch.py around lines 2291 to
2296, replace the unnecessary f-string in the print call with a regular string:
change print(f"\n--- nvidia-smi start to test ---") to print("\n--- nvidia-smi
start to test ---"); leave the surrounding gc.collect() and
torch.cuda.empty_cache() calls intact as they are intentional for multi-GPU
memory cleanup.
| import gc | ||
| gc.collect() | ||
| torch.cuda.empty_cache() | ||
|
|
||
| time.sleep(180) | ||
| print(f"\n--- nvidia-smi after testing after 180s ---") | ||
| print_device_memory() |
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.
180-second sleep will severely impact test execution time.
A 3-minute sleep after the test completes (line 2342) will significantly slow down the test suite, especially in CI environments. This appears to be diagnostic code to observe memory behavior after test completion.
Concerns:
- CI impact: 180 seconds per test iteration is prohibitively slow
- Manual GC pattern repeated: Lines 2338-2340 duplicate the pattern from lines 2291-2293, reinforcing concerns about cleanup issues
- Post-test diagnostics: Memory monitoring after test completion should happen automatically in test teardown/fixtures, not inline
Recommendations:
- Remove the sleep or make it conditional via environment variable (e.g.,
TRTLLM_OOM_DEBUG_SLEEP) - Address the root cause requiring manual GC (see previous comment)
- Consider using pytest fixtures for pre/post-test diagnostics
🧰 Tools
🪛 Ruff (0.14.10)
2343-2343: f-string without any placeholders
Remove extraneous f prefix
(F541)
🤖 Prompt for AI Agents
In tests/integration/defs/accuracy/test_llm_api_pytorch.py around lines
2338-2344, the test contains a blocking 180-second sleep and duplicated manual
GC/empty_cache diagnostic calls which will slow CI and duplicate cleanup logic;
remove the time.sleep(180) entirely or wrap it behind a debug environment
variable (e.g., TRTLLM_OOM_DEBUG_SLEEP) so it only runs when explicitly enabled,
consolidate the repeated gc.collect()/torch.cuda.empty_cache() calls into a
single teardown/fixture that handles GPU cleanup, and move the
nvidia-smi/print_device_memory diagnostics into a pytest fixture or conditional
debug block to avoid inline post-test pauses in normal runs.
| def get_device_memory_str(): | ||
| with tempfile.TemporaryDirectory() as temp_dirname: | ||
| suffix = ".exe" if is_windows() else "" | ||
| # TODO: Use NRSU because we can't assume nvidia-smi across all platforms. | ||
| cmd = " ".join([ | ||
| "nvidia-smi" + suffix, "--query-gpu=memory.total", | ||
| "nvidia-smi" + suffix, | ||
| "--query-gpu=memory.total,memory.reserved,memory.used,memory.free", | ||
| "--format=csv,noheader" | ||
| ]) | ||
| # Try to get memory from nvidia-smi first, if failed, fallback to system memory from /proc/meminfo | ||
| # This fallback is needed for systems with unified memory (e.g. DGX Spark) | ||
| output = check_output(cmd, shell=True, cwd=temp_dirname) | ||
| return output.strip() | ||
|
|
||
|
|
||
| def get_device_memory(): | ||
| "get gpu memory" | ||
| memory = 0 | ||
| # Try to get memory from nvidia-smi first, if failed, fallback to system memory from /proc/meminfo | ||
| # This fallback is needed for systems with unified memory (e.g. DGX Spark) | ||
| try: | ||
| output = get_device_memory_str() | ||
| memory_str = output.strip().split()[0] | ||
| # Check if nvidia-smi returned a valid numeric value | ||
| if "N/A" in memory_str: | ||
| raise ValueError("nvidia-smi returned invalid memory info") | ||
| memory = int(memory_str) | ||
| except (sp.CalledProcessError, ValueError, IndexError): | ||
| # Fallback to system memory from /proc/meminfo (in kB, convert to MiB) | ||
| try: | ||
| output = check_output(cmd, shell=True, cwd=temp_dirname) | ||
| memory_str = output.strip().split()[0] | ||
| # Check if nvidia-smi returned a valid numeric value | ||
| if "N/A" in memory_str: | ||
| raise ValueError("nvidia-smi returned invalid memory info") | ||
| memory = int(memory_str) | ||
| except (sp.CalledProcessError, ValueError, IndexError): | ||
| # Fallback to system memory from /proc/meminfo (in kB, convert to MiB) | ||
| try: | ||
| with open("/proc/meminfo", "r") as f: | ||
| for line in f: | ||
| if line.startswith("MemTotal:"): | ||
| memory = int( | ||
| line.split()[1]) // 1024 # Convert kB to MiB | ||
| break | ||
| except: | ||
| memory = 8192 # Default 8GB if all else fails | ||
| with open("/proc/meminfo", "r") as f: | ||
| for line in f: | ||
| if line.startswith("MemTotal:"): | ||
| memory = int( | ||
| line.split()[1]) // 1024 # Convert kB to MiB | ||
| break | ||
| except: | ||
| memory = 8192 # Default 8GB if all else fails | ||
|
|
||
| return memory | ||
|
|
||
|
|
||
| def print_device_memory(): | ||
| memory_str = get_device_memory_str() | ||
| print(f"Device Memory:\ntotal: reserved: used: free: \n{memory_str}") | ||
|
|
||
| mem_stats = torch.cuda.memory_stats() | ||
| torch_used_bytes = mem_stats["allocated_bytes.all.current"] | ||
| torch_used_bytes = mem_stats["reserved_bytes.all.current"] | ||
| print( | ||
| f"================================== torch mem stats: allocated {torch_used_bytes} reserved {torch_used_bytes}" | ||
| ) | ||
| print(f"\n--- nvidia-smi in print_device_memory ---") | ||
| sp.run(["nvidia-smi"], check=False) | ||
|
|
||
| end, total_gpu_memory = torch.cuda.mem_get_info() | ||
| total_used_bytes = total_gpu_memory - end | ||
| print( | ||
| f"================================== torch mem info: free {end}, total {total_gpu_memory}, used {total_used_bytes}" | ||
| ) |
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.
Fix print_device_memory stats and consider tightening fallbacks
The new memory helpers are useful, but there’s a small bug and a couple of robustness points:
- Bug: allocated vs reserved stats are conflated
mem_stats = torch.cuda.memory_stats()
torch_used_bytes = mem_stats["allocated_bytes.all.current"]
torch_used_bytes = mem_stats["reserved_bytes.all.current"]
print(
f"================================== torch mem stats: allocated {torch_used_bytes} reserved {torch_used_bytes}"
)- The second assignment overwrites
allocated_byteswithreserved_bytes, so both “allocated” and “reserved” print the same value.
Proposed fix
def print_device_memory():
memory_str = get_device_memory_str()
print(f"Device Memory:\ntotal: reserved: used: free: \n{memory_str}")
- mem_stats = torch.cuda.memory_stats()
- torch_used_bytes = mem_stats["allocated_bytes.all.current"]
- torch_used_bytes = mem_stats["reserved_bytes.all.current"]
- print(
- f"================================== torch mem stats: allocated {torch_used_bytes} reserved {torch_used_bytes}"
- )
+ mem_stats = torch.cuda.memory_stats()
+ allocated_bytes = mem_stats["allocated_bytes.all.current"]
+ reserved_bytes = mem_stats["reserved_bytes.all.current"]
+ print(
+ f"================================== torch mem stats: allocated {allocated_bytes} reserved {reserved_bytes}"
+ )- Optional: make
get_device_memoryfallback a bit more robust
- If
/proc/meminfois readable but doesn’t contain aMemTotal:line,memorywill remain0rather than falling back to the default 8 GiB. - You may want to set a sane minimum after the inner loop, e.g.
if not memory: memory = 8192, to avoid surprising zero values in edge environments.
- Optional: shell/call usage is acceptable but may trip linters
get_device_memory_str()andget_gpu_device_list()already invokenvidia-smiwithshell=Trueand a fixed command string. Given this is test infra with no user input in the command, the security risk is low, but static analysis will keep flagging S604/S607.
🧰 Tools
🪛 Ruff (0.14.10)
2015-2015: Function call with shell=True parameter identified, security issue
(S604)
2029-2029: Abstract raise to an inner function
(TRY301)
2029-2029: Avoid specifying long messages outside the exception class
(TRY003)
2040-2040: Do not use bare except
(E722)
2056-2056: f-string without any placeholders
Remove extraneous f prefix
(F541)
2057-2057: Starting a process with a partial executable path
(S607)
|
PR_Github #30048 [ run ] triggered by Bot. Commit: |
|
PR_Github #30048 [ run ] completed with state
|
|
/bot run --stage-list "GB200-8_GPUs-2_Nodes-PyTorch-1,GB200-4_GPUs-PyTorch-2" |
|
PR_Github #30061 [ run ] triggered by Bot. Commit: |
|
PR_Github #30061 [ run ] completed with state
|
|
/bot run --stage-list "GB200-8_GPUs-2_Nodes-PyTorch-1,GB200-4_GPUs-PyTorch-2" |
|
PR_Github #30099 [ run ] triggered by Bot. Commit: |
|
PR_Github #30099 [ run ] completed with state
|
|
/bot run --stage-list "GB200-8_GPUs-2_Nodes-PyTorch-1,GB200-4_GPUs-PyTorch-2" --disable-fail-fast |
|
PR_Github #30126 [ run ] triggered by Bot. Commit: |
|
PR_Github #30126 [ run ] completed with state
|
Signed-off-by: Hui Gao <huig@nvidia.com>
617296a to
851f657
Compare
|
/bot run --stage-list "GB200-8_GPUs-2_Nodes-PyTorch-1,GB200-4_GPUs-PyTorch-2" --disable-fail-fast |
|
PR_Github #30151 [ run ] triggered by Bot. Commit: |
|
PR_Github #30151 [ run ] completed with state
|
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.