Skip to content

Report correct port even when dynamically allocated #297

@davidjsherman

Description

@davidjsherman

The services launcher reports the requested port regardless of which port was actually allocated by the operating system.

When launching several service instances on the same machine, it is better to allow the OS to dynamically choose a port from the IANA ephemeral range, than to guess at what port numbers haven't been used. Tornado will happily bind an ephemeral port if port 0 is requested.

To verify that this works with poppy-services, run

$ poppy-services --poppy-simu --http --http-port 0 poppy-ergo-jr &
$ sleep 10 ; ss -tlp
State  Recv-Q Send-Q Local Address:Port   Peer Address:Port                                         
LISTEN 0      128          0.0.0.0:42961       0.0.0.0:*     users:(("poppy-services",pid=70,fd=7)) 
LISTEN 0      128             [::]:42961          [::]:*     users:(("poppy-services",pid=70,fd=8)) 

The services launcher should retrieve the list of bound sockets from Tornado, instead of reporting the port that was requested

if args.http or args.poppy_simu: msg+= ' http_port={},'.format(args.http_port)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions