shogun-toolbox / shogun

Shōgun
http://shogun-toolbox.org
BSD 3-Clause "New" or "Revised" License
3.03k stars 1.04k forks source link

Segmentation fault #2370

Closed postoroniy closed 4 years ago

postoroniy commented 10 years ago

I compiled latest source and installed it on linuxmint17 i686. complied with python modular extension only and with simple code as is in the file csv_show.py:

import sys,csv,argparse

from numpy import linspace, arange
from modshogun import *

import matplotlib.pyplot as pyplot
parser = argparse.ArgumentParser(description='EEG csv analyze', fromfile_prefix_chars="@" )
parser.add_argument('file', help='csv file to import', action='store')
args = parser.parse_args()
csv_file = args.file

with open(csv_file, 'rb') as csvfile:
    reader = csv.reader(csvfile,delimiter=',')
    for row in reader:
        content = list(row[i] for i in [2,3,4,5,6,7,8,9,10,11,12,13,14,15])
    for index in range(len(content)):
        print content[index]

I called in shell by this command : "./csv_show ../from/1.csv >xx" with '>xx' it shows segmentation fault below is gdb backtrace

(gdb) run ./csv_show.py ./from/1.CSV >xx
Starting program: /usr/bin/python ./csv_show.py ./from/1.CSV >xx
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xb5205108 in dsfmt_chk_init_gen_rand () from /usr/local/lib/libshogun.so.16
(gdb) backtrace
#0  0xb5205108 in dsfmt_chk_init_gen_rand () from /usr/local/lib/libshogun.so.16
#1  0xb4804803 in shogun::CRandom::reinit(unsigned int) () from /usr/local/lib/libshogun.so.16
#2  0xb4804aab in shogun::CRandom::init() () from /usr/local/lib/libshogun.so.16
#3  0xb4804d59 in shogun::CRandom::CRandom() () from /usr/local/lib/libshogun.so.16
#4  0xb4b760d0 in shogun::init_shogun(void (*)(_IO_FILE*, char const*), void (*)(_IO_FILE*, char const*), void (*)(_IO_FILE*, char const*), void (*)(bool&, bool&)) () from /usr/local/lib/libshogun.so.16
#5  0xb60e54bc in init_modshogun ()
    at ../shogun/shogun/build/src/interfaces/python_modular/modshogunPYTHON_wrap.cxx:925466
#6  0x080727ca in _PyImport_LoadDynamicModule ()
#7  0x081f6700 in ?? ()
#8  0x08081259 in ?? ()
#9  0x08156a91 in PyEval_EvalFrameEx ()
#10 0x0815707c in PyEval_EvalFrameEx ()
#11 0x081a2543 in PyEval_EvalCode ()
#12 0x081f6580 in PyImport_ExecCodeModuleEx ()
#13 0x081ea02e in ?? ()
#14 0x081a2d24 in ?? ()
#15 0x081a3181 in ?? ()
#16 0x081a360b in PyImport_ImportModuleLevel ()
#17 0x08120eaf in ?? ()
#18 0x081045a9 in PyEval_CallObjectWithKeywords ()
#19 0x08158fd4 in PyEval_EvalFrameEx ()
#20 0x081a2543 in PyEval_EvalCode ()
postoroniy commented 10 years ago

if I don't use '>xx' it finishes normally python --version -> Python 2.7.6

karlnapf commented 10 years ago

i just tried and cannot reproduce this locally. The program throws an IndexError though.

can you run any of the python examples that come with shogun?

postoroniy commented 10 years ago

ok here's another one it is much simpler source seg fault on it, no print

#!/usr/bin/env python
#
#

from numpy import linspace, arange
from modshogun import *

print "test"

but below is just fine

#!/usr/bin/env python
#
#
from modshogun import *
from numpy import linspace, arange
print "test"

backtrace for first one here

 $ gdb python
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...(no debugging symbols found)...done.
(gdb) run test.py
Starting program: /usr/bin/python test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xb5265108 in dsfmt_chk_init_gen_rand () from /usr/local/lib/libshogun.so.16
(gdb) backtrace
#0  0xb5265108 in dsfmt_chk_init_gen_rand ()
   from /usr/local/lib/libshogun.so.16
#1  0xb4864803 in shogun::CRandom::reinit(unsigned int) ()
   from /usr/local/lib/libshogun.so.16
#2  0xb4864aab in shogun::CRandom::init() ()
   from /usr/local/lib/libshogun.so.16
#3  0xb4864d59 in shogun::CRandom::CRandom() ()
   from /usr/local/lib/libshogun.so.16
#4  0xb4bd60d0 in shogun::init_shogun(void (*)(_IO_FILE*, char const*), void (*)(_IO_FILE*, char const*), void (*)(_IO_FILE*, char const*), void (*)(bool&, bool&)) () from /usr/local/lib/libshogun.so.16
#5  0xb61264bc in init_modshogun ()
    at ../pathtoshogun_source/python_modular/modshogunPYTHON_wrap.cxx:925466
#6  0x080727ca in _PyImport_LoadDynamicModule ()
#7  0x081f6700 in ?? ()
#8  0x08081259 in ?? ()
#9  0x08156a91 in PyEval_EvalFrameEx ()
#10 0x0815707c in PyEval_EvalFrameEx ()
#11 0x081a2543 in PyEval_EvalCode ()
#12 0x081f6580 in PyImport_ExecCodeModuleEx ()
#13 0x081ea02e in ?? ()
#14 0x081a2d24 in ?? ()
karlnapf commented 10 years ago

So the import order. Phew, I have no idea what could cause this. Possibility: Python versions not matching.

What are your system specs?

@vigsterkr @sonney2k any ideas?

postoroniy commented 10 years ago

slava@slava-mint ~ $ uname -a Linux slava-mint 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:31:42 UTC 2014 i686 i686 i686 GNU/Linux slava@slava-mint ~ $ python --version Python 2.7.6

karlnapf commented 10 years ago

Could you double check that the python version shogun is coimpiled against is exactly the one of your system? you can do that via using ccmake and then go to advanced options which should should you the python that shogun uses.

postoroniy commented 10 years ago

Cmake shows this one: -- Found PythonLibs: /usr/lib/i386-linux-gnu/libpython2.7.so (found version "2.7.6")

vigsterkr commented 10 years ago

mmm i reckon this has something to do with SSE2 @postoroniy what's the arch/cpu in that machine where you want to compile shogun?

postoroniy commented 10 years ago

HI @vigsterkr , I compile for i686, compilation didn't show any error. linux kernel as well as machine is mentioned here: Linux 3.13.0-24-generic i686 i686 i686 GNU/Linux Should I disable sse2?

ps gcc is gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2

vigsterkr commented 10 years ago

@postoroniy what's your swig version? :) see #2313

postoroniy commented 10 years ago

agh...getting a little bit annoying and losing interest to shogun swig Version: 2.0.11-1ubuntu2

karlnapf commented 9 years ago

I can reproduce the problem now on my university workstation. Though still have no idea what causes it.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue is now being closed due to a lack of activity. Feel free to reopen it.