Logging, runtime tracing, and the obs performance profiler for OCaml
0

Configure Feed

Select the types of activity you want to include in your feed.

obs: unhang the producer test suite

Forwarder's stop joins the session domain, so it blocks. test_server_end_to_end called it from inside Eio_main.run, parking that scheduler: the collector's handler fiber could then never drain the socket the session domain was blocked writing to, and neither side ever observed the stop flag. dune test hung there indefinitely -- the suite was killed, never passed.

The tests stop through Eio_unix.run_in_systhread instead, and the blocking contract is stated on the stop type. Observe.setup is unaffected: it defers stop to at_exit, which runs after Eio_main.run has returned.

+13 -3
+7 -1
lib/producer/forwarder.mli
··· 12 12 type stop = unit -> unit 13 13 (** Stops forwarding: pauses the ring, flushes the backlog, streams the memtrace 14 14 CTF if one was captured, sends {!Observe_protocol.Frame.Bye}, and closes the 15 - connection. *) 15 + connection. 16 + 17 + This blocks until the background domain has joined. An Eio program must 18 + therefore not call it from a fiber, or it stalls that domain's scheduler 19 + while the session domain may still be waiting to write; run it with 20 + [Eio_unix.run_in_systhread] instead. {!Observe.setup} defers it to 21 + [at_exit], which runs after [Eio_main.run] has returned. *) 16 22 17 23 (** Where to reach the collector, named by [OBS_COLLECTOR]. The first three are 18 24 dialled; the [*-listen] forms make the producer the passive side -- it binds
+6 -2
test/producer/test_forwarder.ml
··· 269 269 Gc.full_major () 270 270 done; 271 271 Eio.Time.sleep clock 0.05; 272 - stop (); 272 + (* [stop] joins the session domain. Calling it from a fiber would block 273 + this scheduler, so the handler fiber could never drain the socket that 274 + the session domain is blocked writing to, and neither side would ever 275 + observe the stop flag. *) 276 + Eio_unix.run_in_systhread stop; 273 277 (* Let the handler fiber drain the Bye and see EOF before the switch ends. *) 274 278 Eio.Time.sleep clock 0.05); 275 279 Alcotest.(check int) ··· 300 304 Gc.full_major () 301 305 done; 302 306 Eio.Time.sleep clock 0.05; 303 - stop (); 307 + Eio_unix.run_in_systhread stop; 304 308 Eio.Time.sleep clock 0.05); 305 309 Alcotest.(check int) 306 310 "one producer registered over tcp" 1