Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The primary or stateless instance for the partition has invalid address

Tags:

I created a stateful service with the out-of-the-box partitioning:

<StatefulService ServiceTypeName="ExamplesServiceType" TargetReplicaSetSize="[ExamplesService_TargetReplicaSetSize]" MinReplicaSetSize="[ExamplesService_MinReplicaSetSize]">
            <UniformInt64Partition PartitionCount="[ExamplesService_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
         </StatefulService>

The service manifest sets the params to (out-of-the-box as well):

 <Parameter Name="ExampleService_PartitionCount" Value="1" />
 <Parameter Name="ExampleService_MinReplicaSetSize" Value="2" />
 <Parameter Name="ExampleService_TargetReplicaSetSize" Value="3" />
 <Parameter Name="WebService_InstanceCount" Value="1" />

Now I want to call to to my stateful service from my stateless service in the same cluster:

 ServiceUriBuilder builder = new ServiceUriBuilder(ExampleServiceName);
 var service = ServiceProxy.Create<IExampleService>(builder.ToUri(),new ServicePartitionKey(1));

 return service.MyCallAsync(id);

I'm getting the following error:

The primary or stateless instance for the partition 'a67f7afa-3370-4e6f-ae7c-15188004bfa1' has invalid address, this means that right address from the replica/instance is not registered in the system

The stateful service I'm trying to reach logs to the event logs and the logs carry "partitionId": "a67f7afa-3370-4e6f-ae7c-15188004bfa1".

What am I missing?

like image 949
tymtam Avatar asked Apr 13 '16 07:04

tymtam


2 Answers

I wasn't registering a remote as explained at http://vunvulearadu.blogspot.com/2016/04/azure-service-fabric-primary-or.html

        protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
    {
        return new[] { new ServiceReplicaListener(context => this.CreateServiceRemotingListener(context)) };
    }
like image 188
tymtam Avatar answered Oct 12 '22 13:10

tymtam


In case anyone else comes here wondering what to do for stateless services, this works for me:

protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
    return new[] { new ServiceInstanceListener(context => this.CreateServiceRemotingListener(context)) };
}
like image 27
KPERI Avatar answered Oct 12 '22 14:10

KPERI