Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] "corrupted size vs. prev_size" error when using libsumo in Java
  • From: "Nine, Harmon S" <harmon.s.nine@xxxxxxxxxxxxxx>
  • Date: Thu, 29 Dec 2022 03:37:33 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vanderbilt.edu; dmarc=pass action=none header.from=vanderbilt.edu; dkim=pass header.d=vanderbilt.edu; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZPzBzvz4H6dgVv7NwhY0v5IslA9uJ3dAR8yKt1PZ0ys=; b=bhtFk08ZDgrntLTavZpjOp3vLK0vdspwsLQKX1XVrANlwiA/TxR5wa4f4m4eGqz+YZ6yjcgCUXbBWRMa0RlLWhZJcsVQ/USrATXTwIUOg+nrE57V2fKwlDxohaI5cfJ46S2zo81d56MxyO+dnaCrGijRmdNvF0oHdux4/ymgu4R3/QXuZwMPHD+5oRSgX7EyHeDIQwIDcSJjivFB8ytJMx3EL5WeixLE4qOsJFuN6RRQ6e3/sHxaBgxkemlBu+OS5FJHaY0tXtUd+vOEJsc1oMtL1nqNEIo66RtYhF9IxUpmtC7GrbP5LqSRvLupIrbp3Bdn1/GtNAIcR2gkz7+CsA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mYzIQkzjzB6K3mmRUKlvxbdCx5IrO7K8/yF7mmLdKGAI47ITWC2gFTRN5Anc1xb/UKrNs5bziPZFuqfk+ysEfSsD0T+ZCQJhl/ABoxB7dyaM6VCZbZ+gh+Qv6Z+AWjZs5wuKvkJPTh20WuT2Zm3m2aX/bqgMtEdcLVK09sYzxsXRO+6h9ZIlb3SplPeL56I4GDPm43fyd3mvAVvNBhA54zOCTq2QISfiXEFAdrX1gsPTGJuTZ78mZ4dIzA+mOCwQfyIVusmdE2rJ+tXzGwhFZJN2J8CLUTrPlCZcZweAU5SqVvUrBVEnzkrgM8IVTOG/5i29/JuUR71JXTrVKy9ymA==
  • Delivered-to: sumo-user@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/sumo-user/>
  • List-help: <mailto:sumo-user-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/sumo-user>, <mailto:sumo-user-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHZGzNuUUd4FTin3kSWilU7gqnwhK6ENzuh
  • Thread-topic: "corrupted size vs. prev_size" error when using libsumo in Java

BTW, I'm using libsumo from sumo 1.15.0.
-- Harmon

From: sumo-user <sumo-user-bounces@xxxxxxxxxxx> on behalf of Nine, Harmon S via sumo-user <sumo-user@xxxxxxxxxxx>
Sent: Wednesday, December 28, 2022 9:36 PM
To: Nine, Harmon S via sumo-user <sumo-user@xxxxxxxxxxx>
Cc: Nine, Harmon S <harmon.s.nine@xxxxxxxxxxxxxx>
Subject: [sumo-user] "corrupted size vs. prev_size" error when using libsumo in Java
 
Hello.

I'm using the Java interface for libsumo.  When using the
Vehicle.getNextTLS(vehicleId)
I'm getting a "corrupted size vs prev_size" error during runtime.

From the web, it appears this occurs when "memory chunk control structure fields in the adjacent following chunk are being overwritten due to out-of-bounds access by the code" (https://stackoverflow.com/questions/49628615/understanding-corrupted-size-vs-prev-size-glibc-error)

The code that's incurring the error is below. It appears the error happens during garbage collection, I'm guessing when the
memory used by the data returned by "Vehicle.getNextTLS(vehicleId)" is reclaimed.

The error occurs on the explicit call to "System.gc()".  Without this call, the error occurs later, when garbage collection is implicitly called by the JVM.

How can this be fixed?

double oldModulus = 0;
int modulusPeriod = 90;
double currentTime = 0;
while(true) {
StringVector stringVector
= Vehicle.getIDList();
    for (String vehicleId : stringVector) {
        TraCINextTLSVector traCINextTLSVector = Vehicle.getNextTLS(vehicleId);
        if (traCINextTLSVector.size() > 0) {
            TraCINextTLSData traCINextTLSData = traCINextTLSVector.get(0);
            String tlsId = traCINextTLSData.getId();
            if (tlsId.equals("traffic-light-id")) {
                if (Vehicle.getSpeed(vehicleId) == 0.0) {
                    ++stoppedVehicles;
            }
        }
    }
}

    double newModulus = currentTime - (int)(currentTime / modulusPeriod) * modulusPeriod;
    if (newModulus < oldModulus) {
        double average = stoppedVehicles/modulusPeriod;
        System.out.println(average);
        stoppedVehicles = 0;
        System.gc();  // WITH THIS CALL, THE "corrupted size vs. prev_size" ERROR OCCURS.
    }
    oldModulus = newModulus;
    currentTime += 1;
}

-- Harmon

Back to the top