Skip to content

Commit cb73ed0

Browse files
committed
Merge Windows transaction guard cleanup
2 parents 5f8c781 + bfadd48 commit cb73ed0

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

scripts/test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,11 @@ for test_dir in "$TESTS_DIR"/*/; do
346346
has_expected_diagnostics=true
347347
fi
348348

349-
# Compile within the cross-platform ten-second regression budget.
349+
# Native Windows compiler processes have higher startup and I/O overhead.
350+
compile_timeout=10
351+
if [[ "$is_windows" == "true" ]]; then
352+
compile_timeout=20
353+
fi
350354
rm -f "$output_binary"
351355
if [[ -f "$stack_limit_file" && "$is_windows" != "true" ]]; then
352356
stack_limit_kb=$(<"$stack_limit_file")
@@ -357,9 +361,9 @@ for test_dir in "$TESTS_DIR"/*/; do
357361
failures+=("$test_name")
358362
continue
359363
fi
360-
compile_output=$( (ulimit -s "$stack_limit_kb"; run_with_timeout 10 "$COMPILER" "$source_file" -o "$output_binary") 2>&1)
364+
compile_output=$( (ulimit -s "$stack_limit_kb"; run_with_timeout "$compile_timeout" "$COMPILER" "$source_file" -o "$output_binary") 2>&1)
361365
else
362-
compile_output=$(run_with_timeout 10 "$COMPILER" "$source_file" -o "$output_binary" 2>&1)
366+
compile_output=$(run_with_timeout "$compile_timeout" "$COMPILER" "$source_file" -o "$output_binary" 2>&1)
363367
fi
364368
compile_exit=$?
365369
if [[ $compile_exit -eq 124 ]]; then

src/runtime/filesystemTransactionWindows.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,16 @@ static int split_target(
326326
return -1;
327327
}
328328

329+
static void release_parent_guard(DynlexWindowsStaging *staging) {
330+
if (staging->parent != INVALID_HANDLE_VALUE)
331+
CloseHandle(staging->parent);
332+
staging->parent = INVALID_HANDLE_VALUE;
333+
}
334+
329335
static void destroy_staging(DynlexWindowsStaging *staging) {
330336
if (staging->staging != INVALID_HANDLE_VALUE)
331337
CloseHandle(staging->staging);
332-
if (staging->parent != INVALID_HANDLE_VALUE)
333-
CloseHandle(staging->parent);
338+
release_parent_guard(staging);
334339
free(staging->parent_path);
335340
free(staging->destination_name);
336341
free(staging->destination_path);
@@ -485,6 +490,7 @@ static int delete_stage(DynlexWindowsStaging *staging, int32_t failure_operation
485490
CloseHandle(staging->staging);
486491
staging->staging = INVALID_HANDLE_VALUE;
487492
staging->stage_name_present = false;
493+
release_parent_guard(staging);
488494
return 0;
489495
}
490496

@@ -751,6 +757,7 @@ int dynlex_filesystem_staging_commit(
751757
staging->state = DYNLEX_FILESYSTEM_STAGING_CLEANUP_FAILED;
752758
return -1;
753759
}
760+
release_parent_guard(staging);
754761
*cleanup_succeeded = 1;
755762
staging->state = DYNLEX_FILESYSTEM_STAGING_COMMITTED;
756763
return 0;

0 commit comments

Comments
 (0)