Shared Memory problem when using 'simxCallScriptFunction'

Report crashes, strange behaviour, or apparent bugs
Post Reply
sjames
Posts: 23
Joined: 23 Nov 2016, 18:53

Shared Memory problem when using 'simxCallScriptFunction'

Post by sjames »

Hi,

I believe I have found a bug, but if I have missed something, then I apologise in advanced.

The issue is when calling 'simxCallScriptFunction' from python when using shared memory, and the function itself does a lot of computation.

The bug can be reproduced by simply having a script function like so:

Code: Select all

test=function(inInts,inFloats,inStrings,inBuffer)
    for i=1,99999,1 do
        print(i)
    end
    return {1},{},{},''
end
and then calling this from Python using 'simxCallScriptFunction'. The function on the Python side will hang; specifically when calling 'c_CallScriptFunction(...)'.

I have made sure that my port number <0, and have set a high negative timeout (e.g. -50000).

Note, that when I use port communication, it works fine. Perhaps there is timeout happening with shared memory?

Also of note, when I set 'doNotReconnectOnceDisconnected=False' when connected via shared memory, I get the following after the loop in the script finishes:

Connect (0): Failed to open the shared memory "/LocalVREP_REMOTE_API00001"

Thanks!

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

Re: Shared Memory problem when using 'simxCallScriptFunction'

Post by coppelia »

Hello James,

indeed, there is something fishy...
Thanks for pointing this out.

Cheers

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

Re: Shared Memory problem when using 'simxCallScriptFunction'

Post by coppelia »

can you tell me which platform you are running on?

Cheers

sjames
Posts: 23
Joined: 23 Nov 2016, 18:53

Re: Shared Memory problem when using 'simxCallScriptFunction'

Post by sjames »

Hi,

I am running on Linux (Ubuntu 18.04).
Anything I can help with?

Also, on a related note, is it possible to support multiple instances when using shared memory? I.e. is it possible to allocate a portion of the memory, so that another instance can have another portion?

Cheers

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

Re: Shared Memory problem when using 'simxCallScriptFunction'

Post by coppelia »

Thanks,

normally you can have several shared memory remote API clients by specifying each time a different, negative port number (i.e. similar to creating several clients when using socket communication).

Cheers

Post Reply