Search code examples
azureazure-service-fabric

ServiceFabric Warning "Endpoint with ExplicitPort is within application port range. This can cause port conflicts."


After updating my ServiceFabric cluster to version 6.5, a warning has started popping up for my applications.

Endpoint MyEndpoint with ExplicitPort 27000 is within application port range. This can cause port conflicts. Please select a port from outside application port range.

Why is this error happening and what do I need to do to fix it?


Solution

  • Starting with ServiceFabric 6.5CU2, ServiceFabric started to show warnings for these misconfigurations. These warnings might turn into errors in the future.

    By design static ports should not overlap with application port range specified in the ClusterManifest. If you specify a static port, assign it outside of application port range, otherwise it will result in port conflicts. With release 6.5CU2 we will issue a Health Warning when we detect such a conflict but let the deployment continue in sync with the shipped 6.5 behaviour. However, we may prevent the application deployment from the next major releases.

    (https://learn.microsoft.com/en-gb/azure/service-fabric/service-fabric-service-manifest-resources)

    The application port range is cluster wide and is 20000-30000 by default.

    You can change it e.g. via ARM template or https://resources.azure.com

        "nodeTypes": [
          {
            "name": "nt",
    ...
    
            "applicationPorts": {
              "startPort": 20000,
              "endPort": 30000
            },
    ...
          }
        ],
    

    The static endpoint port can be configured in the servicemanifest.json of your service.

    <?xml version="1.0" encoding="utf-8"?>
    <ServiceManifest ...>
      <Resources>
        <Endpoints>
          <!-- This endpoint is used by the communication listener to obtain the port on which to 
               listen. Please note that if your service is partitioned, this port is shared with 
               replicas of different partitions that are placed in your code. -->
          <Endpoint Name="MyEndpoint" Protocol="http" Port="27000" PathSuffix="/xxx" UriScheme="http" Type="Input" />
        </Endpoints>
      </Resources>
    </ServiceManifest>