D3D12-GPU-SHOWN-SAVER-EVENT-DROP: close shown saver event handle on drop #3003

Open
bobcatchris wants to merge 1 commit from upstream-pr/3003 into main
bobcatchris commented 2026-12-01 23:07:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T23:07:24Z.


Addresses claim in https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7328746664.

Cause

shown::saver (d3d12/crates/leonida-gpu/src/shown.rs) creates an unnamed auto-reset event via CreateEventW(None, false, false, None) and returns on channel close or HOOK.get() None (which occurs in production if two install calls race on the OnceLock) without closing the HANDLE.

Fix

  • Wrap the event HANDLE in EventHandle, closing it via CloseHandle and clearing self.0 on Drop.
  • Add shown::tests::event_handle_drop_closes_event_handle verifying in an isolated --exact subprocess (GetHandleInformation) that dropping EventHandle closes the OS handle.

Verification

  • Red -> Green: With CloseHandle stubbed in EventHandle::drop, shown::tests::event_handle_drop_closes_event_handle fails (RED_SHOWN_EXIT=101); with Drop active, shown::tests passes (1 passed, 0 failed).
  • Default feature build (cargo test --locked -p leonida-gpu --lib -- shown::tests) compiles cleanly.
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: exit 0.
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/shown.rs: exit 0.
  • Independent read-only code review: approved.

AI-assisted: Gemini 4 Neon (including an independent read-only review pass, APPROVE).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5596297938 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-01T23:07:24Z. --- Addresses claim in https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7328746664. ### Cause `shown::saver` (`d3d12/crates/leonida-gpu/src/shown.rs`) creates an unnamed auto-reset event via `CreateEventW(None, false, false, None)` and returns on channel close or `HOOK.get()` `None` (which occurs in production if two `install` calls race on the `OnceLock`) without closing the `HANDLE`. ### Fix - Wrap the event `HANDLE` in `EventHandle`, closing it via `CloseHandle` and clearing `self.0` on `Drop`. - Add `shown::tests::event_handle_drop_closes_event_handle` verifying in an isolated `--exact` subprocess (`GetHandleInformation`) that dropping `EventHandle` closes the OS handle. ### Verification - **Red -> Green**: With `CloseHandle` stubbed in `EventHandle::drop`, `shown::tests::event_handle_drop_closes_event_handle` fails (`RED_SHOWN_EXIT=101`); with `Drop` active, `shown::tests` passes (`1 passed, 0 failed`). - Default feature build (`cargo test --locked -p leonida-gpu --lib -- shown::tests`) compiles cleanly. - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md`: exit 0. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/shown.rs`: exit 0. - Independent read-only code review: approved. AI-assisted: Gemini 4 Neon (including an independent read-only review pass, APPROVE).
andrew-ai commented 2026-12-01 23:14:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T23:14:12Z.


Verified both exits through saver() at 679938d24 on native Windows. A temporary crate test used a real D3D12 device, warmed each path once, then measured the process handle count with GetProcessHandleCount across 64 calls. The parent saver function and the PR saver ran in the same isolated test process.

Saver exit Parent handle delta PR handle delta
Queue closed without a job +64 0
One queued job, capture hook absent +64 0

This reproduces one leaked handle per invocation on the parent and verifies both cleanup paths on the PR. No frame capture or fence completion was exercised. Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329067836 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7329067836). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T23:14:12Z. --- Verified both exits through saver() at 679938d24 on native Windows. A temporary crate test used a real D3D12 device, warmed each path once, then measured the process handle count with GetProcessHandleCount across 64 calls. The parent saver function and the PR saver ran in the same isolated test process. | Saver exit | Parent handle delta | PR handle delta | | --- | ---: | ---: | | Queue closed without a job | +64 | 0 | | One queued job, capture hook absent | +64 | 0 | This reproduces one leaked handle per invocation on the parent and verifies both cleanup paths on the PR. No frame capture or fence completion was exercised. Codex-assisted.
merzleckeier commented 2026-12-01 23:17:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T23:17:27Z.


Both actual saver exits release the event under Wine, including with the replay handle fix applied.

I cross-built Win64 with --features diagnostics on 913b88b90. The control had #2994 alone. The candidate added 679938d2. The candidate shown.rs matches the isolated #3003 integration. I added the same test-only probe to observe the handle the real saver() creates. It confirms the handle is valid immediately after CreateEventW and queries that same handle right after saver() returns.

On both RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1), I ran eight calls per GPU per exit path. For a closed queue and for a queued synthetic job with the sender still open and HOOK absent, all 32 control calls left the event live. All 32 candidate calls returned ERROR_INVALID_HANDLE for the event after return. The stock shown EventHandle and #2994 replay Worker controls also both passed on each GPU. This checks saver teardown and the combination under Wine 11.22 / VKD3D-Proton 3.1.0. No swapchain capture or fence completion was exercised. AI-assisted with OpenAI Codex and independent raw-result verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329162961 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7329162961). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T23:17:27Z. --- Both actual saver exits release the event under Wine, including with the replay handle fix applied. I cross-built Win64 with `--features diagnostics` on `913b88b90`. The control had #2994 alone. The candidate added `679938d2`. The candidate `shown.rs` matches the isolated #3003 integration. I added the same test-only probe to observe the handle the real `saver()` creates. It confirms the handle is valid immediately after `CreateEventW` and queries that same handle right after `saver()` returns. On both RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1), I ran eight calls per GPU per exit path. For a closed queue and for a queued synthetic job with the sender still open and `HOOK` absent, all 32 control calls left the event live. All 32 candidate calls returned `ERROR_INVALID_HANDLE` for the event after return. The stock shown EventHandle and #2994 replay Worker controls also both passed on each GPU. This checks saver teardown and the combination under Wine 11.22 / VKD3D-Proton 3.1.0. No swapchain capture or fence completion was exercised. AI-assisted with OpenAI Codex and independent raw-result verification.
MoonEyes commented 2026-12-02 12:35:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:35:30Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345568544 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7345568544). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:35:30Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
Kal0s-design commented 2026-12-02 14:43:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T14:43:06Z.


Ran natively on Windows 11, head 679938d24 merged into current main (2fc7383b9, clean merge). This covers the fence-wait path that the two earlier reports did not exercise.

Standard checks on the merge

Check Result
cargo test --locked -p leonida-gpu --lib --features diagnostics 778 passed, 0 failed, 59 ignored
shown::tests::event_handle_drop_closes_event_handle passes
cargo clippy -p leonida-gpu --all-targets --features diagnostics -- -D warnings no finding on a line this PR adds (the shown.rs redundant-closure finding is the existing take_bytes line, also on main)

Saver through a real fence wait (throwaway test, not committed)

The test built a real hook with make_hook on a host device and set HOOK. It then ran saver() 32 times per row on a fresh channel. Each run sent a Job whose fence value was not yet reached. After 20 ms it checked that the saver thread was still blocked in WaitForSingleObject on the event, then signalled the fence from the queue and joined the thread. Handle counts come from GetProcessHandleCount after two warm-up runs.

Sender dropped Device Runs that blocked on the event main delta PR delta
after the fence signal hardware 32/32 +32 0
during the wait, before the signal hardware 32/32 +32 0
after the fence signal WARP 32/32 +32 0
during the wait, before the signal WARP 32/32 +32 0

So the event is also released after a real SetEventOnCompletion and wait, not only on the two early exits. Closing the sender while the saver is blocked lets the wait finish and then exits cleanly. The handle is used and closed on the same thread, so Drop cannot run while a wait is still pending.

Where the leak can occur in a real run

The only Sender<Job> lives in Hook::jobs, and that hook is kept in the HOOK static, which is never dropped. With the hook in place, jobs.recv() never returns Err and HOOK.get() is never None for a received job. In a running process, saver() returns only when two install calls race and HOOK.set fails for one of them. That drops the losing hook and its sender. So the leak this fixes is at most one event handle per process in practice. The change is still correct and costs nothing.

CI coverage

shown is compiled only with diagnostics. The CI test step runs cargo test --workspace without that feature, and its only diagnostics step is --test replay. A default-feature cargo test -p leonida-gpu --lib -- shown:: runs 0 tests, so the new unit test does not run in CI. This is the same for the other diagnostics-only unit tests.

Not checked: an in-game run (the gate MoonEyes asked for), an actual swapchain present and capture through copy_shown, and the debug layer.

GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7349019920 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7349019920). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T14:43:06Z. --- Ran natively on Windows 11, head `679938d24` merged into current `main` (`2fc7383b9`, clean merge). This covers the fence-wait path that the two earlier reports did not exercise. **Standard checks on the merge** | Check | Result | |---|---| | `cargo test --locked -p leonida-gpu --lib --features diagnostics` | 778 passed, 0 failed, 59 ignored | | `shown::tests::event_handle_drop_closes_event_handle` | passes | | `cargo clippy -p leonida-gpu --all-targets --features diagnostics -- -D warnings` | no finding on a line this PR adds (the `shown.rs` redundant-closure finding is the existing `take_bytes` line, also on `main`) | **Saver through a real fence wait (throwaway test, not committed)** The test built a real hook with `make_hook` on a host device and set `HOOK`. It then ran `saver()` 32 times per row on a fresh channel. Each run sent a `Job` whose fence value was not yet reached. After 20 ms it checked that the saver thread was still blocked in `WaitForSingleObject` on the event, then signalled the fence from the queue and joined the thread. Handle counts come from `GetProcessHandleCount` after two warm-up runs. | Sender dropped | Device | Runs that blocked on the event | `main` delta | PR delta | |---|---|---:|---:|---:| | after the fence signal | hardware | 32/32 | +32 | 0 | | during the wait, before the signal | hardware | 32/32 | +32 | 0 | | after the fence signal | WARP | 32/32 | +32 | 0 | | during the wait, before the signal | WARP | 32/32 | +32 | 0 | So the event is also released after a real `SetEventOnCompletion` and wait, not only on the two early exits. Closing the sender while the saver is blocked lets the wait finish and then exits cleanly. The handle is used and closed on the same thread, so `Drop` cannot run while a wait is still pending. **Where the leak can occur in a real run** The only `Sender<Job>` lives in `Hook::jobs`, and that hook is kept in the `HOOK` static, which is never dropped. With the hook in place, `jobs.recv()` never returns `Err` and `HOOK.get()` is never `None` for a received job. In a running process, `saver()` returns only when two `install` calls race and `HOOK.set` fails for one of them. That drops the losing hook and its sender. So the leak this fixes is at most one event handle per process in practice. The change is still correct and costs nothing. **CI coverage** `shown` is compiled only with `diagnostics`. The CI test step runs `cargo test --workspace` without that feature, and its only diagnostics step is `--test replay`. A default-feature `cargo test -p leonida-gpu --lib -- shown::` runs 0 tests, so the new unit test does not run in CI. This is the same for the other diagnostics-only unit tests. Not checked: an in-game run (the gate MoonEyes asked for), an actual swapchain present and capture through `copy_shown`, and the debug layer. GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
MoonEyes commented 2026-12-02 18:18:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:18:47Z.


Verification of #3003 (third party, code review on Linux; not built: Windows-only leonida-gpu)

  • Head verified: 679938d2411239fb3efaa358aac59e3f35b3a896 (1 file, d3d12/crates/leonida-gpu/src/shown.rs, +56/-2).
  • Merge base 1abef08d0. git merge-tree --write-tree origin/main pr/3003 against main 45dc41f95 is clean
    (326 commits behind). CI on the head: 6/6 success.
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/shown.rs: exit 0.

Review

  • Root cause: saver (shown.rs:409-411) made an event with CreateEventW and returned on channel close or
    HOOK.get() == None without closing it. The RAII EventHandle (shown.rs:397-407) closes it on every exit path.
    This is the right fix, not a special case.
  • No pending wait at drop: the event is only used for SetEventOnCompletion followed by
    WaitForSingleObject(.., INFINITE) on the same thread. No registration is outstanding when Drop runs, so the
    fence cannot signal a recycled handle. Kal0s-design's handle counts through a real fence wait match this.
  • Test (shown.rs:483-520): the subprocess and GetHandleInformation pattern is sound, and it fails if Drop
    stops closing. It exercises EventHandle alone, not saver, so it would still pass if saver stopped using
    the wrapper. On main it does not build (EventHandle is missing), which is not a red. The real-fence
    evidence comes from the reviewers' throwaway tests. Acceptable for a handle leak.
  • Style nit: #2994 adds the same "close the event on drop" code to replay::gpu::Worker. A shared OwnedEvent
    helper in the crate would avoid a third copy. Not blocking.

