-
-
Notifications
You must be signed in to change notification settings - Fork 796
Closed
Description
Context
I am calling this code from a threadpool with a size of 10, rapidly:
log.info("creating pipe")
r, w := os2.pipe() or_return
log.info("creating pipe -done")
and sometimes i get an error!
I'm trying to pipe the result of a command I'm calling back to my application and continue processing that...
the full proc looks like this:
@(private)
exec_curl :: proc(url: string) -> (output: string, err: os2.Error) {
r, w := os2.pipe() or_return // TODO this appears to be buggy, issue: https://github.com/odin-lang/Odin/issues/4712
defer os2.close(r)
p: os2.Process;
{
defer os2.close(w)
p = os2.process_start({
command = {"curl", "-i", "-H \"Connection: close\"", url},
stdout = w,
}) or_return
}
out := os2.read_entire_file(r, context.allocator) or_return
_, err = os2.process_wait(p)
if err != nil {
delete(out)
return
}
output = string(out)
return
}
Edit: to add a bit more context: I have a Tracking_Allocator setup and the thread pool is setup this way:
thread.pool_init(&worker_thread_pool, context.allocator, WORKER_POOL_SIZE)
defer thread.pool_destroy(&worker_thread_pool)
for &t in worker_thread_pool.threads {
t.init_context = context
}
thread.pool_start(&worker_thread_pool)
and the connection pool this way:
connection_thread_pool: thread.Pool
thread.pool_init(&connection_thread_pool, context.allocator, CONNECTION_POOL_SIZE)
defer thread.pool_destroy(&connection_thread_pool)
for &t in connection_thread_pool.threads {
t.init_context = context
}
thread.pool_start(&connection_thread_pool)
note: they all share the same context thus the same allocator.
perhaps this is relevant for tracking down the issue!
- Operating System & Odin Version:
- Please paste
odin report
output:
Odin: dev-2025-01-nightly
OS: Fedora Linux 41 (Forty One), Linux 6.12.6-200.fc41.x86_64
CPU: 12th Gen Intel(R) Core(TM) i5-12400
RAM: 31821 MiB
Backend: LLVM 18.1.6
Expected Behavior
No assertion failure
Current Behavior
Assertion failure
Failure Information (for bugs)
/opt/odin/core/os/os2/heap_linux.odin(316:2) runtime assertion: alloc.free_idx == NOT_FREE
71888 Illegal instruction
Steps to Reproduce
- setup a thread pool with a size of 10
- create tasks (in rapid succession) which call:
- r, w := os2.pipe() or_return
- let it run for a while
Failure Logs
See screenshot for stacktrace~:
Metadata
Metadata
Assignees
Labels
No labels