Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2CV simulation ends with SIGSEGV #11

Closed
baratte opened this issue Dec 4, 2015 · 1 comment
Closed

2CV simulation ends with SIGSEGV #11

baratte opened this issue Dec 4, 2015 · 1 comment

Comments

@baratte
Copy link

baratte commented Dec 4, 2015

with pyvle 1.1.2 and 2CV from recordb from master

userPrompt:~/tests> python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pyvle
f = pyvle.Vle("2CV-parcelle.vpz", "2CV")
f.run()
Segmentation fault (core dumped)

debugging with gdb
Program received signal SIGSEGV, Segmentation fault.
pyvle_convert_dataframe (out=...) at /usr/include/c++/4.8/bits/stl_map.h:330
330 { return _M_t.begin(); }
(gdb) quit

@quesnel
Copy link
Member

quesnel commented Dec 4, 2015

debugging with gdb
Program received signal SIGSEGV, Segmentation fault.
pyvle_convert_dataframe (out=...) at /usr/include/c++/4.8/bits/stl_map.h:330
330 { return _M_t.begin(); }
(gdb) quit

I can reproduce this SIGSEGV with gens.vpz@vle.examples experiment.
Default, it uses vle.output and file plug-in for views. If I switch
manually to storage, all is done.

These is an error in pyvle.cpp

    res = sim.run(new vpz::Vpz(*file), man, th, 0,1, &error);

    if (error.code != 0) {
        std::string filename = utils::Trace::getLogFilename("pyvle.log");
        std::ofstream* logfile = new std::ofstream(filename.c_str());
        (*logfile) << _("Error in pyvle_manager_thread: ")
                        << error.message
                        << "\n\n" << std::flush;
        logfile->close();
        return PyString_FromString(error.message.c_str());
    }
    resPython = pyvle_convert_simulation_dataframe(*res);

    delete res;
    return resPython;

*res and delete res can SIGSEGV if sim.run returns NULL.

quesnel added a commit to quesnel/pyvle that referenced this issue Dec 4, 2015
The manager::Simulation::run and manager::Manager::run functions can
return NULL pointer (no storage plug-ins in the View). So we need to check the
simulation results before dereference/delete it (Closes vle-forge#11).

Remarks: some duplicated code in the pyvle_run* functions.
quesnel added a commit to quesnel/pyvle that referenced this issue Dec 4, 2015
The manager::Simulation::run and manager::Manager::run functions can
return NULL pointer (no storage plug-ins in the View). So we need to check the
simulation results before dereference/delete it (Closes vle-forge#11).

Remarks: some duplicated code in the pyvle_run* functions.
@quesnel quesnel closed this as completed in ad24dd9 Dec 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants