MacOSX - number of ports increasing with every SimStart

Report crashes, strange behaviour, or apparent bugs
Post Reply
el_Raimundo

MacOSX - number of ports increasing with every SimStart

Post by el_Raimundo »

Hello,
I am using v-rep to evaluate controllers in an evolutionary setup, so simulations are started and stopped repeatedly thousands of times in succession.

Because simulation speed is decreasing in the course of this process without any apparent reason, I was watching closely for anything suspicious and I noticed that the number of ports used by v-rep is increasing with every start of the simulation (by about 10 as can be seen in OSX's activity monitor). What is referred to as 'ports' here as far as I can see is not related to communication ports for the remote API but rather to interprocess communication, as in https://developer.apple.com/library/mac ... -TPXREF104

This effect also occurs with a clean v-rep install and an empty scene, so it's apparently unrelated to the plugin that I'm working on. I am not sure if this explains the decrease in simulation speed, and even if, starting and stopping the simulation thousands of times is a special case that might not apply to many users, but I hope you don't mind me bringing this to your attention.
Thanks in any case,
raimund

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

Re: MacOSX - number of ports increasing with every SimStart

Post by coppelia »

Hello Raimund,

can you tell me what OS X version you are running? Can you try to temporarily disable all the V-REP plugins and see if the problem persists? (you can disable the plugins by temporarily moving all vrep.app/Content/MacOSX/libv_repExt*.dylib files to a different folder).

Cheers

el_Raimundo

Re: MacOSX - number of ports increasing with every SimStart

Post by el_Raimundo »

Hello,
I'm using OSX 10.10.3 (Yosemite).
I just tried with all the plugins removed, and the number of ports still jumps by about 10-20 with every simulation start/stop cycle. What I did not test though right now, is if that actually contributes to the loss of simulation speed over time.

reenabling the remote API plugin allows me to be really mean and do something like this in python:

Code: Select all

import vrep
from time import sleep

if __name__ == '__main__':
    clientID = vrep.simxStart('127.0.0.1', 19997, True, False, 500, 5)
    for i in range(10000):
        vrep.simxStartSimulation(clientID, vrep.simx_opmode_oneshot)
        sleep(0.2)
        vrep.simxStopSimulation(clientID, vrep.simx_opmode_oneshot)
        sleep(0.2) 
    vrep.simxFinish(clientID)        
    print 'done'                   
with the effect that quickly 10000+ ports are shown as being used by vrep in activity monitor

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

Re: MacOSX - number of ports increasing with every SimStart

Post by coppelia »

Thanks for the precisions.
We'll look into this.

Cheers

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

Re: MacOSX - number of ports increasing with every SimStart

Post by coppelia »

I have juste tested V-REP PRO EDU 3.2.1 on Yosemite, starting and stopping a simulation 30-50 times in a row. The port number in the activity monitor stays stable around 200-250. On Mavericks I obtain the same results.
Do you have a special configuration of V-REP, a specific simulation, or a special configuration of your OS?

Cheers

el_Raimundo

Re: MacOSX - number of ports increasing with every SimStart

Post by el_Raimundo »

I used an empty scene and I can't think of anything out of the ordinary as far as my system is concerned.

However I missed that in v-vep I had work threads enabled.
(forgot that this setting is not saved with the scene but stored in usrset).
And indeed, that seems to be the issue:

when I disable them, the port count stays stable also on my system.

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

Re: MacOSX - number of ports increasing with every SimStart

Post by coppelia »

Indeed!

I have looked into the work thread code, but it seems everything is properly done there (threads and locks are properly released). Qt functions are used, maybe there is some issue with them on MacOSX?
In any case, we usually do not recommend to use the work threads, unless you are doing heavy sensing operations in your scene.

Cheers

el_Raimundo

Re: MacOSX - number of ports increasing with every SimStart

Post by el_Raimundo »

Unfortunately I cant tell if the bug could be qt-related.
For now I'll keep work threads disabled as recommended, and hope that performance is not too much affected.
maybe you can come up with a fix in some future release.
in any case,
thanks for looking into this!

Post Reply