the-one icon indicating copy to clipboard operation
the-one copied to clipboard

Assertions fail when running default settings

Open schmittner opened this issue 7 years ago • 3 comments

When running the default simulation with assertions enabled (-ea), two assertions fail:

java -ea -Xmx512M -cp target:lib/ECLA.jar:lib/DTNConsoleConnection.jar core.DTNSim $*

First this:

Running simulation 'default_scenario'
java.lang.AssertionError: No path from Nt2@(3253.28,2184.33) to Nt2@(1763.40,268.05). The simulation map isn't fully connected
        at movement.ShortestPathMapBasedMovement.getPath(ShortestPathMapBasedMovement.java:56)
        at core.DTNHost.setNextWaypoint(DTNHost.java:417)
        at core.DTNHost.move(DTNHost.java:395)
        at core.World.moveHosts(World.java:214)
        at core.World.update(World.java:164)
        at ui.DTNSimTextUI.runSim(DTNSimTextUI.java:29)
        at ui.DTNSimUI.start(DTNSimUI.java:77)
        at core.DTNSim.main(DTNSim.java:98)

If removed, then the second one is eventually fired:

Running simulation 'default_scenario'
java.lang.AssertionError: Already contained  a connection of t121 and t120
        at report.ContactTimesReport.addConnection(ContactTimesReport.java:74)
        at report.ContactTimesReport.hostsConnected(ContactTimesReport.java:56)
        at core.NetworkInterface.notifyConnectionListeners(NetworkInterface.java:413)
        at core.NetworkInterface.connect(NetworkInterface.java:320)
        at interfaces.SimpleBroadcastInterface.connect(SimpleBroadcastInterface.java:59)
        at interfaces.SimpleBroadcastInterface.update(SimpleBroadcastInterface.java:93)
        at core.DTNHost.update(DTNHost.java:343)
        at core.World.updateHosts(World.java:198)
        at core.World.update(World.java:167)
        at ui.DTNSimTextUI.runSim(DTNSimTextUI.java:29)
        at ui.DTNSimUI.start(DTNSimUI.java:77)
        at core.DTNSim.main(DTNSim.java:85)

Not sure why this happens, but I didn't have time to debug this.

schmittner avatar Feb 28 '17 09:02 schmittner

Hey @schmittner, could you send us the scenario file so I can try to reproduce this problem. Thank you!

julianofischer avatar Mar 12 '17 18:03 julianofischer

It's the default_scenario in the current master d7fe68e6827ff9f20936d23a61ae9d878e1b0946. Just added -ea in the one.sh script and ran ./one.sh -b 1.

schmittner avatar Apr 03 '17 06:04 schmittner

Confirmed!

The method triggering the assertion is the following:

    public Path getPath() {
            Path p = new Path(generateSpeed());
            MapNode to = pois.selectDestination();

            List<MapNode> nodePath = pathFinder.getShortestPath(lastMapNode, to);

            // this assertion should never fire if the map is checked in read phase
            assert nodePath.size() > 0 : "No path from " + lastMapNode + " to " +
                    to + ". The simulation map isn't fully connected";

            for (MapNode node : nodePath) { // create a Path from the shortest path
                    p.addWaypoint(node.getLocation());
            }

            lastMapNode = to;

            return p;
    }

// this assertion should never fire if the map is checked in read phase Sincerely, I dont know what it means.

julianofischer avatar Apr 06 '17 12:04 julianofischer