AntaresSimulatorTeam / Antares_Simulator

Antares-Simulator is an Open Source power system simulator to quantify the adequacy or the economic performance of interconnected energy systems, at short or remote time horizons.
https://antares-simulator.org
Other
58 stars 24 forks source link

Segfault when exporting digest, new variable "profit by plant" suspected #840

Closed flomnes closed 2 years ago

flomnes commented 2 years ago

v8.3.1, BP21 variant

flomnes commented 2 years ago

Log

[Fri Aug 26 15:12:03 2022][solver][infos] Exporting digest...
[Fri Aug 26 15:12:03 2022][solver][debug]  . Digest, truncating file
[Fri Aug 26 15:12:03 2022][solver][debug]  . Digest, annual
/home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/../variable/storage/average.h:148: void Antares::Solver::Variable::R::AllYears::Average<NextT, FileFilter>::buildDigest(Antares::Solver::Variable::SurveyResults&, int, int) const [with VCardT = Antares::Solver::Variable::Economy::VCardProfitByPlant; NextT = Antares::Solver::Variable::Empty; int FileFilter = 127]: Assertion `report.data.columnIndex < report.maxVariables && "Column index out of bounds"' failed.

Thread 1 "antares-8.3-sol" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c

Backtrace

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff531a859 in __GI_abort () at abort.c:79
#2  0x00007ffff531a729 in __assert_fail_base (fmt=0x7ffff54b0588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=0x555556a9b008 "report.data.columnIndex < report.maxVariables && \"Column index out of bounds\"", 
    file=0x555556a9c580 "/home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/../variable/storage/average.h", line=148, function=<optimized out>) at assert.c:92
#3  0x00007ffff532bf36 in __GI___assert_fail (assertion=0x555556a9b008 "report.data.columnIndex < report.maxVariables && \"Column index out of bounds\"", 
    file=0x555556a9c580 "/home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/../variable/storage/average.h", line=148, 
    function=0x555556b87a68 "void Antares::Solver::Variable::R::AllYears::Average<NextT, FileFilter>::buildDigest(Antares::Solver::Variable::SurveyResults&, int, int) const [with VCardT = Antares::Solver::Variable::Economy::VCard"...) at assert.c:101
#4  0x0000555555761a57 in Antares::Solver::Variable::R::AllYears::Average<Antares::Solver::Variable::Empty, 127>::buildDigest<Antares::Solver::Variable::Economy::VCardProfitByPlant> (
    this=0x55567f9a4500, report=..., digestLevel=1, dataLevel=2) at /home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/../variable/storage/average.h:148
#5  0x0000555555758604 in Antares::Solver::Variable::Results<Antares::Solver::Variable::R::AllYears::Average<Antares::Solver::Variable::Empty, 127>, Antares::Solver::Variable::R::AllYears::Raw>::buildDigest<Antares::Solver::Variable::Economy::VCardProfitByPlant> (this=0x55567f9a4500, results=..., digestLevel=1, dataLevel=2)
    at /home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/../variable/storage/results.h:95
#6  0x000055555574f543 in Antares::Solver::Variable::VariableAccessor<Antares::Solver::Variable::Results<Antares::Solver::Variable::R::AllYears::Average<Antares::Solver::Variable::Empty, 127>, Antares::Solver::Variable::R::AllYears::Raw>, -1>::BuildDigest<Antares::Solver::Variable::Economy::VCardProfitByPlant> (results=..., container=std::vector of length 36, capacity 36 = {...}, digestLevel=1, 
    dataLevel=2) at /home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/../variable/info.h:381
#7  0x00005555557466e0 in Antares::Solver::Variable::IVariable<Antares::Solver::Variable::Economy::ProfitByPlant<Antares::Solver::Variable::Economy::Links>, Antares::Solver::Variable::Economy::Links, Antares::Solver::Variable::Economy::VCardProfitByPlant>::buildDigest (this=0x7ffff1427118, results=..., digestLevel=1, dataLevel=2)
    at /home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/../variable/variable.hxx:446
#8  0x000055555573df78 in Antares::Solver::Variable::IVariable<Antares::Solver::Variable::Economy::NbOfDispatchedUnitsByPlant<Antares::Solver::Variable::Economy::ProfitByPlant<Antares::Solver::Variable::Economy::Links> >, Antares::Solver::Variable::Economy::ProfitByPlant<Antares::Solver::Variable::Economy::Links>, Antares::Solver::Variable::Economy::VCardNbOfDispatchedUnitsByPlant>::buildDigest (
[...]
#48 0x00005555555f5727 in Antares::Solver::Simulation::ISimulation<Antares::Solver::Simulation::Economy>::writeResults (this=0x7fffffff76f0, synthesis=true, year=0, numSpace=9999) at /home/omnesflo/Projects/Antares_Simulator/src/solver/main/../simulation/solver.hxx:456
#49 0x00005555555effe3 in Antares::Solver::Application::runSimulationInEconomicMode (this=0x7fffffffd930) at /home/omnesflo/Projects/Antares_Simulator/src/solver/main/economy.cpp:48
#50 0x00005555555d657d in Antares::Solver::Application::execute (this=0x7fffffffd930) at /home/omnesflo/Projects/Antares_Simulator/src/solver/application.cpp:368
#51 0x00005555555d3a57 in main (argc=6, argv=0x7fffffffdc18) at /home/omnesflo/Projects/Antares_Simulator/src/solver/main.cpp:125

Closer inspection

148             assert(report.data.columnIndex < report.maxVariables && "Column index out of bounds");
(gdb) p report.data.columnIndex
$1 = 144
(gdb) p report.maxVariables
$2 = 144

This seems to be related to the "profit by plant" variable.

flomnes commented 2 years ago

Can reproduce with a study containing an area with 40 thermal clusters.

assert fails if adq-patch is disabled, succeeds if adq-patch is enabled.

flomnes commented 2 years ago

On the same study, disabling the "Profit by cluster" variable makes the assertion succeed, regardless of the adq-patch status.

flomnes commented 2 years ago

Fixed in v8.3.2