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

Memory leak problem when running in 20.04 #73

Closed
nag92 opened this issue Jun 5, 2020 · 12 comments
Closed

Memory leak problem when running in 20.04 #73

nag92 opened this issue Jun 5, 2020 · 12 comments

Comments

@nag92
Copy link
Contributor

nag92 commented Jun 5, 2020

When attempting to launch the simulator in 20.04 I get the following error:

Thread Joined: World
INFO! SETTING SIMULATION MAX ITERATIONS TO : 50
Thread Joined: light_left
Thread Joined: light_right
Thread Joined: default_camera
Thread Joined: Chassis
Thread Joined: ShockBL
Thread Joined: WheelBR
Thread Joined: ShockBR
Thread Joined: WheelBL
Thread Joined: ShockFL
Thread Joined: WheelFR
Thread Joined: ShockFR
Thread Joined: WheelFL
free(): double free detected in tcache 2
Aborted (core dumped)


@nag92 nag92 changed the title 20.04 support Memory leak problem when running in 20.04 Jun 8, 2020
@nag92
Copy link
Contributor Author

nag92 commented Jun 8, 2020

I think that it a memory leak problem.

I ran ambf_simulator with

valgrind --leak-check=yes --log-file="leak.txt"   ./ambf_simulator 

Here is my log file from running it with those tags
leak.txt

This somewhat makes sense because the debug mode sets things to 0 where release mode had garbage collection problem or something like that. Why this problem is happening in 20.04 is still strange.

@nag92
Copy link
Contributor Author

nag92 commented Jun 10, 2020

Here is the similar report but running with the debug flag. When running in debug mode, the simulator window opens up
leak.txt

@adnanmunawar
Copy link
Member

Thanks for trying to figure this out. I am not very well versed with the output of Valgrind other than the commonly reported metrics. I would like to go over this using GDB with breakpoints. Can you confirm that this is the master branch that you are running? Can you quickly test this branch and report if you see similar issues.

https://github.com/WPI-AIM/ambf/tree/feat-communication

If so, it would be easier to add the fixes here as well as this will be merged into the master soon.

@nag92
Copy link
Contributor Author

nag92 commented Jun 10, 2020

Same issue, I am trying to spin up a VM to test in a vanilla environment

@montematico
Copy link

Are any of the branches stable on Ubuntu 20.04 yet?

@nag92
Copy link
Contributor Author

nag92 commented Jul 21, 2020

Are any of the branches stable on Ubuntu 20.04 yet?

no, I just tied on my VM running PopOs 20.04 on it still throws the same mem error

@adnanmunawar
Copy link
Member

I don't have much bandwidth these days to debug on Ubuntu 20.04, although based on a quick session with Nathaniel, we found that in Debug mode, there weren't any memory leak issues. This makes it super tricky to debug and thus I am postponing it for the moment.

adnanmunawar added a commit that referenced this issue Sep 21, 2020
@adnanmunawar
Copy link
Member

adnanmunawar commented Sep 21, 2020

It appears that two methods with a return type of bool weren't returning anything if the intended tasks were successful. This still shouldn't cause the crash but apparently it did. Worthwhile for someone else to check as well if this works.

@nag92
Copy link
Contributor Author

nag92 commented Sep 22, 2020

interesting, ill check it soon

@montematico
Copy link

It appears that two methods with a return type of bool weren't returning anything if the intended tasks were successful. This still should cause the crash but apparently it did. Worthwhile for someone else to check as well if this works.

I just downloaded & built the ambf-1.0 branch on Kubuntu 20.04; It seems to be have built successfully and it is launching the demo objects without issue.

@adnanmunawar
Copy link
Member

Thanks for checking @montematico. I found out that not returning in method/function that expects a return is undefined behaviour. So we were just lucky previously where the crashes weren't happening.

https://eel.is/c++draft/stmt.return

C++ Section 8.7.4

Flowing off the end of a constructor, a destructor, or a non-coroutine function with a cv void return type is equivalent to a return with no operand. Otherwise, flowing off the end of a function other than main or a coroutine ([dcl.fct.def.coroutine]) results in undefined behavior.

@adnanmunawar
Copy link
Member

Should be fixed in ambf-2.0

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