| Summary: | REGRESSION(254232@main): Causes process launching to use fork + exec instead of posix_spawn | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
| Component: | WebKitGTK | Assignee: | Michael Catanzaro <mcatanzaro> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | bugs-noreply, mcatanzaro, webkit-bug-importer |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| See Also: |
https://bugzilla.redhat.com/show_bug.cgi?id=2130294 https://bugs.webkit.org/show_bug.cgi?id=221489 https://bugzilla.redhat.com/show_bug.cgi?id=2132776 |
||
|
Description
Michael Catanzaro
2022-09-28 08:19:57 PDT
So I've been thinking about this... it really needs to be more robust, less fragile. We could add a new flag in both GSpawnFlags and GSubprocessFlags to cause process launching to fail if fork()/exec() is required. The flags would do nothing on Windows. That way, we can't mess up anymore. Sadly I can't think of any way to keep the nice behavior of closing all leaked file descriptors. Carlos, are you OK with reverting this commit and allowing leaked descriptors to actually leak again? It is unfortunate, but seems we have to choose between this or posix_spawn(), because there is no race-free way to close descriptors with posix_spawn() except to ensure they all have CLOEXEC flags set. It's possible to do with fork() only because no secondary threads exist after fork() is called. Anyway, I think this is OK because CLOEXEC is really the proper solution to fd leaks anyway: it's nice that gspawn can close anything we miss, but not mandatory IMO. Do you agree? Oh, and I think we can avoid reintroducing bug #221489 by just always setting CLOEXEC on the socket and relying on g_subprocess_launcher_take_fd() to unset it. (Except if the new WPE process launching API is used, in which case we can either not set CLOEXEC, or else change the API to deal with it.) Pull request: https://github.com/WebKit/WebKit/pull/4868 Committed 255325@main (9d195cb5d885): <https://commits.webkit.org/255325@main> Reviewed commits have been landed. Closing PR #4868 and removing active labels. |