Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StartPartitionRestartAsync throws exception on ubuntu #108

Open
PankajkJhaRepo opened this issue Jun 3, 2022 · 0 comments
Open

StartPartitionRestartAsync throws exception on ubuntu #108

PankajkJhaRepo opened this issue Jun 3, 2022 · 0 comments

Comments

@PankajkJhaRepo
Copy link

I have a console app which restarts a servicefabric service . I am using Microsoft.ServiceFabric.Client.IServiceFabricClient to restart any service fabric service. This console app works fine when published as win-x64 to restart servicefabric services deployed on windows but the same application throws exception and does not restart service fabric application when published as linux-x64 on ubuntu VM to restart servicefabric services on ubuntu cluster.

To Reproduce
public async Task Test()
{
try
{
var service = $"{config.Tenant}/{config.ServiceName}";

            var clientTask = new Microsoft.ServiceFabric.Client.ServiceFabricClientBuilder()
                .UseEndpoints(new Uri($"https://{_config.ClusterDNS}:19080"))
                .UseX509Security((ct) =>
                {
                // get the X509Certificate2 either from Certificate store or from file.
                var clientCert = new X509Certificate2("cert.pfx", "");
                    var remoteSecuritySettings = new RemoteX509SecuritySettings(new List<string> { _config.ClusterCertificateThumbPrint });
                    return Task.FromResult<SecuritySettings>(new X509SecuritySettings(clientCert, remoteSecuritySettings));
                })
                .BuildAsync();

            var client = await clientTask;
            var partitionInfo = await client.Partitions.GetPartitionInfoListAsync(service);
            var partitionID = partitionInfo.Data.First().PartitionInformation.Id;
            Console.WriteLine($"partitionID:{partitionID}");

            var restartOperation = Guid.NewGuid();
            await client.Faults.StartPartitionRestartAsync(service, partitionID, restartOperation, Microsoft.ServiceFabric.Common.RestartPartitionMode.AllReplicasOrInstances);

        }
        catch (Microsoft.ServiceFabric.Common.Exceptions.ServiceFabricException ex)
        {
            Console.WriteLine("ErrorCode" + ex.ErrorCode);
            Console.WriteLine("IsTransient" + ex.IsTransient);
            Console.WriteLine("HelpLink" + ex.HelpLink);
            _logger.LogError(ex, "ServiceFabricException");
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "Test error");
        }

    }

Expected behavior
Service fabric service should restart

Additional context
This is exception
2022-06-03 06:14:44.0501|INFO|Program|Start of application
Service url: Galore/VectorStreams
partitionID:5dd33937-a166-4ab0-8f2b-acac463d69cf
2022-06-03 06:14:45.7945|DEBUG|TimescaleMigrationTool.TestClass|partitionID:5dd33937-a166-4ab0-8f2b-acac463d69cf
ErrorCodeUNKNOWN
IsTransientFalse
HelpLink
2022-06-03 06:14:45.8833|ERROR|TimescaleMigrationTool.TestClass|ServiceFabricException Microsoft.ServiceFabric.Common.Exceptions.ServiceFabricException: Null
at Microsoft.ServiceFabric.Client.Http.ServiceFabricHttpClient.SendAsyncHandleUnsuccessfulResponse(Func1 requestFunc, Uri requestUri, String clientRequestId, CancellationToken cancellati onToken) at Microsoft.ServiceFabric.Client.Http.ServiceFabricHttpClient.SendAsync(Func1 requestFunc, String relativeUri, String requestId, CancellationToken cancellationToken)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant