Fix CI test segfault: clamp stack ulimit before odin test
Build and Test / build (push) Failing after 19s
Build and Test / windows (push) Successful in 1m34s

Root cause found via gdb backtrace on the runner (thread::pool_init
crashed from main -> testing runner): the CI container sets
`ulimit -s unlimited`, so getrlimit(RLIMIT_STACK) returns RLIM_INFINITY.
core:thread passes that to pthread_attr_setstacksize, pthread_create
fails, and thread.create() returns nil, which core:testing's pool_init
dereferences without a nil check. Reproduced and confirmed fixed in an
ubuntu:24.04 container with the same Odin build. `just test` now clamps
the stack limit before running odin test. Also removes the gdb
diagnostic step added to debug this.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
SansanandClaude Sonnet 5 committed 2026-10-03 19:35:43 +02:00
1 parent 0776e8e4b9
commit 06f4e9ed11
3 files changed
+6 -13

No files matched your search

+1 -1
View File
@@ -38,7 +38,7 @@ Commands (see `justfile`): `just run`, `just check`, `just test`, `just package
6. **Windows builds are cross-compiled**: Odin can't link Windows binaries on Linux, so `just windows` builds objects with `-build-mode:obj` and links with `lld-link` against an xwin SDK. The VC runtime is linked statically; only Windows system DLLs are needed. New Odin core usage can need new import libs (e.g. `ole32.lib` for `os.user_data_dir`); the CI `windows` job catches this. Not yet tested on a real Windows machine.
7. **Odin constant arrays can't be indexed at runtime**: lookup tables (`DECKS`, `LAYOUTS`, …) are `@(rodata)` globals instead of `::` constants.
8. **Profile memory**: `profile` always allocates from the heap allocator, because the test runner frees each test's allocator afterwards.
9. **CI's `build` job segfaults on `odin test`** (exit 139) on the self-hosted runner, even running alone — reproduces every push so far. Does not reproduce locally or in a plain `ubuntu:24.04` container with the same Odin version, so it's specific to the runner's actual job image/environment, not the test code. Under investigation; see the `Debug Segfault` diagnostic step in `gitea-build.yaml`.
9. **`odin test` segfaults if the stack rlimit is "unlimited"**: the CI runner's container sets `ulimit -s unlimited`, which makes `getrlimit(RLIMIT_STACK).rlim_cur` come back as `RLIM_INFINITY` (a huge unsigned value). Odin's `core:thread` passes that straight to `pthread_attr_setstacksize`, `pthread_create` then fails, and `thread.create()` returns `nil` - which `core:testing`'s `pool_init` dereferences unconditionally, segfaulting the whole test binary (exit 139) before it prints anything. `just test` works around it with `ulimit -s 8192` before running `odin test`. Upstream Odin bug (core:thread/core:testing don't handle a failed thread creation); not our code.
## File Structure
```