## VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

Report crashes, strange behaviour, or apparent bugs
agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

### VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

I am launching VREP from python and am using a slightly modified version of the remoteApiCommandServer.ttt file

Code: Select all

 args = [os.path.join(vrepPath, "vrep.sh"), "-gREMOTEAPISERVERSERVICE_" + str(portNum) + "_FALSE_FALSE", remoteAPIscene.ttt]
subprocess.Popen(args, shell=False, cwd=vrepPath)
I've been leaving a batch job to run overnight where it will spawn vrep, do some calculation, shut down vrep and spawn a new instance over and over. The spawning code works fine in general, but after at least an hour it randomly comes up with this error. Sometimes it can run for several hours before crashing.

Code: Select all

    stack traceback:
[C]: in function 'require'
[string "CHILD SCRIPT remoteApiCommandServer"]:1: in main chunk
no file './lua/remoteApiCommandServer.lua'
no file '/usr/local/share/lua/5.1/lua/remoteApiCommandServer.lua'
no file '/usr/local/share/lua/5.1/lua/remoteApiCommandServer/init.lua'
no file '/usr/local/lib/lua/5.1/lua/remoteApiCommandServer.lua'
no file '/usr/local/lib/lua/5.1/lua/remoteApiCommandServer/init.lua'
no file '/home/ags/vrep/lua/remoteApiCommandServer.lua'
no file '/home/ags/vrep/lua/lua/remoteApiCommandServer.lua'
no file '/home/ags/vrep/BlueWorkforce/lua/remoteApiCommandServer.lua'
no file '/home/ags/vrep/../../scenes/lua/remoteApiCommandServer.lua'
no file './lua/remoteApiCommandServer.so'
no file './liblua/remoteApiCommandServer51.so'
no file '/usr/local/lib/lua/5.1/lua/remoteApiCommandServer.so'
no file '/usr/local/lib/lua/5.1/liblua/remoteApiCommandServer51.so'
no file './lua.so'
no file './liblua51.so'
no file '/usr/local/lib/lua/5.1/lua.so'
no file '/usr/local/lib/lua/5.1/liblua51.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
Any ideas of what could be causing this?

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

The return value of the vrep.simxGetLastErrors() is:

Code: Select all

'Object does not exist. (simGetObjectHandle)'

coppelia
Posts: 7597
Joined: 14 Dec 2012, 00:25

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

Hello,

are you running the latest V-REP version? i.e. 3.6.0?

Cheers

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

Yes, I am running 3.6.0. The getLastErrors() command results may not be related to the crash. I think the error occurs regardless of the crash or not.

coppelia
Posts: 7597
Joined: 14 Dec 2012, 00:25

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

you mention a crash. The reported error messages come from the V-REP status bar, and are not (directly) linked to the crash (btw, what library or file do you include via the require directive?). What does the console print?
Also, can you prepare a minimalistic example that illustrates your crash, so that we can potentially reproduce it easily?

Cheers

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

I include a set of lua functions that I have wrapped so they can be called from the external api.

I'm not sure what the console prints because have a desktop shortcut to launch vrep that does not open a console window. The status bar message is directly linked to the crash. The message says that the lua file with my custom functions cannot be loaded, and therefore my code crashes when I try to call those functions.

I am working on creating a minimal example, but it is taking a while because the crash is non deterministic and generally only happens after several hours.

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

I don't have a minimal example working yet, but I left a reduced sample running overnight and found that vrep has used up 250GB of ram.

https://imgur.com/a/p5le2lt

The top process is vrep, the one underneath is the python code where I continuously connect, create some objects, disconnect and repeat. When I stop simulation and disconnect the world should get reset and not increase in memory usage.

Is this assumption correct or are there resources that I need to free before stopping the simulation and disconnecting?

I will try to get a minimal example of this working.

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

This error comes up in my python program if I launch multiple versions of VREP on the same port and try to connect from multiple python processes.

ALSA lib pcm.c:7963:(snd_pcm_recover) underrun occurred

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

### Re: VREP randomly cannot find remoteApiCommandServer.lua or any related .so libraries

I have a minimum working example. Ubuntu 16.04 64 bit, V-REP 3.6.1 rev1

https://www.dropbox.com/s/r3yitxsum4sr0 ... e.zip?dl=0

extract the zip in the VREP folder containing vrep.sh. run minimumExample.sh. This will launch 8 VREP instances and 8 instances of minimalExample.py each with a unique port. The python code connects to the remoteApiCommandServer, spawns a dummy object and closes the connection in an infinite loop.

If running in headed mode, you will need to close the warning dialogues than appear after vrep first opens, if you comment out the headed mode and uncomment headless mode in minimumExample.py, you don't need to click any dialogues.

The code crashes because python fails to connect after around 1600 seconds on my machine. In my original non minimal example code, it would crash after 2400-2800 seconds.

The code does not break nicely with ctrl-c so use ./minimalExample/killAll.sh which will kill all open vrep and minimalExample.py processes.