1
---
2
name: gke-ai-troubleshooting-tpu-vbar-oom
3
description: >-
4
Diagnoses and prevents vbar_control_agent segfaults, out-of-memory (OOM) errors,
5
and TPU device initialization failures on TPU v6e nodes in GKE caused by race
6
conditions during TPU device resets or high-frequency metrics polling. Use when
7
troubleshooting vbar_control_agent crashes, memory cgroup OOMs in serial console
8
logs, tpu-device-plugin metrics checksum corruption errors, or custom TPU metrics
9
collection conflicts on GKE TPU v6e nodes. Don't use for general non-TPU container
10
OOM troubleshooting or standard GKE node lifecycle operations.
11
metadata:
12
version: "1.0.1"
13
category: CloudObservabilityAndMonitoring
14
---
15
16
# TPU Connection Failure and VBAR OOM Troubleshooting
17
18
Use this skill to systematically diagnose and prevent `vbar_control_agent`
19
segfaults and Out-Of-Memory (OOM) errors on TPU v6e nodes.
20
21
## Attribution
22
23
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
24
MUST read [Usage Attribution](references/attribution.md). For commands executed
25
directly in the terminal (never in generated scripts, Terraform, or user code),
26
prefix `gcloud` with
27
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-vbar-oom)"`
28
and append `agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-vbar-oom)` to `User-Agent` headers.
29
30
## ⚠️ Prerequisites
31
32
- Cloud Logging must be enabled for the project.
33
- Access to the project and cluster via `gcloud` or equivalent tool.
34
35
## 🔍 Diagnostic Workflow
36
37
### Step 0: Context Acquisition & Time Window Definition
38
39
Independently gather required context using available GCP/GKE tools or use the
40
provided `{variable}` placeholders:
41
42
- `{project_id}`: The GCP Project ID (e.g., `customer-ai-project-123`).
43
- `{cluster_name}`: The GKE Cluster Name (e.g., `tpu-cluster-prod`).
44
- `{node_name}`: The Node Name or Instance ID (e.g., `tpu-node-1`).
45
- `{workload_name}`: The Workload Name / JobSet Name (e.g.,
46
`my-training-job-456`).
47
- `{namespace}`: The Workload Namespace.
48
- `{issue_time}`: The timestamp of the issue (e.g., `2026-04-14T20:00:00Z`).
49
50
#### Time Handling & Execution Rules
51
52
1. **Window Calculation**: If an issue timestamp `{issue_time}` is provided,
53
calculate the query time window as `[{issue_time} - 30m]` to
54
`[{issue_time} + 30m]`.
55
- Let `{start_time}` = `{issue_time} - 30m`
56
- Let `{end_time}` = `{issue_time} + 30m`
57
2. **Informational vs. Live Execution**: If the user request is informational
58
or query-formulation (e.g. "How can I check...", "How do I determine..."),
59
or if live GCP project resources are not actively targetable, directly
60
output the calculated time window, log names, and Cloud Logging filter
61
templates without attempting live log execution commands.
62
63
### Step 1: Check for `vbar_control_agent` OOMs
64
65
Look for specific `out of memory` messages from `vbar_control_agent` in serial
66
console logs (`serialconsole.googleapis.com%2fserial_port_1_output`).
67
68
- **Tool to use**: `query_logs` (for live diagnostics)
69
- **Filter Templates**:
70
71
**Serial Console Logs (OOMs):**
72
73
```sql
74
logName="projects/{project_id}/logs/serialconsole.googleapis.com%2fserial_port_1_output"
75
AND labels."compute.googleapis.com/resource_name"="{node_name}"
76
AND SEARCH(text_payload, "Memory cgroup out of memory: Killed process .* (vbar_control_ag)")
77
AND timestamp >= "{start_time}"
78
AND timestamp <= "{end_time}"
79
```
80
81
- **Logic**: Presence of `Memory cgroup out of memory` messages related to
82
`vbar_control_agent`. Stack traces pointing to
83
`libtpu::tpunetd::VBARControlHelper::MetricsReadFromVBAR` are a strong
84
indicator.
85
- **Automation**: Proceed to next step automatically after reporting findings.
86
- **Reference**: See `references/failure_signatures.md` for example log
87
patterns.
88
89
### Step 2: Investigate `tpu-device-plugin` Metrics Fetch Failures [Low Risk]
90
91
Check if `tpu-device-plugin` is reporting metric fetch failures.
92
93
- **Tool to use**: `query_logs`
94
- **Filter Template**:
95
96
```sql
97
resource.type="k8s_container"
98
AND resource.labels.project_id="{project_id}"
99
AND resource.labels.cluster_name="{cluster_name}"
100
AND resource.labels.container_name="tpu-device-plugin"
101
AND severity=ERROR
102
AND textPayload:"metrics fetch failed for .* deviceID and .* device path with error: checksum didn't match with the metrics data. Corrupt data found"
103
AND timestamp >= "{start_time}"
104
AND timestamp <= "{end_time}"
105
```
106
107
- **Logic**: Errors indicating "metrics fetch failed" with "checksum didn't
108
match" suggest vBAR memory corruption.
109
- **Automation**: Proceed to next step automatically after reporting findings.
110
111
### Step 3: Check for Custom Metrics Collection Usage [Low Risk]
112
113
Inspect cluster configurations, workloads, or container specs to determine if
114
custom TPU metrics collection mechanisms are deployed.
115
116
- **Action**: Check if custom scripts or agents (e.g., using
117
`libtpu.sdk.tpumonitoring`) are deployed that frequently query
118
`GetHostMetrics` from `vBAR Control Agent`.
119
- **Verification Commands**:
120
121
- **Kubectl Search (Inspect workload env/specs)**:
122
123
```bash
124
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}'
125
```
126
127
- **Log Search Filter (`query_logs`)**:
128
129
```sql
130
resource.type="k8s_container"
131
AND resource.labels.project_id="{project_id}"
132
AND resource.labels.cluster_name="{cluster_name}"
133
AND textPayload:"libtpu.sdk.tpumonitoring"
134
AND timestamp >= "{start_time}"
135
AND timestamp <= "{end_time}"
136
```
137
138
- **Logic**: Confirmation of custom metrics collection helps confirm the race
139
condition hypothesis.
140
141
## 🛠️ Resolution Workflow
142
143
### Resolution 1: Temporarily Disable Custom Metrics Collection [High Risk]
144
145
If a custom metrics collection agent is identified, recommend disabling it.
146
147
- **Action**: Recommend disabling the custom metrics collector.
148
- **Justification**: Prevents reads from vBAR during device resets, stopping
149
crashes and OOMs.
150
151
### Resolution 2: Await `vbar_control_agent` Resiliency Update [Low Risk]
152
153
Advise that a permanent fix will be available in a future GKE version.
154
155
- **Action**: Recommend upgrading GKE when the fix is available.
156
- **Justification**: The updated agent will be resilient to memory corruption
157
and gracefully handle reads from unbound vBARs.
158
159
## 📋 copypaste checklist
160
161
- [ ] Acquire context and compute `[{start_time}, {end_time}]` window.
162
- [ ] Check for `vbar_control_agent` segfaults and OOMs using `query_logs`.
163
- [ ] Investigate `tpu-device-plugin` failures using `query_logs`.
164
- [ ] Inspect for custom metrics collection usage.
165
- [ ] Advise disabling custom metrics collection if applicable.
166
- [ ] Advise awaiting resiliency update.
167