[FLINK-40628][python] Avoid gateway launch during embedded TTL initialization - #29155
[FLINK-40628][python] Avoid gateway launch during embedded TTL initialization#29155bowenli86 wants to merge 2 commits into
Conversation
|
@flinkbot run azure |
1 similar comment
|
@flinkbot run azure |
There was a problem hiding this comment.
@bowenli86 Good catch! Thanks for this fix.
Do you think it makes sense to add some centralized guard (raise some meaningful error messages to tell users to use pemja.findClass if they want to call Java from Python in thread mode) for embedded workers. Users can accidentally call Py4J and potentially fall through to launch_gateway().
Besides, I saw that we have included changes of FLINK-40631 in this PR. Are there any special reasons to do so?
…lization Keep the default RocksDB cleanup duration lazy and materialize it only when requested through the public accessor. Generated-by: Codex (GPT-6)
2932b88 to
c2f2e32
Compare
Detect the native Pemja interpreter before gateway locking, connection, or launch and direct callers to pemja.findClass. Cover both gateway entry points and ordinary client behavior. Generated-by: Codex (GPT-6)
c2f2e32 to
7db42d5
Compare
|
Thanks @dianfu, agreed. I’ve added a centralized guard to both FLINK-40631 was included temporarily to unblock the unrelated I also added regression coverage for the guard and verified Java access through Pemja. The focused tests and standalone embedded runtime checks pass; fresh Azure CI is pending. |
|
@flinkbot run azure |
dianfu
left a comment
There was a problem hiding this comment.
@bowenli86 Thanks for the update. LGTM.
…lization This closes #29155. Generated-by: Codex (GPT-6)
…lization This closes #29155. Generated-by: Codex (GPT-6)
What is the purpose of the change
Fix FLINK-40628. Initializing TTL-enabled state in a Python thread-mode operator can request a Py4J gateway while constructing the default RocksDB cleanup strategy. Starting that subprocess from a multithreaded TaskManager can leave the task stuck in INITIALIZING.
Brief change log
Durationuntil the public accessor is called. The embedded converter continues to use Java's existing default; explicit durations and existing falsey-argument behavior are preserved.get_gateway()andlaunch_gateway()in embedded workers before locking, connecting, or launching a subprocess. Detect the native Pemja interpreter and direct callers topemja.findClassin the error message.Verifying this change
7db42d567feb3699f1b36201aa51cef7e926146f: compilation, Python, table, core, connectors, misc, tests, licensing, documentation, and all four E2E groups. The gateway and TTL Python suites passed; the previously failingCalcRestoreTestreported zero failures and errors (one pre-existing skip). No tests are disabled or skipped by this change.Does this pull request potentially affect one of the following parts:
Documentation
Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-6)