Skip to content

LinearSVR.fit segmentation fault when y is a read-only memmap #10667

@lesteve

Description

@lesteve

This seems to be data-dependent and the following snippet only fails on master (not 0.19.1):

from sklearn.externals import joblib
from sklearn.utils.estimator_checks import _boston_subset
from sklearn.svm import LinearSVR

X, y = _boston_subset()

joblib.dump(y, '/tmp/test.pkl')
y = joblib.load('/tmp/test.pkl', mmap_mode='r')

LinearSVR().fit(X, y)

Trying some information from gdb:

gdb --args python -- /tmp/test-linear-svr.py
Program received signal SIGSEGV, Segmentation fault.
0x00007fffe4dc76a8 in train_one (prob=prob@entry=0x55555616fde0, param=param@entry=0x555556618010, w=w@entry=0x55555600f9f0, 
    Cp=Cp@entry=0, Cn=Cn@entry=0) at sklearn/svm/src/liblinear/linear.cpp:2255
2255            for(int i=0;i<prob->l;i++)
(gdb) bt
#0  0x00007fffe4dc76a8 in train_one (prob=prob@entry=0x55555616fde0, param=param@entry=0x555556618010, w=w@entry=0x55555600f9f0, 
    Cp=Cp@entry=0, Cn=Cn@entry=0) at sklearn/svm/src/liblinear/linear.cpp:2255
#1  0x00007fffe4dca952 in train (prob=prob@entry=0x55555616fde0, param=param@entry=0x555556618010)
    at sklearn/svm/src/liblinear/linear.cpp:2386
#2  0x00007fffe4dbc20d in __pyx_pf_7sklearn_3svm_9liblinear_train_wrap (__pyx_v_X=__pyx_v_X@entry=0x7fffe3f6c4e0, 
    __pyx_v_Y=__pyx_v_Y@entry=0x7fffe3f6c440, __pyx_v_is_sparse=__pyx_v_is_sparse@entry=0, 
    __pyx_v_solver_type=__pyx_v_solver_type@entry=13, __pyx_v_eps=__pyx_v_eps@entry=0.0001, __pyx_v_bias=__pyx_v_bias@entry=1, 
    __pyx_v_C=__pyx_v_C@entry=1, __pyx_v_class_weight=__pyx_v_class_weight@entry=0x7ffff6946580, __pyx_v_max_iter=1000, 
    __pyx_v_random_seed=1682099873, __pyx_v_epsilon=0, __pyx_v_sample_weight=0x7fffe3f6c260, __pyx_self=<optimized out>)
    at sklearn/svm/liblinear.c:2279
#3  0x00007fffe4dbf756 in __pyx_pw_7sklearn_3svm_9liblinear_1train_wrap (__pyx_self=<optimized out>, __pyx_args=<optimized out>, 
    __pyx_kwds=<optimized out>) at sklearn/svm/liblinear.c:1920
#4  0x000055555565fb24 in _PyCFunction_FastCallDict ()
#5  0x00005555556f939c in call_function ()
#6  0x0000555555715b3a in _PyEval_EvalFrameDefault ()
#7  0x00005555556b6614 in _PyEval_EvalCodeWithName ()
#8  0x00005555556b74d1 in fast_function ()
#9  0x00005555556f9475 in call_function ()
#10 0x000055555571684c in _PyEval_EvalFrameDefault ()
#11 0x00005555556b6614 in _PyEval_EvalCodeWithName ()
#12 0x00005555556b74d1 in fast_function ()
#13 0x00005555556f9475 in call_function ()
#14 0x0000555555715b3a in _PyEval_EvalFrameDefault ()
#15 0x00005555556c8bf9 in PyEval_EvalCodeEx ()
#16 0x00005555556c999c in PyEval_EvalCode ()
#17 0x00005555557693c4 in run_mod ()
#18 0x00005555557697c1 in PyRun_FileExFlags ()
#19 0x00005555557699c4 in PyRun_SimpleFileExFlags ()
#20 0x000055555576d4f8 in Py_Main ()
#21 0x000055555563426e in main ()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions