Repository activity
40458 results across all weeks
Registering a C thread on a terminated domain hangs
Registering a C thread with the id of a terminated domain hangs, and when a new domain reuses that slot it corrupts the slot's master lock.
KC Sivaramakrishnan (@kayceesrk)Reject extension on module-dependent functor type domain
The Ptyp_functor production parsed an ext_attributes for the module domain but used only the attribute list, silently dropping the extension part (the %ext in (module%ext M : S) -> t).
hhugoRework runtime events around opportunistic GC slices
At present, opportunistic GC slices do not emit runtime events unless the GC verbosity bit is set, because each opportunistic span may take many very small slices, and each slice may emit many events, flooding the event ring. This means that some GC work is omitted from the runtime events stream.
Nick Barnes (@NickBarnes)Round subnormal results of hexadecimal float_of_string once
Fixes #15291.
Shakhtar-SankurRuntime events late shutdown
caml_do_exit destroyed the runtime_events ring buffers before the rest of the shutdown sequence ran, so anything emitted after that point was discarded. This PR moves the teardown to the last place where it can still run, which:
Tim McGilchrist (@tmcgilchrist)Runtime_events read_poll hangs on a malformed ring
A consumer that reads an untrusted .events ring file can hang inside a single Runtime_events.read_poll call, even with a small max_events bound. The ring header is trusted: read_poll loads ring_head and ring_tail from the mapped file without checking them against the ring capacity (runtime_events_consumer.c:491-492), then loops while the position is below ri…
KC Sivaramakrishnan (@kayceesrk)Runtime_events.User.write truncates an int to 32 bits
Runtime_events.User.write on a Type.int event stores the payload with Int_val (runtime_events.c:894). The OCaml int is truncated to a C int and sign-extended into the 64-bit payload. The typed API documents no 32-bit limit.
KC Sivaramakrishnan (@kayceesrk)Runtime_events.read_poll exceeds the event limit
On OCaml 5.5.0 and trunk f0c1023333 (macOS arm64), Runtime_events.read_poll consumes more events than the supplied limit. Found with the assistance of an LLM.
KC Sivaramakrishnan (@kayceesrk)Runtime_events: use absolute paths for ring file
To support applications that use chdir
Török Edwin (@edwintorok)Scanf ignores string field width after an escape
Scanf.sscanf can read past the field width of %S after a numeric escape. Found with DeepSeek v4.1 Flash 1017. Reproduced on 5.5.0 and trunk f0c1023333, macOS arm64:
KC Sivaramakrishnan (@kayceesrk)Scanf.unescaped: handle missing escapes
The function Scanf.unescaped is supposed to implement, at runtime, the same conventions that the lexer implements at compile-time. However, currently, it did not support the full set of escapes that are supported by the lexer. This PR rectifies this:
Nicolás Ojeda Bär (@nojb)Scanf: respect field width of %S when scanning escapes
When Scanf encounters a %dS format (d is an integer, the "field with"), it reads the string with a counter for how many characters of the field width are left. It stops when the counter reaches exactly 0. Ordinary characters take the counter down by one each, but escape sequences are several characters long and reduce the counter by their whole length in one…
Nicolás Ojeda Bär (@nojb)Signal handler raise during domain exit kills the process
A signal handler that raises while a domain is joining its systhreads in caml_domain_terminate terminates the process with an uncaught exception.
KC Sivaramakrishnan (@kayceesrk)Signal handler taking a mutex deadlocks with `Event`
A signal handler that locks a user mutex m can deadlock the process silently when it runs on a thread that is inside Event.sync. No exception is raised; the program just stops making progress.
KC Sivaramakrishnan (@kayceesrk)Signal-handler release leaves a semaphore locked
If a signal handler calls Semaphore.Counting.release s while the same thread is inside Semaphore.Counting.acquire s, acquire raises Sys_error "Mutex.lock: Resource deadlock avoided" and leaves s.mut locked. Every later operation on s then blocks forever. The handler does not explicitly raise; its release raises the Sys_error.
KC Sivaramakrishnan (@kayceesrk)Soundness bug in variance composition
Whilst working on some changes to variance, an agent noticed a soundness bug in composition of variance. The difficulty comes from the interaction of bivariant parameters and invariant parameters. Soundness of GADTs requires that invariant parameters be handled with actual on the nose equality, so a bivariant parameter inside an invariant parameter needs to …
Leo White (@lpw25)Speed up pool_sweep
Speed up pool_sweep: the hot loop of major GC sweeping: Hoist loop invariants, batch stats, track the ends of free runs. Measured with #15280 on my dev box, this makes sweeping go about 20% faster.
Nick Barnes (@NickBarnes)Starting a second profile strands the first one
Gc.Memprof.start t1; Gc.Memprof.start t2; Gc.Memprof.stop stops t2. t1 samples nothing new in the domain, but it stays in the sampling state and keeps running callbacks for the blocks it already tracks, and no API can reach it. stop acts on the current profile only (memprof.c:2303-2321), and discard t1 fails because t1 was never stopped.
KC Sivaramakrishnan (@kayceesrk)Str.replace_matched reads past the end of a shorter string
Str.replace_matched builds the replacement from the match offsets of the last search without checking them against the length of the string it is given. On a string shorter than the match, the copy reads past the end of the string and the result contains whatever follows it on the heap.
KC Sivaramakrishnan (@kayceesrk)Structured diagnostics for the compiler
See also https://github.com/ocaml/RFCs/pull/45 and https://icfp24.sigplan.org/details/ocaml-2024-papers/16/Structured-diagnostics-for-the-OCaml-compiler for previous discussions .
Florian Angeletti (@Octachron)