RFR: 8352533: Report useful IOExceptions when jspawnhelper fails [v4]

Thomas Stuefe stuefe at openjdk.org
Thu May 15 16:40:57 UTC 2025


On Wed, 14 May 2025 00:32:08 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Hmm, glibc keeps it very vague in the vfork() manpage, stating that "On some implementations, vfork() is equivalent to fork()." AIX manpage says just "The vfork subroutine is supported as a compatibility interface for older Berkeley Software Distribution (BSD) system programs" which sounds to me its just an alias for fork(). MacOS has no vfork anymore.
>> 
>> So maybe Solaris was the last platform with a true vfork.
>
> @tstuefe the helper was needed in part to enable a chdir between fork and exec - see this comment: https://bugs.openjdk.org/browse/JDK-5049299?focusedId=12148272&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12148272

@dholmes-ora My memory was failing me again. Looks like I had found all of this out already, and tested real scenarios where the child process after vfork accidentally damages the parent process: https://mail.openjdk.org/pipermail/core-libs-dev/2018-September/055333.html . 

Back then I also proposed to use the jspawnhelper to isolate this problem, but we went with David Loyd's proposal of adding posix_spawn, and later we switched over to posix_spawn by default. The only remaining question is what to do with the still unsafe vfork mode. I will send a mail to core-libs and feel out the room.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24149#discussion_r2091589002


More information about the core-libs-dev mailing list