Skip to content

Creating a task with a custom stack size fails with julia-debug #59876

@vchuravy

Description

@vchuravy

On 1.10

function with_stack(f, n, pool=:default)
           @assert n > 0
           t = Core.Task(f, n)
           t.sticky=false
           Base.Threads._spawn_set_thrpool(t, pool)
           schedule(t)
           return fetch(t)
end
with_stack(()->nothing, 16_000_000)
[410693] signal (11.1): Segmentation fault
in expression starting at REPL[2]:1
fish: Job 1, '~/src/julia-1.10/julia' terminated by signal SIGSEGV (Address boundary error)

Make.user:

~/s/julia-1.10 (release-1.10)> cat Make.user
LLVM_ASSERTIONS=1
FORCE_ASSERTIONS=1
override CC=gcc-14
override CXX=g++-14

# default to a debug build for better line number reporting
override JULIA_BUILD_MODE=debug

WITH_TRACY=1
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007fea4287887f in jl_start_fiber_set (t=<error reading variable: Cannot access memory at address 0xffffffffffffffd8>) at /home/vchuravy/src/julia-1.10/src/task.c:1464
1464	    asm volatile (
(rr) rsi
0x00007fea4287887c in jl_start_fiber_set (t=0x7fe9e3468a10) at /home/vchuravy/src/julia-1.10/src/task.c:1464

Inspection shows that:

1459	    char *stk = ((char**)&t->ctx)[0];
1460	    size_t ssize = ((size_t*)&t->ctx)[1];

are both null.

Setting a breakpoint leads to:

#1  0x00007fea4287821a in ijl_new_task (start=0x7fe9e6e45d30, completion_future=0x7fea2361b950, ssize=16000000) at /home/vchuravy/src/julia-1.10/src/task.c:1099
1099	        memset(&t->ctx, 0, sizeof(t->ctx));

julia/src/task.c

Line 1099 in 95f30e5

memset(&t->ctx, 0, sizeof(t->ctx));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviormultithreadingBase.Threads and related functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions