gerkone / pyTORCS-docker

Docker-based, gym-like torcs environment with vision.
17 stars 3 forks source link

Segmentation Fault #4

Open anshdavid opened 2 years ago

anshdavid commented 2 years ago

Unable to start torcs after copying configurations file to correctly set up torcs for vision

anshdavid commented 2 years ago

Running the docker container with arguments causes a segmentation fault.

-v $(TORCSPATH)/torcs/configs/config:/usr/local/share/games/torcs/config:ro \
-v $(TORCSPATH)/torcs/configs/drivers/scr_server/scr_server.xml:/usr/local/share/games/torcs/drivers/scr_server/scr_server.xml:ro \
-v $(TORCSPATH)/torcs/configs/drivers/scr_server/0:/usr/local/share/games/torcs/drivers/scr_server/0:ro \
Saving /root/.torcs/config/raceengine.xml to /root/.torcs/config/raceengine.xml.old
Saving /root/.torcs/config/style.xsl to /root/.torcs/config/style.xsl.old
Saving /root/.torcs/config/screen.xml to /root/.torcs/config/screen.xml.old
Saving /root/.torcs/config/graph.xml to /root/.torcs/config/graph.xml.old
Saving /root/.torcs/config/sound.xml to /root/.torcs/config/sound.xml.old
Saving /root/.torcs/config/raceman/champ.xml to /root/.torcs/config/raceman/champ.xml.old
Saving /root/.torcs/config/raceman/dtmrace.xml to /root/.torcs/config/raceman/dtmrace.xml.old
Saving /root/.torcs/config/raceman/endrace.xml to /root/.torcs/config/raceman/endrace.xml.old
Saving /root/.torcs/config/raceman/ncrace.xml to /root/.torcs/config/raceman/ncrace.xml.old
Saving /root/.torcs/config/raceman/practice.xml to /root/.torcs/config/raceman/practice.xml.old
Saving /root/.torcs/config/raceman/quickrace.xml to /root/.torcs/config/raceman/quickrace.xml.old

********** Memory sharing started, attached at 9B320000 **********

Visual Properties Report
------------------------
Compatibility mode, properties unknown.
/usr/local/bin/torcs: line 53:    54 Segmentation fault      (core dumped) $LIBDIR/torcs-bin -l $LOCAL_CONF -L $LIBDIR -D $DATADIR $*
anshdavid commented 2 years ago

I created a fresh build and ran torcs inside a docker container, it is working fine. But when I try to copy/mount ur config and driver settings I get a Segmentation Fault

anshdavid commented 2 years ago

I was able to resolve the error by copying /usr/local/share/games/torcs from your docker image and replacing the files in the configs folder from your repository.

Hope this helps you update your repository and resolve this issue

gerkone commented 2 years ago

Hey, sorry for the slow reply. The seg fault is caused by torcs trying to access a file that does not exist. I will look into this, I have an idea of why this is happening. I think it's a directory error that went unnoticed on my side. Thanks

gerkone commented 2 years ago

So before the volumes were mounted to the container based on the current working directory (with os.getcwd()). With the last commit I tried to make the volume mount independent from the current directory.

Because I am currently unable to test if everything works as intended I pushed on this branch Could you please check?

anshdavid commented 2 years ago

Sure, i'll check it and get back to you

anshdavid commented 2 years ago

Still get the same error the cofigs folder provided in your directory.

Saving /root/.torcs/config/raceengine.xml to /root/.torcs/config/raceengine.xml.old
Saving /root/.torcs/config/style.xsl to /root/.torcs/config/style.xsl.old
Saving /root/.torcs/config/screen.xml to /root/.torcs/config/screen.xml.old
Saving /root/.torcs/config/graph.xml to /root/.torcs/config/graph.xml.old
Saving /root/.torcs/config/sound.xml to /root/.torcs/config/sound.xml.old
Saving /root/.torcs/config/raceman/champ.xml to /root/.torcs/config/raceman/champ.xml.old
Saving /root/.torcs/config/raceman/dtmrace.xml to /root/.torcs/config/raceman/dtmrace.xml.old
Saving /root/.torcs/config/raceman/endrace.xml to /root/.torcs/config/raceman/endrace.xml.old
Saving /root/.torcs/config/raceman/ncrace.xml to /root/.torcs/config/raceman/ncrace.xml.old
Saving /root/.torcs/config/raceman/practice.xml to /root/.torcs/config/raceman/practice.xml.old
Saving /root/.torcs/config/raceman/quickrace.xml to /root/.torcs/config/raceman/quickrace.xml.old

********** Memory sharing started, attached at 735BC000 **********

Visual Properties Report
------------------------
Compatibility mode, properties unknown.
/usr/local/bin/torcs: line 53:    57 Segmentation fault      (core dumped) $LIBDIR/torcs-bin -l $LOCAL_CONF -L $LIBDIR -D $DATADIR $*

Running the container with the configs files I copied from your docker image work perfectly.

gerkone commented 2 years ago

Thanks for checking, this is weird though. You said that you run the container with the volumes

-v $(TORCSPATH)/torcs/configs/config:/usr/local/share/games/torcs/config:ro \
-v $(TORCSPATH)/torcs/configs/drivers/scr_server/scr_server.xml:/usr/local/share/games/torcs/drivers/scr_server/scr_server.xml:ro \
-v $(TORCSPATH)/torcs/configs/drivers/scr_server/0:/usr/local/share/games/torcs/drivers/scr_server/0:ro \

Are you sure that $(TORCSPATH) is correctly leading to the torcs directory? Could you also check that the configs you are mounting are correct?

Another thing you could try is see where it is failing (just to be sure it's a missing config, but I am pretty certain that is the cause). Run torcs with the -d flag to run in within gdb. You would need to install gdb on the container to do that though.

I am sorry but as of now I cannot properly support and help this issue, or update and cleanup this repository as I would want.

anshdavid commented 2 years ago

Yes, its working fine for me after I copied the config folder from inside the docker image and replaced the configs folder present in your repository.