Julia Version : 1.11.4+0.aarch64.apple.darwin14
Related package: ModelingToolkit, NonlinearSolve
Our project is to use C++ to pass function parameter information to Julia, then use julia to implement numerical calculations, and finally return the results to C++.
In our call calculation, a stack overflow is prompted during the first call to the function,
Internal error: during type inference Encountered stack overflow. This might be caused by recursion over very long tuples or argument lists.
but the julia process calculates and returns the result normally.
From the second call onwards, there will be no access to the Julia process, only C++ related logs. The stack overflow warning still exists
Internal error: during type inference Encountered stack overflow. This might be caused by recursion over very long tuples or argument lists.
Finally the error is reported
[51768] signal 11 (2): Segmentation fault: 11 in expression starting at none:0 Allocations: 124270666 (Pool: 124266799; Big: 3867); GC: 1 zsh: segmentation fault ./web_simulation_test
Julia function :
const ValueType = Union{Float64, Array{Float64, 1}, Array{Float64, 2}, Array{Float64, 3}}
function source_model( namelist::Vector{String}, params_list::Dict{String, ValueType}, fixed_vars::Dict{String, ValueType}, guess_vars::Dict{String, ValueType}; thermo_model::String="SRK", solver::String="NewtonRaphson", log_level::LogLevel=DEBUG )
C++ calling function :
std::string call_code =
"global cpp_result = nothing; try\n"
"global cpp_result = Julia_Model." +
function_name +
"(cpp_namelist, "
"cpp_params_list, cpp_fixed_vars, cpp_guess_vars, \"" +
thermodynamic_model + "\", \"" + solver_name +
"\")\n"
"println(\"调用成功: \", typeof(cpp_result))\n"
"catch e\n"
"println(\"调用错误: \", e)\n"
"bt = stacktrace(catch_backtrace())\n"
"println(\"栈跟踪: \", bt)\n"
"end";
jl_eval_string(call_code.c_str());
jl_value_t *result = jl_eval_string("cpp_result");
I’ve submitted the corresponding issue on github #58096
I’ll provide as much info as I can if needed
Calculations are not working causing our project to stall badly, hopefully someone will be able to help us soon!