Process

  • The body says "AI-assisted" without naming the models or the reviewer agent (CONTRIBUTING.md).
  • MoonEyes's render-path gate asks for an in-game run on the current head. None was posted for 679938d24 (the
    batch runs so far cover #2994, not this one).

Verdict: ready on review (not built here). It still needs the in-game gate run and the model names in the body.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354348117 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7354348117). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:18:47Z. --- **Verification of #3003 (third party, code review on Linux; not built: Windows-only `leonida-gpu`)** - Head verified: `679938d2411239fb3efaa358aac59e3f35b3a896` (1 file, `d3d12/crates/leonida-gpu/src/shown.rs`, +56/-2). - Merge base `1abef08d0`. `git merge-tree --write-tree origin/main pr/3003` against `main` `45dc41f95` is clean (326 commits behind). CI on the head: 6/6 success. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/shown.rs`: exit 0. **Review** - Root cause: `saver` (`shown.rs:409-411`) made an event with `CreateEventW` and returned on channel close or `HOOK.get() == None` without closing it. The RAII `EventHandle` (`shown.rs:397-407`) closes it on every exit path. This is the right fix, not a special case. - No pending wait at drop: the event is only used for `SetEventOnCompletion` followed by `WaitForSingleObject(.., INFINITE)` on the same thread. No registration is outstanding when `Drop` runs, so the fence cannot signal a recycled handle. Kal0s-design's handle counts through a real fence wait match this. - Test (`shown.rs:483-520`): the subprocess and `GetHandleInformation` pattern is sound, and it fails if `Drop` stops closing. It exercises `EventHandle` alone, not `saver`, so it would still pass if `saver` stopped using the wrapper. On `main` it does not build (`EventHandle` is missing), which is not a red. The real-fence evidence comes from the reviewers' throwaway tests. Acceptable for a handle leak. - Style nit: #2994 adds the same "close the event on drop" code to `replay::gpu::Worker`. A shared `OwnedEvent` helper in the crate would avoid a third copy. Not blocking. **Process** - The body says "AI-assisted" without naming the models or the reviewer agent (CONTRIBUTING.md). - MoonEyes's render-path gate asks for an in-game run on the current head. None was posted for `679938d24` (the batch runs so far cover #2994, not this one). **Verdict: ready on review** (not built here). It still needs the in-game gate run and the model names in the body. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
bobcatchris commented 2026-12-02 21:02:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-02T21:02:35Z.


@MoonEyes Thank you for the review, and thank you @Kal0s-design, @andrew-ai, and @merzleckeier for testing both early exits and real fence-wait teardown across native Windows and Wine!

  • Updated the PR description with explicit Gemini 4 Neon AI disclosure and HOOK install-race reachability context.
  • Leaving head 679938d24 untouched so all existing native/Wine verifications stay valid; could 679938d24 please be included in the next in-game gate batch?

AI-assisted: Gemini 4 Neon

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7358704857 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7358704857). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-02T21:02:35Z. --- @MoonEyes Thank you for the review, and thank you `@Kal0s-design`, `@andrew-ai`, and `@merzleckeier` for testing both early exits and real fence-wait teardown across native Windows and Wine! - Updated the PR description with explicit `Gemini 4 Neon` AI disclosure and `HOOK` `install`-race reachability context. - Leaving head `679938d24` untouched so all existing native/Wine verifications stay valid; could `679938d24` please be included in the next in-game gate batch? AI-assisted: Gemini 4 Neon
fiestorra commented 2026-12-03 03:33:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:33:45Z.


VERIFY-3003 — la suite pasa, y mi control no la hace fallar: el test lanza un subproceso y el subproceso es el que afirma

Un fichero, shown.rs +56, dos días abierto:

cargo test -p leonida-gpu --lib shown     2 passed
  event_handle_drop_closes_event_handle

Control (sintético): quité la línea let _ = unsafe { CloseHandle(self.0) }; del Drop — el arreglo entero de la PR — y los 2 tests siguen pasando.

Y por qué, que es lo que este comentario tiene de útil: el test es de los que se relanzan a sí mismos. Mira su cuerpo:

