Process handling improvements (ProcessBuilder) #48223
Replies: 5 comments 7 replies
-
The draft API may be found here: smallrye/smallrye-common#418 |
Beta Was this translation helpful? Give feedback.
-
I took a look at the proposed API based on the work I had to do creating an
arquillian appclient container launcher for the jakartaee tck. It covers
everything I would need to use this.
…On Tue, Jun 10, 2025 at 6:57 AM Clement Escoffier ***@***.***> wrote:
Awesome, looks great! Definitely something useful that would reduce the
Quarkus code base (and fix several bugs)
—
Reply to this email directly, view it on GitHub
<#48223 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACRDMQ7YJFEAEFBY5Z37ZD3CZXVXAVCNFSM6AAAAAB6SWAPT6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNBRG4YDGMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
You are hitting a lot of the same points made me go do https://github.com/jbangdev/jbang-jash (which borrows its fluent api from a now old/defunt fluentprocess api). I like your output/consuming setup - to define some explicit limits. I assume you can also make them unbounded? I'll definitely give it a go and happy to make jbang-jash use it instead (or completely replace it), as my main need for jash is the easy shell execution and piping. Is shell execution something you would be interested in enabling in smallrye-common-process - on first glance I think it would be hard to make it smooth as a layer on top but curious what you think here? |
Beta Was this translation helpful? Give feedback.
-
The next steps are as follows:
Deferred:
|
Beta Was this translation helpful? Give feedback.
-
One thing that is missing that I would like to add is asynchronous process start. The question is, which API option?
For option 1, we would need to add a dependency to Mutiny (obviously) which could become circular if we are not careful. Option 2 is obviously less powerful but maybe it's good enough. WDYT? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
On chat I mentioned looking through and auditing usages of
ProcessBuilder
andRuntime.exec(*)
after fixing a recent hang which involved subprocess launching. Long story short, these APIs are misused in various ways almost 100% of the time, some of which may cause (and probably have already caused) hard-to-diagnose hangs. It looks like we have around 80 usages just in the Quarkus codebase itself, not counting Quarkiverse extensions.I started gathering up initial requirements for a foolproof (or at least "fool-resistant") process API that we could enforce the usage of; things like this:
java
I've looked at a few process exec alternatives (including
zt-exec
) but they tend to all fall short at the "make it impossible to leak" stage. So, in typical David Lloyd fashion I started prototyping an alternative.I'm thinking of a fluent process builder API, which could be used something like this (just a few examples):
I plan to create this API, plus a few process handling utilities, in
smallrye-common
assmallrye-common-process
. If it is successful, once it is released, I would start migrating all existing usages ofProcessBuilder
andRuntime#exec
to use the new APi. I would also recommend that we then forbid usages of theProcessBuilder
andRuntime#exec
APIs as a matter of policy.Let me know if you think this is a good (or not-so-good) idea/plan, or if you have any feedback on the requirements I've listed above (particularly the blocking philosophy). In particular, please let me know if there's a requirement that you think I have missed. I did kick around the idea of fancier environment and command argument editing. But since those features are relatively tangential to the core need, I didn't pursue that immediately (but perhaps someone has some specific opinions/ideas to share).
Concurrently to the initial discussion, I'll start the work itself by pushing up a draft PR to stub out the API, to make sure it makes sense and give people a chance to complain about it before I implement it. Comments on detailed aspects of the API itself will be best directed there at that time.
Beta Was this translation helpful? Give feedback.
All reactions