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

Simulation crashes when vehicles exits #5

Closed
EmilyBourne opened this issue Sep 27, 2017 · 3 comments
Closed

Simulation crashes when vehicles exits #5

EmilyBourne opened this issue Sep 27, 2017 · 3 comments

Comments

@EmilyBourne
Copy link

When running a simulations, a segfault occurs when a vehicle exits. Backtrace shows that the problem is in :
Veins::ChannelAccess::calculatePropagationDelay

Presumably the simulation continues to attempt to pass messages to/from the vehicle after it has been deleted, resulting in an invalid pointer.

Bug is quickly reproducible by running the example provided with only 5 cars (change 195 to 5 in /extern/veins/examples/veings/erlangen.rou.xml, this allows the bug to appear after around 10 seconds. The full simulation is much slower)

@EmilyBourne
Copy link
Author

I have found a fix for this issue. In BasicNodeManager.h the following line needs to be added:
#include "veins/base/connectionManager/BaseConnectionManager.h"

and BaseConnectionManager* cc; needs to be added to the class.

In BasicNodeManager.cc the following lines need to be added:
#include "veins/base/utils/FindModule.h"

In initialize:
cc = FindModule<BaseConnectionManager*>::findGlobalModule();

In removeVehicle:
cModule* mod = getNodeModule(id);
if (!mod) error("no vehicle with Id \"%s\" found", id.c_str());
cModule* nic = mod->getSubmodule("nic");
if (cc && nic) {
cc->unregisterNic(nic);
}

@EmilyBourne
Copy link
Author

This solution is not a complete fix. It also gives a segfault when finish() is called after the last vehicle exits. I cannot find why though given that the steps added are the same as those carried out by a normal veins simulation which presumably does not give this behavior.

riebl added a commit that referenced this issue Sep 28, 2017
This fixes issue #5 reported by EmilyBourne

Change-Id: I96b26db1ab24d8a152ffc1e9867a78f10035a20f
@riebl
Copy link
Owner

riebl commented Sep 28, 2017

Thank you for reporting this issue. It is fixed in the current master branch.
Please note, there is still a bug in OMNeT++ regarding the drawing of bubbles used by the ExampleService (bubbles are not removed when source module is removed). However, it runs fine with Cmdenv.

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