You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a6766c0
Browse filesBrowse the repository at this point in the historyBrowse files
Process launch on POSIX systems created its four pipes with pipe and
set FD_CLOEXEC on them afterwards. A process another thread forked in
between kept the unflagged descriptors across exec, so for example a
first child's stdout write end could stay open in an unrelated child,
and the first child's stdout gave no EOF until that child exited.
The pipes are now created with pipe2(O_CLOEXEC) on Linux and the BSDs.
Where pipe2 is missing (macOS) or the kernel lacks it, a pipe is
created and flagged under a lock held shared, and the runtime forks
under it held exclusively, so no process the runtime starts lands in
that window. Cleanup after a failed pipe, the move of the child's
streams above descriptor 2 and the exec status pipe are unchanged.
Tests: ProcessConcurrentPipeInheritance, on Linux, replaces pipe and
pipe2 to pause one launch on a thread right after its stdout pipe
exists, starts a second process meanwhile, and has that child look
for the first launch's pipe among its descriptors, with a pipe2
O_CLOEXEC pipe as the control. Other systems print the expected
result. It has not been run on Linux or macOS yet; CI runs it.
Fixes#340
Copy file name to clipboardExpand all lines: Changes.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ libhxcpp 6.0.0 (unreleased)
9
9
* Sped up Std.string on deeply nested enums, which copied each parameter's text into its parent's, quadratic in the depth, and recursed once per level, so a chain a million deep overflowed the native stack. Enums are now formatted in one pass: a 2,048-deep enum formats 33x faster (libhxcpp #328)
10
10
* Fixed formatting a map that holds itself, directly or through other maps, ending the program with a stack overflow. Past 5 nested maps a map now formats as "...", as arrays and anonymous objects already did (libhxcpp #343)
11
11
* Map entries with Int values in StringMap, ObjectMap and Int64 maps take 8 bytes less on 64-bit: the hash sat after the key, leaving padding beside the value. A 200,000-entry StringMap<Int> holds 9.6 MB instead of 11.2 MB (libhxcpp #370)
12
+
* Fixed process pipes reaching an unrelated child on Linux, macOS and other POSIX systems: they were created with pipe and marked close-on-exec afterwards, so a process another thread started in between kept them, and the first child's output could stay open until that process exited. They are now created close-on-exec with pipe2 where the system has it, and elsewhere no process the runtime starts can fork in between (libhxcpp #340)
12
13
* Fixed a copy of an hx::Ref not keeping its object alive: copying one of the same type shared the original's GC root, so once the original went the collector could free the object the copy still held (libhxcpp #355)
13
14
* Fixed hx::Ref::setPtr leaving its GC root at the old offset when it moved to another interface of the same object, so the collector could free the object while the reference still held it (libhxcpp #361)
14
15
* Fixed an exception thrown by a finalizer leaving the collector paused: it unwound out of the collection with every other thread still stopped. The collection now finishes, running the other finalizers, and the first exception is thrown to the code that started it (libhxcpp #358)
0 commit comments