apache / apache/streampark

[Bug] FlinkClient#submit fails with UnsupportedOperationException on JDK 18+ (Security Manager)

Open
#4,482 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
4.3k
Forks
1.1k
Avg merge
13h 35m
Merged PRs (30d)
2

Description

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/streampark/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues referencing `SecurityManager`, `ExitSecurityManager`, or `FlinkClient#submit`.

### Java Version

Temurin 21.0.11

### Scala Version

2.12.x

### StreamPark Version

3.0.0-SNAPSHOT (`dev` branch, commit `f89652b67`)

### Flink Version

2.2.1 (official binary distribution, standalone/remote cluster)

### Deploy mode

remote

### What happened

Starting *any* Flink application (`POST /flink/app/start`) is accepted (HTTP 200), but the application flips to `FAILED` a few seconds later with no visible error anywhere in `logs/error.*.log` or `logs/streampark.out` — the failure is only visible via `POST /flink/app/opt_log` (`t_flink_app_log`, the operation-log table), which the REST API and UI do surface, but it's easy to miss since nothing is printed to the process's own logs.

Root cause: `FlinkClient#submit()` installs a custom `ExitSecurityManager` via `System.setSecurityManager(...)` before invoking the Flink CLI in-process, purely to intercept `System.exit()` calls the CLI makes on completion (turning them into a catchable `SecurityException` instead of killing the whole console JVM).

[JEP 411](https://openjdk.org/jeps/411) deprecated the Security Manager in Java 17, and starting Java 18, `System.setSecurityManager()` throws `UnsupportedOperationException` unless the `java.security.manager` system property is explicitly set to `allow` (or a manager class name) at JVM startup — it can no longer be enabled dynamically without that flag. The console's own startup scripts don't set this flag, so on any JDK 18+ (this environment: JDK 21) every start attempt fails immediately.

### Error Exception

```
java.util.concurrent.CompletionException: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
at java.base/java.lang.System.setSecurityManager(System.java:431)
at org.apache.streampark.flink.client.FlinkClient.submit(FlinkClient.java:63)
at org.apache.streampark.console.core.service.application.impl.FlinkApplicationActionServiceImpl.lambda$start$2(FlinkApplicationActionServiceImpl.java:486)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
... 3 more
```

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in FlinkClient.submit(), at the System.setSecurityManager call identified in the stack trace, and trace how the Flink CLI completion and System.exit handling are used. Check the console startup scripts and relevant tests for JDK compatibility. Done means remote Flink application submission succeeds on JDK 18+ without the reported UnsupportedOperationException and the failure remains observable when submission genuinely fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, stream-processing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.