julia
37ba08d6 - Initialize the cached C locale with `pthread_once` (#65401)

Commit
15 hours ago
Initialize the cached C locale with `pthread_once` (#65401) Fix a straightforward race condition in `get_c_locale`. We call `get_c_locale` from different threads all of the time, so it's surprising I only hit this problem now. I got this to happen just by typing at the REPL very fast (aarch64 linux): ``` julia> cos(Fault at memory address: 0x8 [2890545] signal 11 (1): Segmentation fault in expression starting at none:0 unknown function (ip: 0xebebff964fc8) at /lib/aarch64-linux-gnu/libc.so.6 isnumtok_base at /home/xal-0/a/julia/src/flisp/read.c:42:13 read_numtok at /home/xal-0/a/julia/src/flisp/read.c:117:14 [inlined] peek at /home/xal-0/a/julia/src/flisp/read.c:400:21 read_list at /home/xal-0/a/julia/src/flisp/read.c:558:9 do_read_sexpr at /home/xal-0/a/julia/src/flisp/read.c:641:9 fl_read_sexpr at /home/xal-0/a/julia/src/flisp/read.c:724:9 [inlined] fl_load_system_image at /home/xal-0/a/julia/src/flisp/flisp.c:2456:17 jl_init_ast_ctx at /home/xal-0/a/julia/src/ast.c:146:9 [inlined] jl_ast_ctx_enter at /home/xal-0/a/julia/src/ast.c:183:9 ijl_is_operator at /home/xal-0/a/julia/src/ast.c:864:29 _isoperator at meta.jl:75:0 (pc: 6) [inlined] is_valid_identifier at meta.jl:144:0 (pc: 15) show_sym at show.jl:1884:0 (pc: 17) [inlined] show_unquoted at show.jl:1912:0 (pc: 6) [inlined] show_unquoted at show.jl:1679:0 (pc: 2) [inlined] show at show.jl:2905:0 (pc: 38) show_typeparams at show.jl (unknown line) show_datatype at show.jl:1365:0 (pc: 368) _show_type at show.jl (unknown line) show at show.jl:1086:0 (pc: 28) jfptr_show_10 at /home/xal-0/a/julia/usr/lib/julia/sys.so (unknown line) show_delim_array at show.jl:1586:0 (pc: 34) iterate at dict.jl:861:0 (pc: 5) [inlined] iterate at dict.jl:861:0 (pc: 1) [inlined] io_has_tvar_name at show.jl:624:0 (pc: 3) [inlined] _show_type at show.jl:1130:0 (pc: 119) show at show.jl:1086:0 (pc: 28) [inlined] print at strings/io.jl:35:0 (pc: 6) string_with_env at strings/io.jl:162:0 (pc: 77) unknown function (ip: 0xebeb9c083833) at (unknown file) argtype_decl at methodshow.jl:46:0 (pc: 137) arg_decl_parts at methodshow.jl:69:0 (pc: 85) arg_decl_parts at methodshow.jl:56:0 (pc: 1) [inlined] show_method at methodshow.jl:240:0 (pc: 6) [inlined] show at methodshow.jl:236:0 (pc: 4) [inlined] sprint at strings/io.jl:104:0 (pc: 34) [inlined] repr at strings/io.jl:291:0 (pc: 3) [inlined] _completion_text at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/REPLCompletions.jl:123:41 (pc: 3) [inlined] completion_text at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/REPLCompletions.jl:128:22 (pc: 2) [inlined] named_completion at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/REPLCompletions.jl:134:12 (pc: 2) unknown function (ip: 0xebeb9c083573) at (unknown file) macro expansion at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/REPL.jl:971:0 (pc: 6) [inlined] macro expansion at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/REPL.jl:966:0 (pc: 1) [inlined] complete_line at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/REPL.jl:3:1 (pc: 25) [inlined] complete_line_named at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/LineEdit.jl:643:43 (pc: 4) jfptr_complete_line_named_1 at /home/xal-0/a/julia/usr/share/julia/compiled/v1.15/REPL/u0gqU_1jBlV_7a4b8c23b4f1f55d.so (unknown line) complete_line at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/LineEdit.jl:741:1 (pc: 2) [inlined] complete_line at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/LineEdit.jl:629:8 (pc: 8) edit_tab at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/LineEdit.jl:2907:38 (pc: 5) edit_tab at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/LineEdit.jl:2906:1 (pc: 1) [inlined] jfptr_YY.match_inputYY.YY.0_11 at /home/xal-0/a/julia/usr/share/julia/compiled/v1.15/REPL/u0gqU_1jBlV_7a4b8c23b4f1f55d.so (unknown line) macro expansion at /home/xal-0/a/julia/usr/share/julia/stdlib/v1.15/REPL/src/LineEdit.jl:3443:0 (pc: 15) [inlined] jfptr_YY.promptNOT.YY.YY.2_0 at /home/xal-0/a/julia/usr/share/julia/compiled/v1.15/REPL/u0gqU_1jBlV_7a4b8c23b4f1f55d.so (unknown line) jl_apply at /home/xal-0/a/julia/src/julia.h:2612:12 [inlined] start_task at /home/xal-0/a/julia/src/task.c:1291:23 Allocations: 1 (Pool: 1; Big: 0); GC: 0 ``` Assisted-by: Claude Code (Opus 5.5)
Author
Parents
Loading