ev3dev-python-tools / ev3dev2simulator

Simulator for an EV3 robot; a program using the ev3dev2 API can run both on the rover and on the simulator without any modifications to the code
MIT License
6 stars 9 forks source link

Simulator crashes when opened #38

Closed bintzandt closed 3 years ago

bintzandt commented 3 years ago

I am unable to run the simulator. It briefly displays the simulator before it crashes. In the terminal I can read the following error: munmap_chunk(): invalid pointer.

The complete log in the console is as follows:

Listening for connections...
Please connect brick "brick1" from robot "robot0"
munmap_chunk(): invalid pointer
fish: “ev3dev2simulator” terminated by signal SIGABRT (Abort)

OS: Manjaro Linux Shell: Fish & Bash Python version: 3.8.5

The simulator does work on: OS: EndeavourOS Shell: Fish Python version: 3.8.6

I don't know what other information can be helpful.

bintzandt commented 3 years ago

Hmm, after trying again, I cannot get the simulator to work on Endeavour OS, Python version 3.8.6. However, I am sure that it worked since I used that system for the first assignment.

bintzandt commented 3 years ago

I have also tried using Python 3.7 but this causes the same error

Do you have any information on how to debug the simulator?

NielsOkker commented 3 years ago

Since you get pointer errors and the only C in the simulator is a library, I think you should look at the Pymunk library. This is used for the physics such as the collisions. Could you try reinstalling Pymunk? I tried googling you issue, but did not find any related info. It is quite hard for me to figure out the issue, since I never got the crash on my Ubuntu machine (the last time, at least).

Since you mention that it used to work. Do you have any clue what changed?

bintzandt commented 3 years ago

Hey @NielsOkker, thanks for the response.

I have tried the following things:

None of the above seem to work. I also have no clue what changed.

I had it running on my old laptop but when I decided that I would give up trying to run it on my new laptop, it would not run on my old laptop as well. Maybe something changed in a recent version of pymunk? Both distro's are rolling, meaning that new versions will ship fairly quick.

I have found a solution that somewhat works. I have created a Docker container that starts up the simulator. The container connects to the xserver on my host machine so that I can see the simulator. I am then able to run programs from inside the container.

This is a non-optimal solution since there are some problems with this setup. The touch sensor seems to cause a timeout in the program, which resets the world.

I hope that this setup allows me to test my programs enough so that I will be able to develop them.

Hopefully, a new version of one of the dependencies will fix the problem on my host machine in the near future.

Let me know if you are interested in the Dockerfile.

NielsOkker commented 3 years ago

Hey @bintzandt, unfortunate to hear that it still does not work as expected. Good to hear that you at least have some work-around.

To try to help you, I have updated my Ubuntu 19.10 packages to their latest versions and updated pip to the last version. I am using Python 3.7.5, which is similar to your version If I understand you correctly. Unfortunately for the bug-hunting, the simulator still seems to work properly. I even installed fish, but had similar results; the simulator works fine.

For now, I don't see much usage for the Dockerfile, since we use a similar solution for the Github CI, which already used Docker-containers. I'll let you know if we can use it in the future! Thanks for your information. If you have any new clue, please do not hesitate to contact me (either here or via mail).

One last suggestion I have is that you could look into the Arcade library, which is built upon Pyglet and OpenGL. This might also be a source of C-like problems. Maybe you could determine if Arcade is the source of the problem, by trying to run an example? You can find Arcade on Github https://github.com/pythonarcade/arcade.

NielsOkker commented 3 years ago

I am closing this issue for now. Please notify me if I can help you!