why do I receive a segmentation fault (segfault) crash with textscan in R2015a?

1 view (last 30 days)
[UPDATE: MathWorks is already aware of this bug: http://www.mathworks.com/support/bugreports/1195978]
Hi,
I am able to generate a repeatable segmentation fault error in MATLAB R2015a in Linux. The problem is in the textscan.m function. I provide a small 3-line test script and data that will repeatably create the segfault on our system. (Sorry to use these Forums, but the Contact Support email form did not work.)
I can work around this issue, but I just wanted to report this to your bug database.
In a nutshell, the problem is this: I use textscan to read in a well-structured tab-delimited file. When the final line is missing a concluding "\n" and the "CollectOutput" flag is set to 1, I consistently get a segfault. I do not experience this bug on R2013 on Linux or R2014 on Windows. My matlab version inf is:
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.5.0.197613 (R2015a)
MATLAB License Number: ••••••
Operating System: Linux 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.5 (R2015a)
Optimization Toolbox Version 7.2 (R2015a)
Parallel Computing Toolbox Version 6.6 (R2015a)
Statistics and Machine Learning Toolbox Version 10.0 (R2015a)
Tensor Toolbox (Sandia National Labs) Version 2.2
Attached is a data file and script I can use to replicate the issue. The script is simple:
% The input string (variable 'data') is a structured tab-delimited text file. Newlines are
% terminated with \n. The crash occurs when the last line does not have a
% final \n character and the "CollectOutput" flag is true.
load('test.mat'); % This contains the test data.
% Success:
[~] = textscan(data,fmt,'delimiter','\t');
% Success:
CLEAN_data = [data '\n'];
[~] = textscan(CLEAN_data,fmt,'delimiter','\t','CollectOutput',1);
% Fail (segfault)
[~] = textscan(data,fmt,'delimiter','\t','CollectOutput',1);
Here is the segfualt information:
------------------------------------------------------------------------
Segmentation violation detected at Tue Apr 7 21:00:17 2015
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: Unknown software
Current Visual : 0x37 (class 4, depth 24)
Default Encoding : UTF-8
GNU C Library : 2.12 stable
Host Name : emma
MATLAB Architecture : glnxa64
MATLAB Root : /usr/local/MATLAB/R2015a
MATLAB Version : 8.5.0.197613 (R2015a)
OpenGL : software
Operating System : Linux 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64
Processor ID : x86 Family 6 Model 45 Stepping 7, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (70000000), display :1001
Fault Count: 1
Abnormal termination:
Segmentation violation
Register State (from fault):
RAX = 0000000000000022 RBX = 00002b66d00283e8
RCX = 0000000000000000 RDX = fffffffffffdd365
RSP = 00002b6533ffb3e0 RBP = 00002b6533ffb400
RSI = 0000000000000000 RDI = 00002b6560046f60
R8 = 00002b653ac5b2c0 R9 = 0000000000000000
R10 = 0000000000000000 R11 = 00002b65174eb542
R12 = 00002b6560046f60 R13 = 0000000000000000
R14 = 0000000000000000 R15 = 0000000000000001
RIP = 00002b6552944f52 EFL = 0000000000010213
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00002b6552944f52 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwfileio.so+00667474
[ 1] 0x00002b6552956163 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwfileio.so+00737635
[ 2] 0x00002b655298268e /usr/local/MATLAB/R2015a/bin/glnxa64/libmwfileio.so+00919182
[ 3] 0x00002b6552958607 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwfileio.so+00747015
[ 4] 0x00002b6552958856 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwfileio.so+00747606
[ 5] 0x00002b651deea305 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00557829
[ 6] 0x00002b651ded1744 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00456516 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000244
[ 7] 0x00002b651eb14d20 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04189472
[ 8] 0x00002b651eac4432 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03859506
[ 9] 0x00002b651eac66d8 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03868376
[ 10] 0x00002b651eacc597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 11] 0x00002b651eac7cff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 12] 0x00002b651eac8cb5 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03878069
[ 13] 0x00002b651eabb6f3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03823347
[ 14] 0x00002b651eabdb99 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03832729
[ 15] 0x00002b651eaba38d /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03818381
[ 16] 0x00002b651eabaad3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03820243
[ 17] 0x00002b651cfa4ad2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwbridge.so+00211666
[ 18] 0x00002b651eac3785 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03856261
[ 19] 0x00002b651eac5b7a /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03865466
[ 20] 0x00002b651eacc597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 21] 0x00002b651eac7cff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 22] 0x00002b651eac8934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 23] 0x00002b651eb3e2ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 24] 0x00002b651df28aea /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00813802 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000762
[ 25] 0x00002b651df28fb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 26] 0x00002b651eb14d20 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04189472
[ 27] 0x00002b651ea954b3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03667123
[ 28] 0x00002b651eac56ee /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03864302
[ 29] 0x00002b651eacc597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 30] 0x00002b651eac7cff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 31] 0x00002b651eac8934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 32] 0x00002b651eb3e2ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 33] 0x00002b651df28c39 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00814137 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00001097
[ 34] 0x00002b651df28fb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 35] 0x00002b651eafd495 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04093077
[ 36] 0x00002b651eabdfb9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03833785
[ 37] 0x00002b651eaba3f5 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03818485
[ 38] 0x00002b651eabaad3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03820243
[ 39] 0x00002b651cfa8b6c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwbridge.so+00228204
[ 40] 0x00002b651cfa9751 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwbridge.so+00231249 _Z8mnParserv+00000737
[ 41] 0x00002b6512c1e3af /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00799663 _ZN11mcrInstance30mnParser_on_interpreter_threadEv+00000031
[ 42] 0x00002b6512bfe133 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00667955
[ 43] 0x00002b6512bfffd9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00675801 _ZN5boost6detail11task_objectIvNS_3_bi6bind_tIvPFvRKNS_8functionIFvvEEEENS2_5list1INS2_5valueIS6_EEEEEEE6do_runEv+00000025
[ 44] 0x00002b6512c009a7 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00678311 _ZN5boost6detail9task_baseIvE3runEv+00000071
[ 45] 0x00002b6512c00a07 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00678407
[ 46] 0x00002b6512bfbd8a /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00658826
[ 47] 0x00002b651f92ca56 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwuix.so+00334422
[ 48] 0x00002b651f9143a2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwuix.so+00234402
[ 49] 0x00002b65124b6f1f /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02621215
[ 50] 0x00002b65124b708c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02621580
[ 51] 0x00002b65124b8bdf /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02628575
[ 52] 0x00002b65124b961c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02631196 _Z25svWS_ProcessPendingEventsiib+00000092
[ 53] 0x00002b6512bfc408 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00660488
[ 54] 0x00002b6512bfc724 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00661284
[ 55] 0x00002b6512be8b0d /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00580365
[ 56] 0x0000003c028079d1 /lib64/libpthread.so.0+00031185
[ 57] 0x0000003c024e88fd /lib64/libc.so.6+00952573 clone+00000109
[ 58] 0x0000000000000000 <unknown-module>+00000000
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.** This crash report has been saved to disk as /home/dm/matlab_crash_dump.12052-1 **

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!