Skip to content

Commit e7febc3

Browse files
committed
feat(close): close stdin
Signed-off-by: dark0dave <dark0dave@mykolab.com>
1 parent 1932d20 commit e7febc3

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/config/args.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ pub struct Options {
214214
)]
215215
pub never_abort: bool,
216216

217-
/// Timeout time per mod in seconds, default is 1 hour or 3 hours if batch_mode
217+
/// Timeout time per mod in seconds, default is 3 hours or 9 if batch mode
218218
#[clap(
219219
env,
220220
short,
221221
long,
222-
default_value = "3600",
223-
default_value_if("batch_mode", ArgPredicate::IsPresent, "10800")
222+
default_value = "10800",
223+
default_value_if("batch_mode", ArgPredicate::IsPresent, "32400")
224224
)]
225225
pub timeout: usize,
226226

@@ -321,6 +321,11 @@ pub struct Options {
321321
pub batch_mode: bool,
322322

323323
/// Ocaml run parameters
324+
// OCaml GC tuning — prevents 0xc0000005 segfaults on large installs:
325+
// s=16M = 128MB minor heap (64x default ~2MB, reduces minor GC frequency)
326+
// o=500 = 500% space overhead (5x default, reduces major GC frequency)
327+
// O=1000000 = disable heap compaction (compaction relocates memory blocks,
328+
// can trigger stale-pointer crashes in WeiDU's unsafe-string code)
324329
#[clap(env = "OCAMLRUNPARAM", long, default_value = "s=16M,o=500,O=1000000")]
325330
pub ocamlrunparam: String,
326331
}

src/runner.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,16 @@ fn handle_result(
128128
log::debug!("Weidu exit status: {exit}");
129129
result
130130
},
131-
Ok(None) if retry < 3 => {
131+
Ok(None) if retry < 5 => {
132132
log::debug!("Weidu not finished, sleeping then retrying, retry attempt number {retry}");
133133
sleep(options.tick);
134134
handle_result(child, options, result, retry + 1)
135135
},
136136
Ok(None) => {
137137
log::warn!("Weidu not finished, exiting anyway");
138+
if let Some(stdin) = child.stdin {
139+
drop(stdin);
140+
}
138141
result
139142
},
140143
Err(err) => {

0 commit comments

Comments
 (0)