Commit 1168c35
log-injection: capture thread dump of forked process on smoketest timeout (#11400)
log-injection: capture thread dump of forked process on timeout
When `waitForTraceCountAlive` times out, the existing diagnostic dumps
the tail of the forked process's captured stdout. In all 49 observed
`traceCount=0` failures since #11075, that dump has come back empty —
the JVM is alive (RC polls=130+) but the output-capture thread appears
starved, so we can't see what the agent is doing.
Capture a thread dump via `jstack` instead. Its output is read by the
smoketest JVM directly, bypassing the tested-process capture thread.
No raw `kill -3` fallback — PID reuse on shared CI hosts could cause
us to signal an unrelated process if the child has exited since the
surrounding liveness check.
Diagnostic-only, fires only on the timeout failure path.
log-injection: harden dumpThreadStacks against masking errors
Two issues in the previous commit's diagnostic path:
1. The body of dumpThreadStacks had no top-level try/catch — an
unexpected throw (reflection error, NPE, etc.) would propagate out
and replace the original AssertionError with a less useful one.
Wrap the whole body and return a "(thread dump failed: ...)" string
instead.
2. PID-reuse race: between the alive check at the call site and the
jstack invocation, the child can exit and be reaped; if the OS
reuses the PID we'd jstack an unrelated process and attach
misleading diagnostics to the failure. Re-check isAlive()
immediately before invoking jstack to narrow the race window.
log-injection: spotless formatting
log-injection: spotless fix for return-closure single-line
Revert spotless single-line closure change
The single-line closure format CI flagged earlier was a transient CI
runner state (likely stale Groovy-Eclipse formatter cache); subsequent
runs flagged the opposite direction. Reverting to the master format,
which matches what the current CI runners accept.
log-injection: print full thread dump to stdout, filter inline message
CI Visibility caps error.message at ~5000 chars, which truncates the
full jstack output mid-thread. Two changes to make sure no dump info
is ever lost:
1. Print the full thread dump to stdout via println(). Gradle's test
reporter captures stdout per-test, surfacing it in both the build
log (visible in GitLab CI) and the test report XML. This becomes
the source of truth when the inline dump is incomplete.
2. Filter the inline dump (in error.message) to prioritize the threads
that explain a hang: main, dd-*/datadog-* agent threads, OkHttp
threads, and anything BLOCKED. Known JVM boilerplate (Reference
Handler, Finalizer, compiler threads, GC, etc.) is dropped. The
result is capped at 4200 chars with an elision marker noting where
to find the full dump.
log-injection: drop misleading stdout-dump path
The earlier println-the-full-dump-to-stdout idea was supposed to give
us a fallback when CI Visibility truncates error.message at ~5000 chars.
Verified in CI: that println goes to Gradle's per-test stdout capture,
which lands in the test report XML — but the XML is not uploaded as a
GitLab artifact, and CI Visibility doesn't capture test stdout either.
So the "full dump" claim was misleading.
Drop the println and the "(full dump on stdout)" marker. Bump the
inline filter cap from 4200 to 4700 to use the full error.message
budget. The filtered dump retains main + all dd-* agent threads + any
BLOCKED thread — exactly what's needed to diagnose a wedged tracer
under traceCount=0.
Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>1 parent 774302e commit 1168c35
1 file changed
Lines changed: 200 additions & 1 deletion
Lines changed: 200 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
| 382 | + | |
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
384 | 386 | | |
385 | | - | |
| 387 | + | |
| 388 | + | |
386 | 389 | | |
387 | 390 | | |
388 | 391 | | |
389 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
390 | 589 | | |
391 | 590 | | |
392 | 591 | | |
| |||
0 commit comments