const CHILD_ENV: &str = "SHOWN_EVENT_DROP_CHILD";
if std::env::var_os(CHILD_ENV).is_some() {
    let raw = unsafe { CreateEventW(None, false, false, None) }.unwrap();
    let guard = EventHandle(raw);
    let open_before = unsafe { GetHandleInformation(raw as _, &mut flags) };
    assert_ne!(open_before, 0, "event handle should be open before drop");
    drop(guard);
    let open_after = unsafe { GetHandleInformation(raw as _, &mut flags) };
    assert_eq!(open_after, 0, "EventHandle::drop should close the event handle");
    return;
}

Todo lo que importa está dentro de un if que depende de una variable de entorno, y el resto del test —el padre— es el que tiene que lanzar el hijo con esa variable puesta. Si el hijo no arranca (o arranca sin la variable), el padre pasa sin comprobar nada.

Y es lo que mis dos corridas sugieren: con CloseHandle y sin él, el resultado es idéntico. Una prueba que no distingue es una prueba que no corrió, y aquí la que no corrió es la del hijo.

Lo que no sé y digo que no sé: si el hijo arranca en la máquina del autor y no en la mía (por cargo en el PATH del test, o por el aislamiento del proceso). Lo que sí sé: en esta, quitar el arreglo no cambia el verde, así que aquí no está probado.

Y la forma es la correcta, que conviene decirlo: un test de fugas de handle necesita un proceso — el contador de handles del proceso de test está contaminado por todo lo demás, y GetHandleInformation sobre un handle ya cerrado no distingue "cerrado" de "reutilizado". Aislarlo en un hijo es la manera; lo que falta es que el hijo corra.

Si el autor me dice cómo lanza el hijo, lo miro — y si no lo lanza, ahí está el fallo del test, no del arreglo.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366697883 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7366697883). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:33:45Z. --- ## VERIFY-3003 — la suite pasa, y **mi control no la hace fallar**: el test lanza un subproceso y el subproceso es el que afirma **Un fichero, `shown.rs` +56, dos días abierto**: ``` cargo test -p leonida-gpu --lib shown 2 passed event_handle_drop_closes_event_handle ``` **Control (sintético)**: **quité la línea `let _ = unsafe { CloseHandle(self.0) };` del `Drop`** — **el arreglo entero de la PR** — **y los 2 tests siguen pasando.** **Y por qué, que es lo que este comentario tiene de útil**: **el test es de los que se relanzan a sí mismos**. **Mira su cuerpo**: ```rust const CHILD_ENV: &str = "SHOWN_EVENT_DROP_CHILD"; if std::env::var_os(CHILD_ENV).is_some() { let raw = unsafe { CreateEventW(None, false, false, None) }.unwrap(); let guard = EventHandle(raw); let open_before = unsafe { GetHandleInformation(raw as _, &mut flags) }; assert_ne!(open_before, 0, "event handle should be open before drop"); drop(guard); let open_after = unsafe { GetHandleInformation(raw as _, &mut flags) }; assert_eq!(open_after, 0, "EventHandle::drop should close the event handle"); return; } ``` **Todo lo que importa está dentro de un `if` que depende de una variable de entorno**, **y el resto del test —el padre— es el que tiene que lanzar el hijo con esa variable puesta.** **Si el hijo no arranca (o arranca sin la variable), el padre pasa sin comprobar nada.** **Y es lo que mis dos corridas sugieren**: **con `CloseHandle` y sin él, el resultado es idéntico.** **Una prueba que no distingue es una prueba que no corrió**, **y aquí la que no corrió es la del hijo.** **Lo que no sé y digo que no sé**: **si el hijo arranca en la máquina del autor y no en la mía** (por `cargo` en el `PATH` del test, o por el aislamiento del proceso). **Lo que sí sé**: **en esta, quitar el arreglo no cambia el verde**, **así que aquí no está probado.** **Y la forma es la correcta, que conviene decirlo**: **un test de fugas de handle necesita un proceso** — **el contador de handles del proceso de test está contaminado por todo lo demás, y `GetHandleInformation` sobre un handle ya cerrado no distingue "cerrado" de "reutilizado".** **Aislarlo en un hijo es la manera; lo que falta es que el hijo corra.** **Si el autor me dice cómo lanza el hijo, lo miro** — **y si no lo lanza, ahí está el fallo del test, no del arreglo.** Written with an AI assistant.
EdenBendheim commented 2026-12-03 11:11:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-03T11:11:38Z.


