ZMQ remote api - always starts in port 19997

Report crashes, strange behaviour, or apparent bugs
Post Reply
Mildred34
Posts: 19
Joined: 12 May 2023, 16:03

ZMQ remote api - always starts in port 19997

Post by Mildred34 »

Hello,

When I launch coppeliaSim, I add this parameter : -GzmqRemoteApi.rpcPort=23006
I launched several simulators with the port being 23000+i*2 with the index of the simulator.

On the last rev, i've seen that all the ZMQ remote servers were launched in the 19997 port...

Does the set-up to configure zmq port has changed or is this a bug ?

Logs within coppeliasim:

Code: Select all

[RemoteApi:loadinfo] starting a remote API server on port 19997
[sandboxScript:info] Simulator launched, welcome! 
[Connectivity >> WebSocket remote API server@addOnScript:error] 124: in sim.genericFunctionHandler: Address already in use
stack traceback:
    [C]: in function 'simWS.start'
    [string "Connectivity >> WebSocket remote API server@a..."]:124: in function 'sysCall_init'
[Connectivity >> ZMQ remote API server@addOnScript:error] .../CoppeliaSim_Edu_V4_6_0_rev10_Ubuntu22_04/lua/simZMQ.lua:4: Address already in use
stack traceback:
    [C]: in function 'error'
    .../CoppeliaSim_Edu_V4_6_0_rev10_Ubuntu22_04/lua/simZMQ.lua:4: in field '?'
    .../CoppeliaSim_Edu_V4_6_0_rev10_Ubuntu22_04/lua/simZMQ.lua:171: in function 'simZMQ.__raise'
    .../CoppeliaSim_Edu_V4_6_0_rev10_Ubuntu22_04/lua/simZMQ.lua:10: in field '?'
    .../CoppeliaSim_Edu_V4_6_0_rev10_Ubuntu22_04/lua/simZMQ.lua:172: in function 'simZMQ.bind'
    [string "Connectivity >> ZMQ remote API server@addOnSc..."]:555: in function 'sysCall_init'
I thought that default port was 23000 btw. Strange to see it on 19997.

Cheers,

Alexis

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

Re: ZMQ remote api - always starts in port 19997

Post by coppelia »

Hello Alexis,

port 19997 is for the legacy remote API, not the ZeroMQ remote API. Maybe that should be hidden, indeed.

Cheers

Mildred34
Posts: 19
Joined: 12 May 2023, 16:03

Re: ZMQ remote api - always starts in port 19997

Post by Mildred34 »

When I do a netstat -ltnp, I got this result :

Code: Select all

tcp        0      0 0.0.0.0:19997           0.0.0.0:*               LISTEN      60891/coppeliaSim   
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1037/cupsd          
tcp        0      0 0.0.0.0:23000           0.0.0.0:*               LISTEN      60891/coppeliaSim  
So I got the warning for the legacy remote API, ok I understand.
But why, they don't connect to the ZMQ remote API (the second warning), I set up another port for every simulation.
Here I can only see the first simulator connect to the port 23000.

They want to connect to the default port 23000 whereas I launched them with the parameter GzmqRemoteApi.rpcPort.

I discovered something even more strange. When I launch a simulator with a port different than 23000.
My program got stuck at :

Code: Select all

self.sim = self.client.require("sim")
And this is because, the zmq server got stuck at the port 23000. I can't set it on a different port.
If I do a sim.setNamedStringParam(string paramName, buffer stringParam) within the simulator, I can change it. But it won't change the port from the shell script parameters.

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

Re: ZMQ remote api - always starts in port 19997

Post by coppelia »

Damn, we introduced a bug in rev.10
Will post rev14 by the end of the day.

A temp. workaround is to add two dummy chars as prefix:

instead of -GzmqRemoteApi.rpcPort, use -GxxzmqRemoteApi.rpcPort

Cheers

Mildred34
Posts: 19
Joined: 12 May 2023, 16:03

Re: ZMQ remote api - always starts in port 19997

Post by Mildred34 »

Happy to see, that you can reproduce the bug xD
Thanks for the workaround !

Cheers

Post Reply