python client of B0-based remote API crashed

Report crashes, strange behaviour, or apparent bugs
Post Reply
doctorsrn
Posts: 2
Joined: 26 Apr 2019, 09:35

python client of B0-based remote API crashed

Post by doctorsrn »

My environment :
  • Windows 10 x64 version
  • python 3.6.8 client-side
  • v-rep pro edu Version 3.6.1 (rev .3)
I use B0-based remote API as client-side to build my program. And when I using simxCallScriptFunction function to call server-side functions from non-thread child scripts, the client program always show the following errors:
Traceback (most recent call last):
File "b0_drl.py", line 113, in <module>
client.simxDefaultPublisher())
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 44, in __exit__
self._handleFunction('Ping',[0],self.simxDefaultSubscriber(self._pingCallback))
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 118, in simxDefaultSubscriber
self._handleFunction('setDefaultPublisherPubInterval',[topic,publishInterval],channel)
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 70, in _handleFunction
rep = msgpack.unpackb(self._serviceClient.call(packedData))
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0.py", line 234, in call
rep_bytes = bytearray(outarr.contents)
ValueError: NULL pointer access
2019-04-29 09:10:15 error: HB: Context was terminated
code at line 113 is:

Code: Select all

client.simxCallScriptFunction('findPath_goalIsPose1@remoteApiCommandServer',
                           'sim.scripttype_childscript',
                           [inInts, inFloats],
                           client.simxDefaultPublisher())
                        #    client.simxServiceCall())
I try to use client.simxServiceCall() instead of client.simxDefaultPublisher(), the following errors will arise:
Traceback (most recent call last):
File "b0_drl.py", line 114, in <module>
client.simxServiceCall())
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 196, in simxCallScriptFunction
return self._handleFunction(funcName,reqArgs,topic)
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 70, in _handleFunction
rep = msgpack.unpackb(self._serviceClient.call(packedData))
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0.py", line 234, in call
rep_bytes = bytearray(outarr.contents)
ValueError: NULL pointer access

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "b0_drl.py", line 114, in <module>
client.simxServiceCall())
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 44, in __exit__
self._handleFunction('Ping',[0],self.simxDefaultSubscriber(self._pingCallback))
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 118, in simxDefaultSubscriber
self._handleFunction('setDefaultPublisherPubInterval',[topic,publishInterval],channel)
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0RemoteApi.py", line 70, in _handleFunction
rep = msgpack.unpackb(self._serviceClient.call(packedData))
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0.py", line 231, in call
outbuf = b0_service_client_call(self._cli, buf, sz, ct.byref(outsz))
File "C:\Sam\Robotics\V-rep\Vrep_Python\python_b0\b0.py", line 31, in <lambda>
globals()[n] = lambda *args2: _dec(globals()['_' + n](*[_enc(arg, t) for t, arg in zip(args, args2)]), ret)
OSError: [WinError -529697949] Windows Error 0xe06d7363
2019-04-29 09:26:00 error: HB: Context was terminated

I found that if the function be called by client program through simxCallScriptFunction need long time to execute, the above errors will arise.

Here is my scene file and main client program b0_drl.py: https://drive.google.com/drive/folders/ ... sp=sharing

Do you know the reason/solution?

Thanks.

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: python client of B0-based remote API crashed

Post by coppelia »

Hello,

this is because you call a function that blocks. Currently there is a connection timeout of 1 second, which is too little. You can modify the timeout value in b0RemoteApi.py, around line 25.
In next release that timeout will be one optional argument when starting the B0-based remote API.

Cheers

doctorsrn
Posts: 2
Joined: 26 Apr 2019, 09:35

Re: python client of B0-based remote API crashed

Post by doctorsrn »

Hello,
I modify the timeout value around line 25 in b0RemoteApi.py, and it works. Thanks for your help.

Post Reply