Page 1 of 3

Crash while starting a scene (work on different computer)

Posted: 24 Apr 2014, 11:20
by zweifel
Hi,

I am using a remote Api with a continuous remote server. It works perfectly on one computer, but when I tried to move to a faster computer the V-Rep starts to crash when I try to load a given scene with the following command:
int error_code=simxLoadScene(clientID,scene_path,1, simx_opmode_oneshot_wait);

If you need more information I will be glad to provide.
The log and version are pasted below:

Version: V-REP_PRO_EDU_V3_1_1_64_Linux

Log:

Code: Select all

Add-on script 'vrepAddOnScript-addOnScriptDemo.lua' was loaded.
Simulator launched.
Plugin 'Dynamics': loading...
Plugin 'Dynamics': load succeeded.
Plugin 'BubbleRob': loading...
Plugin 'BubbleRob': load succeeded.
Plugin 'Collada': loading...
Plugin 'Collada': load succeeded.
Plugin 'K3': loading...
Plugin 'K3': load succeeded.
Plugin 'Mtb': loading...
Plugin 'Mtb': load succeeded.
Plugin 'ReflexxesTypeIV': loading...
Plugin 'ReflexxesTypeIV': load succeeded.
Plugin 'RemoteApi': loading...
Starting a remote API server on port 19997
Plugin 'RemoteApi': load succeeded.
Plugin 'Ros': loading...
Plugin 'Ros': load failed (could not load). The plugin probably couldn't load dependency libraries. Try 'ldd pluginName.so' for more infos, or simply rebuild the plugin.
Plugin 'SimpleFilter': loading...
Plugin 'SimpleFilter': load succeeded.
Plugin 'Urdf': loading...
Plugin 'Urdf': load succeeded.
Plugin 'Vision': loading...
Plugin 'Vision': load succeeded.
Using the internal 'MeshCalc' functionality.
Using the 'Dynamics' plugin.
Using the internal 'PathPlanning' functionality.
./vrep.sh: line 24: 15924 Segmentation fault      "$dirname/$appname" "$@"

Re: Crash while starting a scene (work on different computer

Posted: 24 Apr 2014, 21:14
by coppelia
Hello,

can you turn on all the debug options, and try again? Then please send us the generated log file (debugLog.txt)

Cheers

Re: Crash while starting a scene (work on different computer

Posted: 25 Apr 2014, 03:08
by zweifel
Thanks for the fast reply!

I turned on all the debug options, but let the frustrum culling, distance caching and collision caching on.

The log is very big, I did not find how to attach files here (3.5M bytes) so I am posting the last part of debugLog.txt:

Code: Select all

00054897 --> (SIM C API) simGetBooleanParameter_internal
00054897 <-- (SIM C API) simGetBooleanParameter_internal
00054897 --> (SIM C API) simSetBooleanParameter_internal
00054897 <-- (SIM C API) simSetBooleanParameter_internal
00054897 --> (SIM C API) simLoadScene_internal
00054897 $$S 0,0,1,0 (SIM) 'locking for write' (simLoadScene_internal)
00054897 $$S
00054897 $$S +++++++++++++++++++++++++++++++++++++++++++++++++++++++
00054897 $$S +++++++++++++++++++++++++++++++++++++++++++++++++++++++
00054897 $$S 0,0,1,1 (SIM) 'locked for write' (simLoadScene_internal)
00054897 --> (SIM FUNC) loadScene
00054897 --> (SIM FUNC) closeDlg
00054897 --> (GUI FUNC) __closeDlg
00054897 <-- (GUI FUNC) __closeDlg
00054897 <-- (SIM FUNC) closeDlg
00054897 --> (SIM FUNC) newSceneProcedure
00054897 <-- (SIM FUNC) newSceneProcedure
00054900 ... (SIM) (setParent) 'easy unlocking'
00054900 ... (SIM) (setParent) 'easy unlocked'
00054900 ... (SIM) (setParent) 'easy locking'
00054900 ... (SIM) (setParent) 'easy locked'
00054900 ... (SIM) (setParent) 'easy unlocking'
00054900 ... (SIM) (setParent) 'easy unlocked'
00054901 ... (SIM) (setParent) 'easy locking'
00054901 ... (SIM) (setParent) 'easy locked'
00054901 ... (SIM) (setParent) 'easy unlocking'
00054901 ... (SIM) (setParent) 'easy unlocked'
00054901 ... (SIM) (setParent) 'easy locking'
00054901 ... (SIM) (setParent) 'easy locked'
00054902 ... (SIM) (setParent) 'easy unlocking'
00054902 ... (SIM) (setParent) 'easy unlocked'
00054903 ... (SIM) (setParent) 'easy locking'
00054903 ... (SIM) (setParent) 'easy locked'
00054903 ... (SIM) (setParent) 'easy unlocking'
00054903 ... (SIM) (setParent) 'easy unlocked'
00054903 ... (SIM) (setParent) 'easy locking'
00054903 ... (SIM) (setParent) 'easy locked'
00054904 ... (SIM) (setParent) 'easy unlocking'
00054904 ... (SIM) (setParent) 'easy unlocked'
00054904 ... (SIM) (setParent) 'easy locking'
00054904 ... (SIM) (setParent) 'easy locked'
00054904 --> (SIM FUNC) removeCollisionInformation
00054904 <-- (SIM FUNC) removeCollisionInformation
00054905 --> (SIM FUNC) removeCollisionInformation
00054905 <-- (SIM FUNC) removeCollisionInformation
I do not know if it helps, but the final portion of the information displayed on the terminal is a bit different:

Code: Select all

00033065 ... (GUI) (display) 'easy unlocking'
00033065 ... (GUI) (display) 'easy unlocked'
00033065 ... (GUI) (display) 'easy locking'
00033065 ... (GUI) (display) 'easy locked'
00033065 ... (GUI) (drawAll) 'easy unlocking'
00033065 ... (GUI) (drawAll) 'easy unlocked'
00033065 ... (GUI) (drawAll) 'easy locking'
00033065 ... (GUI) (drawAll) 'easy locked'
00033065 ... (GUI) (drawAll) 'easy unlocking'
00033065 ... (GUI) (drawAll) 'easy unlocked'
00033065 ... (GUI) (drawAll) 'easy locking'
00033065 ... (GUI) (drawAll) 'easy locked'
00033065 ... (GUI) (visualizeCommunications) 'easy unlocking'
00033065 ... (GUI) (visualizeCommunications) 'easy unlocked'
00033065 ... (GUI) (visualizeCommunications) 'easy locking'
00033065 ... (GUI) (visualizeCommunications) 'easy locked'
00033065 <-- (GUI FUNC) drawObjects
00033065 --> (GUI FUNC) drawOverlay
00033065 <-- (GUI FUNC) drawOverlay
00033082 <-- (GUI FUNC) lookIn
00033082 <-- (GUI FUNC) render
00033082 <-- (GUI FUNC) render
00033086 <-- (GUI FUNC) renderCurrentPage
00033086 <-- (GUI FUNC) render
00033100 <-- (GUI FUNC) renderOpenGlContent_callFromRenderingThreadOnly
00033100 $$R 0,0,0,0 (GUI) 'unlock for read' (uiThread_renderScene)
00033100 <-- (GUI FUNC) uiThread_renderScene
00033100 $$R 0,0,0,0 (GUI) 'try to lock for read' (DEBUG_TO_FILE_DEBUG_CMD)
00033100 $$R 1,0,0,0 (GUI) 'locked for read' (DEBUG_TO_FILE_DEBUG_CMD)
./vrep.sh: line 24: 15845 Segmentation fault      "$dirname/$appname" "$@"
Trying to dig deeper into the problem, I tried a couple of things without result:
  • Downloaded again the 64 bit linux version and tried it out.
  • Downloaded the 32 bit linux version and tried it out.
  • Tried loading a different scene in different locations (relative and absolute paths), but it always crash
  • When loading scenes using the GUI, all the scenes loaded and even the controlTypeExample.ttt was able to work perfectly with the remoteAPI, so I believe it is something related to the continuous server.
  • Enabling frustrum culling, distance caching and collision caching does not help
  • The simxLoadScene() returns a error which does not match with any of the simx_* errors. The error number is 3.

Re: Crash while starting a scene (work on different computer

Posted: 25 Apr 2014, 09:12
by coppelia
Thanks for testing this.

Actually only the last few hundred lines of the log will be needed. In what you sent me it seems the crash occured at the moment when you tried to disable sending the debug info to the file.. or afterwards..
Could you try again but keeping the send debug info to file on all the way.

A remote API return code 3 is a combination of return codes 1 and 2 (i.e. no value flag and timeout flag)

Cheers

Re: Crash while starting a scene (work on different computer

Posted: 25 Apr 2014, 13:26
by zweifel
The debug for the computer where the vrep crashes:

Code: Select all

00006670 --> (SIM C API) simGetBooleanParameter_internal
00006670 <-- (SIM C API) simGetBooleanParameter_internal
00006670 --> (SIM C API) simSetBooleanParameter_internal
00006670 <-- (SIM C API) simSetBooleanParameter_internal
00006670 --> (SIM C API) simLoadScene_internal
00006670 $$S 0,0,1,0 (SIM) 'locking for write' (simLoadScene_internal)
00006670 $$S
00006670 $$S +++++++++++++++++++++++++++++++++++++++++++++++++++++++
00006670 $$S +++++++++++++++++++++++++++++++++++++++++++++++++++++++
00006670 $$S 0,0,1,1 (SIM) 'locked for write' (simLoadScene_internal)
00006670 --> (SIM FUNC) loadScene
00006670 --> (SIM FUNC) closeDlg
00006671 --> (GUI FUNC) __closeDlg
00006671 <-- (GUI FUNC) __closeDlg
00006671 <-- (SIM FUNC) closeDlg
00006671 --> (SIM FUNC) newSceneProcedure
00006671 <-- (SIM FUNC) newSceneProcedure
00006673 ... (SIM) (setParent) 'easy unlocking'
00006673 ... (SIM) (setParent) 'easy unlocked'
00006674 ... (SIM) (setParent) 'easy locking'
00006674 ... (SIM) (setParent) 'easy locked'
00006674 ... (SIM) (setParent) 'easy unlocking'
00006674 ... (SIM) (setParent) 'easy unlocked'
00006674 ... (SIM) (setParent) 'easy locking'
00006674 ... (SIM) (setParent) 'easy locked'
00006675 ... (SIM) (setParent) 'easy unlocking'
00006675 ... (SIM) (setParent) 'easy unlocked'
00006675 ... (SIM) (setParent) 'easy locking'
00006675 ... (SIM) (setParent) 'easy locked'
00006676 ... (SIM) (setParent) 'easy unlocking'
00006676 ... (SIM) (setParent) 'easy unlocked'
00006676 ... (SIM) (setParent) 'easy locking'
00006676 ... (SIM) (setParent) 'easy locked'
00006677 ... (SIM) (setParent) 'easy unlocking'
00006677 ... (SIM) (setParent) 'easy unlocked'
00006677 ... (SIM) (setParent) 'easy locking'
00006677 ... (SIM) (setParent) 'easy locked'
00006677 ... (SIM) (setParent) 'easy unlocking'
00006677 ... (SIM) (setParent) 'easy unlocked'
00006678 ... (SIM) (setParent) 'easy locking'
00006678 ... (SIM) (setParent) 'easy locked'
00006678 --> (SIM FUNC) removeCollisionInformation
00006678 <-- (SIM FUNC) removeCollisionInformation
00006679 --> (SIM FUNC) removeCollisionInformation
00006679 <-- (SIM FUNC) removeCollisionInformation
I mentioned that it worked on a different computer right? So I was not completely correct. I just find out that after loading scenes and unloading around 500 times, the application returns also the error 3 (I need to load and unload the scene around 100000 or more times, so 500 is a small number for my application).
So both computers have the same error being returned, but in one vrep crashes and the other it just continues and my code cannot initialize a scene. I am not sure but it might be because a request to stop the simulation did not work and therefore the scene cannot be loaded on top of a simulation already running. Do you think that in this case the error 3 would be returned?

Re: Crash while starting a scene (work on different computer

Posted: 25 Apr 2014, 17:25
by coppelia
Any chance you can send us a minimalistic remote API client with associated scene where that happens?

Re: Crash while starting a scene (work on different computer

Posted: 27 Apr 2014, 04:03
by zweifel
I am trying to create a minimalistic code to show the problem.

Just wondering if the problem with the crash is not related with a lack of some library used by simxLoadScene(). Tomorrow I will do a test without any GUI in vrep to see if the problem persist. Can you tell me if there is any library which I should have to use the binary for the linux?

Another thing, how can I set/change the employed physics library with the remote API?

Re: Crash while starting a scene (work on different computer

Posted: 27 Apr 2014, 12:04
by coppelia
There is no additional specific library needed when using that function.

You can change the physics engine via the simSetIntegerParameter or simxSetIntegerParameter functions: simSetIntegerParameter(sim_intparam_dynamic_engine,x). The doc is wrong about that parameter: you should also be able to write it (when simulation is not running though).

One thing that came to my mind: when you stop a simulation via simStopSimulation or via simxStopSimulation, then simulation will not instantaneously stop, refer to the diagram here: several simulation passes will still occure until it is stopped. So, before sending commands that require a simulation to be in the stopped state, make sure it is really in that state (e.g. via simGetSimulationState or via simxGetInMessageInfo(clientId,simx_headeroffset_server_state,&info))

Cheers

Re: Crash while starting a scene (work on different computer

Posted: 28 Apr 2014, 13:30
by zweifel
Thanks for all the detailed information.

So I did the test without the GUI. I was surprised to see vrep not crashing without the GUI !!
It is running until now, I guess it will run until the error 3 appears, as in the other computer.

Now everytime I try to stop the simulation, I check the return_value and try to stop again in case of failure:

Code: Select all

                        int error_code= simxStopSimulation(clientID, simx_opmode_oneshot_wait);
                        while(error_code!=simx_return_ok)
                        {
                                printf("error while trying to stop the simulation%d\n",error_code);
                                printError(error_code);

                                error_code= simxStopSimulation(clientID, simx_opmode_oneshot_wait);
                        }
However, in yesterday's testing the failure remained while starting a new scene. A similar loop is used to try to start a scene again, but the failure persists. I do not remember if when I looked at the GUI if the simulation was or not stopped though.

I wonder if instead of being the simulation which is not stopping if it is not the socket connection which is terminated. I will try to check the connections when the problem occur.

Re: Crash while starting a scene (work on different computer

Posted: 29 Apr 2014, 14:37
by zweifel
I created and just sent the minimalist code to you guys.

This time the error 3 happened while trying to stop the simulation and it continued forever inside the loop, the application was not able to finish it. I checked the socket connection when the error occured and everything seemed alright.

The error may be related somehow with the GUI