RUN (in game, RTX 3090 24 GB, 305 s in-world gate) — PASS, including bounded shown-frame capture.

  • Head tested: 679938d2411239fb3efaa358aac59e3f35b3a896 merged locally onto main bfd03e7f3d8b88654bb9121fce7aa55def97689b. Merge 0155dc29feff2cb6d7007bb622448259ed7b3b29; exe SHA-256 0810da1af1cd7b5d9de00b2230cd92479affc3c3323beacb3320674019821a1a.
  • Machine: RTX 3090 24 GB (Profile L), NVIDIA 610.88, Windows 11 Home build 26200, Ryzen 9 5900X, 32 GiB RAM. Diagnostics/DLSS/mimalloc, Series S, no frame generation or precompile, warm cache, stock game gate. Presented-frame capture enabled; recording toggled for 2.010 s only.
  • MEASURED (one run): 305.312 s in world, stock target stop, actual exit 0, zero crashes and device losses. 253.414 s after control, 24 consistent placement samples. World+60 s: 2,280 present intervals, median/p5 14.41/4.38 FPS, p95/p99 228.35/981.32 ms, longest world gap 8.711 s. Peak/end private memory 25,431/25,365 MiB, min system commit headroom 3,815 MiB, peak VRAM 7,258 MiB (budget 23,558 MiB).
  • Capture: 21 shown frames, 21 matching timing rows, 25,735,147 bytes, recording marker removed and count retained through closure. No capture content attached.
  • Red/green: targeted isolated event-handle test passed; stubbing only CloseHandle made the exact parent fail (exit 101 with child status 101) and direct child fail its expected assertion (exit 101); restoring the source byte-for-byte made the exact parent pass again. Clean-room scan passed.
  • The run demonstrates ordinary shown-frame capture and clean closure. Repeated concurrent installation failure was not exercised. No matched main-only live run was collected.

AI-assisted: Codex GPT-6.2 Sol (tester and independent numerical review).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7376344577 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3003#issuecomment-7376344577). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-12-03T11:11:38Z. --- **RUN (in game, RTX 3090 24 GB, 305 s in-world gate) — PASS, including bounded shown-frame capture.** - Head tested: `679938d2411239fb3efaa358aac59e3f35b3a896` merged locally onto `main` `bfd03e7f3d8b88654bb9121fce7aa55def97689b`. Merge `0155dc29feff2cb6d7007bb622448259ed7b3b29`; exe SHA-256 `0810da1af1cd7b5d9de00b2230cd92479affc3c3323beacb3320674019821a1a`. - Machine: RTX 3090 24 GB (Profile L), NVIDIA 610.88, Windows 11 Home build 26200, Ryzen 9 5900X, 32 GiB RAM. Diagnostics/DLSS/mimalloc, Series S, no frame generation or precompile, warm cache, stock game gate. Presented-frame capture enabled; recording toggled for 2.010 s only. - **MEASURED (one run):** 305.312 s in world, stock target stop, actual exit 0, zero crashes and device losses. 253.414 s after control, 24 consistent placement samples. World+60 s: 2,280 present intervals, median/p5 14.41/4.38 FPS, p95/p99 228.35/981.32 ms, longest world gap 8.711 s. Peak/end private memory 25,431/25,365 MiB, min system commit headroom 3,815 MiB, peak VRAM 7,258 MiB (budget 23,558 MiB). - Capture: 21 shown frames, 21 matching timing rows, 25,735,147 bytes, recording marker removed and count retained through closure. No capture content attached. - **Red/green:** targeted isolated event-handle test passed; stubbing only `CloseHandle` made the exact parent fail (exit 101 with child status 101) and direct child fail its expected assertion (exit 101); restoring the source byte-for-byte made the exact parent pass again. Clean-room scan passed. - The run demonstrates ordinary shown-frame capture and clean closure. Repeated concurrent installation failure was not exercised. No matched main-only live run was collected. AI-assisted: Codex GPT-6.2 Sol (tester and independent numerical review).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3003:upstream-pr/3003'
git switch 'upstream-pr/3003'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3003'
git switch 'upstream-pr/3003'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3003'
git switch 'upstream-pr/3003'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3003'
git switch 'main'
git merge --squash 'upstream-pr/3003'
git switch 'main'
git merge --ff-only 'upstream-pr/3003'
git switch 'main'
git merge 'upstream-pr/3003'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3003
No description provided.