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

Cooja OutOfMemory Error #2834

Open
ArshdeepSingh18 opened this issue Jan 7, 2024 · 8 comments
Open

Cooja OutOfMemory Error #2834

ArshdeepSingh18 opened this issue Jan 7, 2024 · 8 comments

Comments

@ArshdeepSingh18
Copy link

ArshdeepSingh18 commented Jan 7, 2024

Dear Contiki-NG Developers,

I've encountered an issue while attempting to create a larger network in Cooja. After a while, it consistently throws an OutOfMemory error in Java. Is there a possibility of a memory leak within Cooja causing this problem?

Exception in thread "sim" java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.Arrays.copyOf(Arrays.java:3482)
        at java.base/java.util.ArrayList.grow(ArrayList.java:237)
        at java.base/java.util.ArrayList.grow(ArrayList.java:244)
        at java.base/java.util.ArrayList.add(ArrayList.java:483)
        at java.base/java.util.ArrayList.add(ArrayList.java:496)
        at org.contikios.cooja.plugins.TimeLine$MoteEvents.addRadioRXTX(TimeLine.java:2051)
        at org.contikios.cooja.plugins.TimeLine$14.accept(TimeLine.java:929)
        at org.contikios.cooja.plugins.TimeLine$14.accept(TimeLine.java:864)
        at org.contikios.cooja.util.EventTriggers.trigger(EventTriggers.java:111)
        at org.contikios.cooja.contikimote.interfaces.ContikiRadio.signalReceptionEnd(ContikiRadio.java:218)
        at org.contikios.cooja.radiomediums.AbstractRadioMedium.lambda$new$0(AbstractRadioMedium.java:190)
        at org.contikios.cooja.radiomediums.AbstractRadioMedium$$Lambda/0x00007f44b9f1cde0.accept(Unknown Source)
        at org.contikios.cooja.util.EventTriggers.trigger(EventTriggers.java:111)
        at org.contikios.cooja.contikimote.interfaces.ContikiRadio.doActionsAfterTick(ContikiRadio.java:340)
        at org.contikios.cooja.contikimote.ContikiMote.execute(ContikiMote.java:131)
        at org.contikios.cooja.motes.AbstractWakeupMote$1.execute(AbstractWakeupMote.java:67)
        at org.contikios.cooja.Simulation.lambda$new$0(Simulation.java:226)
        at org.contikios.cooja.Simulation$$Lambda/0x00007f44b9f20af8.run(Unknown Source)
        at java.base/java.lang.Thread.runWith(Thread.java:1596)
        at java.base/java.lang.Thread.run(Thread.java:1583)

Best Regards,
Arshdeep Singh

@alexrayne
Copy link
Contributor

alexrayne commented Jan 7, 2024 via email

@ArshdeepSingh18
Copy link
Author

Hello,

I am sorry I am new to Cooja, I am not sure I understand it. Can you please explain it a bit more.

Thanks

@pjonsson
Copy link
Contributor

pjonsson commented Jan 8, 2024

@ArshdeepSingh18 is this a long running simulation? You can try to give the JVM a larger heap, change the 2048M on the line applicationDefaultJvmArgs = ['-Xms400M', '-Xmx2048M',in tools/cooja/build.gradle to something larger.

@ArshdeepSingh18
Copy link
Author

@pjonsson Thanks for the update.

Yes, My experiment requires from 42 nodes to 64 nodes, all z1. The packet exchange between nodes to the sink is every 60 seconds. Yes, For my experiment I require it to run for longer periods of time.

I did change the Xms to 8G and Xmx to 8G, but after half an hour into the simulation, it still throws an OutOfMemory error.

@pjonsson
Copy link
Contributor

pjonsson commented Jan 9, 2024

Did the simulation run longer when you increased the size, or does it crash just as quickly as before?

@pjonsson
Copy link
Contributor

@ArshdeepSingh18 based on what you have written, my guess is that Cooja is holding on to a lot of memory for a long time, and then the heap gets full and Cooja crashes.

This is obviously not desirable behavior, but I'm not sure how to fix it; if we drop some of the data the timeline will not be complete.

@alexrayne
Copy link
Contributor

alexrayne commented Jan 10, 2024 via email

@ArshdeepSingh18
Copy link
Author

@pjonsson Sorry for the late reply, I completely understand that, do you think there can be a way around it?

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

3 participants