From 4b074beab7c6f0703460268fabb7db66be2341c7 Mon Sep 17 00:00:00 2001 From: Guest0x0 Date: Thu, 20 Nov 2025 10:07:33 +0000 Subject: [PATCH 1/2] fix fragile test --- src/fs/walk_test.mbt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fs/walk_test.mbt b/src/fs/walk_test.mbt index f09517a3..e771ecff 100644 --- a/src/fs/walk_test.mbt +++ b/src/fs/walk_test.mbt @@ -30,11 +30,12 @@ async test "walk sequential" { async test "walk parallel" { @async.sleep(300) let log = StringBuilder::new() + let mut i = 0 @fs.walk("test_directory", max_concurrency=2, fn(path, _) { + i = i + 1 log.write_string("handling \{path}\n") - @async.sleep(300) + @async.sleep(if i == 1 { 200 } else { 300 }) log.write_string("finished handling \{path}\n") - @async.sleep(100) }) inspect( log.to_string(), @@ -42,8 +43,8 @@ async test "walk parallel" { #|handling test_directory #|handling test_directory/inner1 #|finished handling test_directory - #|finished handling test_directory/inner1 #|handling test_directory/inner1/inner2 + #|finished handling test_directory/inner1 #|finished handling test_directory/inner1/inner2 #| ), From cf25bb6d5ffbcf28aa3269a287a6887f44c2bdee Mon Sep 17 00:00:00 2001 From: Guest0x0 Date: Thu, 20 Nov 2025 10:14:09 +0000 Subject: [PATCH 2/2] fix use-after-free due to race condition with ASAN enabled --- src/internal/event_loop/thread_pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/event_loop/thread_pool.c b/src/internal/event_loop/thread_pool.c index 68c3c0ae..25439601 100644 --- a/src/internal/event_loop/thread_pool.c +++ b/src/internal/event_loop/thread_pool.c @@ -120,13 +120,14 @@ void *worker_loop(void *data) { #endif while (job) { + int job_id = job->job_id; job->ret = 0; job->err = 0; job->worker(job); self->waiting = 1; - write(pool.notify_send, &(job->job_id), sizeof(int)); + write(pool.notify_send, &job_id, sizeof(int)); #ifdef WAKEUP_METHOD_SIGNAL sigwait(&pool.wakeup_signal, &sig);