Skip to content

[Embedding] Initialization of nthreads_per_pool when jl_options.nthreads == 1 #58691

@tz-lom

Description

@tz-lom

Here is the unsafe access to the variable that causes segfaults:

julia/src/threading.c

Lines 726 to 727 in d6294ba

if (jl_options.nthreads != 0) { // --threads specified
nthreads = jl_options.nthreads_per_pool[0];

By default jl_options is initalized with zeros, and if only nthreads is set this will cause the segfault.
This is not very convenient for the end user, also my use case is setting nthreads = 1 because I am using handle_signals = 0 which caused me segfaults in multi-threaded environment for a different reason (GC behavior).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorembeddingEmbedding Julia using the C API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions