924060929 opened a new pull request, #65933:
URL: https://github.com/apache/doris/pull/65933
### What problem does this PR solve?
Problem Summary:
`FlightRecordAction` attaches the java flight recorder to the frontend by
running `jps` and
`jcmd` **on the machine that executes the regression suite**, so it only
works when the frontend
and the regression runner are deployed together.
`demo_p0/test_flight_record` inherits that
precondition, but never checks it.
When the suite runs on a runner that has no local frontend, `getFePid()`
threw
```
java.lang.IllegalStateException: Can not found process: DorisFE
at .../demo_p0/test_flight_record.groovy:30
```
and the case was reported as a product failure, although nothing was wrong
with the product.
This PR turns the unsatisfied precondition into a skip:
- `getFePid()` returns an empty optional instead of throwing when `jps`
reports no such process,
and `run()` logs why the action is skipped.
- launching `jps` itself is guarded too, so a runner with only a jre
installed skips as well.
- `stdout` is trimmed before the empty check, so a pid line with a trailing
newline is handled.
- real errors after the recorder is attached (`JFR.start` / `JFR.stop` /
parsing the `.jfr`) still
go through `callbackError` and keep failing the suite.
The demo suite itself is kept as is, it still demonstrates the
`flightRecord` api; only a comment
about the co-location precondition is added.
### Release note
None
### Check List (For Author)
- Test
- [x] Manual test (add detailed scripts or steps below)
Drove `FlightRecordAction` directly against a local jdk17, both before
and after the change.
1. Process not found (the reported scenario), `processName` set to a
name that does not exist:
| | result |
|---|---|
| before | `run() threw java.lang.IllegalStateException: Can not found
process: NoSuchDorisProcess_ZZZ` |
| after | `run() returned normally (skipped)`, `record`/`callback` not
invoked, log: `Skip flight record: can not find the local process ...` |
2. Process found, to confirm the recording path is untouched: pointed
the action at a local
long running java process that keeps allocating. `JFR.start` / record
closure / `JFR.stop` /
`JfrLoaderToolkit.loadEvents` all succeeded, the callback received the
parsed collection with
`ObjectAllocationSample` events, and the `.jfr` file was cleaned up.
- Behavior changed:
- [x] Yes. `flightRecord` now skips silently when no local frontend
process is found, instead of
failing the suite. Regression-test framework only, no product behavior
change.
- Does this need documentation?
- [x] No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]