[linbox] [bug report] use of linbox from multiple threads, incorrect file open with -DDISABLE_COMMENTATOR

8 views
Skip to first unread message

David Monniaux

unread,
Feb 7, 2017, 1:41:45 PM2/7/17
to linbo...@googlegroups.com, Hang Yu, Michaël Périn, Alexandre Maréchal
Dear friends at Linbox,

I tried using Linbox from multiple threads (using OpenMP) and had
crashes. After some debugging, I think the problem is in the Commentator
class.

I suspect that some kind of global commentator is created and
re-created, or that multiple threads try to access the same and these
accesses are not thread-safe.

I then tried compiling with -DDISABLE_COMMENTATOR, which solved the
crash issue. The code now works.

However, with -DDISABLE_COMMENTATOR, even with one single thread,
Valgrind Memcheck tells me:

==9916== Syscall param open(filename) points to unaddressable byte(s)
==9916== at 0x87A6960: __open_nocancel (syscall-template.S:81)
==9916== by 0x873FCA1: _IO_file_open (fileops.c:227)
==9916== by 0x873FE19: _IO_file_fopen@@GLIBC_2.2.5 (fileops.c:332)
==9916== by 0x8735063: __fopen_internal (iofopen.c:90)
==9916== by 0x7A98DBF: std::__basic_file<char>::open(char const*,
std::_Ios_Openmode, int) (basic_file.cc:238)
==9916== by 0x7AD7CD9: std::basic_filebuf<char,
std::char_traits<char> >::open(char const*, std::_Ios_Openmode)
(fstream.tcc:184)
==9916== by 0x7AD863D: open (fstream:802)
==9916== by 0x7AD863D: std::basic_ofstream<char,
std::char_traits<char> >::basic_ofstream(char const*,
std::_Ios_Openmode) (fstream:702)
==9916== by 0x412B10: LinBox::commentator() (in
/local/monniaux/work/verasco_local/optimized_c/linbox/blassolve_openmp)

I suspect this is the cnull ostream initialized with a 0 parameter,
which perhaps gets considered as a pointer to a character string, thus
passed to file open system calls.

Regards,

--
David Monniaux
directeur de recherche au CNRS, laboratoire VERIMAG
Université Grenoble Alpes
http://www-verimag.imag.fr/~monniaux/

blassolve_openmp.cc
ex1_3.vector
ex1_3x3.matrix
Makefile
David_Monniaux.vcf
Reply all
Reply to author
Forward
0 new messages