Skip to content

Segfault in getrs! during testing of MultiScaleArrays.jl #1001

@maleadt

Description

@maleadt

PkgEval encounters the following segfault during testing of MultiScaleArrays.jl: https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2023-04/22/MultiScaleArrays.primary.log

[44] signal (11.128): Segmentation fault
in expression starting at /home/pkgeval/.julia/packages/MultiScaleArrays/02k83/test/dynamic_diffeq.jl:66
dlaswp_plus at /opt/julia/bin/../lib/julia/libopenblas64_.so (unknown line)
dgetrs_N_single at /opt/julia/bin/../lib/julia/libopenblas64_.so (unknown line)
dgetrs_64_ at /opt/julia/bin/../lib/julia/libopenblas64_.so (unknown line)
getrs! at /cache/build/default-amdci5-3/julialang/julia-master/usr/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl:1015
ldiv! at /cache/build/default-amdci5-3/julialang/julia-master/usr/share/julia/stdlib/v1.10/LinearAlgebra/src/lu.jl:425 [inlined]
ldiv! at /home/pkgeval/.julia/packages/MultiScaleArrays/02k83/src/math.jl:99
ldiv! at /cache/build/default-amdci5-3/julialang/julia-master/usr/share/julia/stdlib/v1.10/LinearAlgebra/src/factorization.jl:188
#solve#14 at /home/pkgeval/.julia/packages/LinearSolve/LD2dF/src/factorization.jl:451 [inlined]
solve at /home/pkgeval/.julia/packages/LinearSolve/LD2dF/src/factorization.jl:442 [inlined]
#solve#6 at /home/pkgeval/.julia/packages/LinearSolve/LD2dF/src/common.jl:224 [inlined]
solve at /home/pkgeval/.julia/packages/LinearSolve/LD2dF/src/common.jl:223 [inlined]
#dolinsolve#3 at /home/pkgeval/.julia/packages/OrdinaryDiffEq/gjQVg/src/misc_utils.jl:106 [inlined]
dolinsolve at /home/pkgeval/.julia/packages/OrdinaryDiffEq/gjQVg/src/misc_utils.jl:83 [inlined]
perform_step! at /home/pkgeval/.julia/packages/OrdinaryDiffEq/gjQVg/src/perform_step/rosenbrock_perform_step.jl:58
perform_step! at /home/pkgeval/.julia/packages/OrdinaryDiffEq/gjQVg/src/perform_step/rosenbrock_perform_step.jl:29 [inlined]
solve! at /home/pkgeval/.julia/packages/OrdinaryDiffEq/gjQVg/src/solve.jl:520

The segfault can be reproduced by calling getrs! with the following inputs:

factors = [-1.0375496667427269 -0.005364238020436056 -0.00536423806812862 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.01034020502789305 -1.0428584375621481 -0.010673008814814361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.015510307310650843 0.015351568942073743 -1.048031094361553 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -1.0643210765001119 -0.01979110098964682 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 0.023243809028434988 -1.0688088317993285 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -1.0375496667427269 -0.005364238020436056 -0.00536423806812862 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 0.01034020502789305 -1.0428584375621481 -0.010673008814814361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 0.015510307310650843 0.015351568942073743 -1.048031094361553 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -1.0522803778482694 -0.012064702619429851 -0.012064702481971475 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.007643528838868881 -1.048166593095576 -0.007950918043954668 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.019108822299936577 0.018963871173813467 -1.0599421902245667 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -1.064310907564103 -0.01837454501830832 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.025896397144739576 -1.0730223461184658 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -1.0522803778482694 -0.012064702619429851 -0.012064702481971475 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.007643528838868881 -1.048166593095576 -0.007950918043954668 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.019108822299936577 0.018963871173813467 -1.0599421902245667 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -1.064310907564103 -0.01837454501830832 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.025896397144739576 -1.0730223461184658 0.0 0.0 0.0 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -1.0375496667427269 -0.005364238020436056 -0.00536423806812862 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.01034020502789305 -1.0428584375621481 -0.010673008814814361 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.015510307310650843 0.015351568942073743 -1.048194941792193 0.0 0.0; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.0 -1.0643210765001119 -0.01979110098964682; -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.0 -0.024738875847106944 -1.0692688523711944]
ipiv = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
B = [-0.4997096221673574, -0.9994192443333407, -1.499128866497099, -1.7005190903124199, -2.1256488629121635, -0.4997096221673574, -0.9994192443333407, -1.499128866497099, -1.4043079260213087, -0.9362052840017713, -2.3405132100204273, -1.628667034221737, -2.4430005513335136, -1.4043079260213087, -0.9362052840017713, -2.3405132100204273, -1.628667034221737, -2.4430005513335136, -0.4997096221673574, -0.9994192443333407, -1.499128866497099, -1.7005190903124199, -2.1256488629121635]

using LinearAlgebra
LinearAlgebra.LAPACK.getrs!('N', factors, ipiv, B)

Seeing how these inputs (which I extracted from the MultiScaleArrays failure) make Julia crash all the way back to 1.6, I'm guessing there's something wrong with them. However, our LAPACK wrappers are AFAIK supposed to be safe wrappers that validate their inputs, so probably shouldn't simply segfault.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions