Stacksize can't be allocated
Reported by Andrea Nardone
System: POWER8 Server
Architecture: ppc64 Big Endian
OS: RHEL 7.0, RHEL 7.1, both Big Endian. The error doesn't show up for RHEL 7.1 Little Endian.
No Graphical version as it's only a server.
BUG DESCRIPTION:
----------------
This error shows up at compile time after doing "make":
./bin/scilab-cli -ns -noatomsautoload -f modules/functions/scripts/buildmacros/buildmacros.sce
stacksize(5000000);
!--error 10001
stacksize: Cannot allocate memory.
%s: Cannot allocate this quantity of memory.
at line 27 of exec file called by :
exec('modules/functions/scripts/buildmacros/buildmacros.sce',-1)
--->
(the last ---> is the Scilab prompt)
Scilab won't compile. However, the error can be circumvented and scilab can be compiled if you comment the line "stacksize(5000000)" in the file:
modules/functions/scripts/buildmacros/buildmacros.sce
However, even so, when scilab is compile and you start it with scilab-cli command, you get the same error (probably because setting the stacksize is also part of the startup script).
In the scilab prompt, when you type "stacksize(102314)" , the error also shows up, indicating that the issue has to do with the method allocating the stack size.
ERROR LOG:
----------
./bin/scilab-cli -ns -noatomsautoload -f modules/functions/scripts/buildmacros/buildmacros.sce
stacksize(5000000);
!--error 10001
stacksize: Cannot allocate memory.
%s: Cannot allocate this quantity of memory.
at line 27 of exec file called by :
exec('modules/functions/scripts/buildmacros/buildmacros.sce',-1)
--->
(the last ---> is the Scilab prompt)
HOW TO REPRODUCE THE BUG:
-------------------------
Compile Scilab on a Little Endian System with the following configure options:
./configure --without-modelica --without-javasci --without-gui --disable-static-system-lib --disable-build-help --disable-build-localization --without-matio --without-umfpack --without-fftw
OTHER INFORMATION:
------------------
If you do stacksize(1), it tells you it's out of bounds, and shows you the bounds. This happens also if you enter a number above the upper bound. However, if you do stacksize with something inside the bounds, it tells "cannot allocate that much memory".
-->stacksize(1)
!--error 1504
stacksize: Out of bounds value. Not in [180000,268435454].
Also the stacksize used seems fine:
-->stacksize()
ans =
7999994. 332.
However, when trying to give such value an input inbetween, it fails.
--->stacksize(190000)
!--error 10001
stacksize: Cannot allocate memory.
%s: Cannot allocate this quantity of memory.
at line 27 of exec file called by :
exec('modules/functions/scripts/buildmacros/buildmacros.sce',-1)
--->
The file that calls setstacksize() seems to be modules/functions/scripts/buildmacros/buildmacros.sce, inside the scilab directory.
The setstacksize file is there in our systems case: vi /root/scilab/scilab-5.5.1/modules/core/sci_gateway/c/sci_stacksize.c
And here in the internet: http://doxygen.scilab.org/master_wg/d5/dfb/sci__stacksize_8c_source.html
The error message seems to be triggered by a failing method called get_max_memory_for_scilab_stack ( void ) .
The get_max_memory_for_scilab_stack ( void ) method (the one that fails) is defined in the stackinfo.c class:
http://doxygen.scilab.org/master_wg/dd/dfb/stackinfo_8h.html#afbd65a57df45bed9445a7393a4558395
In our system, it's: vi /root/scilab/scilab-5.5.1/modules/core/src/c/stackinfo.c