0
votes

So we are using Azure Service Fabric and gets a weird behavior when trying to run API tests against my local development cluster.

Every time I start the test the app gets terminated, sometimes it gets restarted again but most often it just stays terminated (and even deleted from the cluster).

I guess its somehow connected against that when I run the API test it will run and build stuff that the service fabric is using, but since the outcome is different depending on something (maybe the sun?) it feels like I am either missing something or experience a bug with service fabric.

Do anyone have any idea? Consider me as a noob and assume that I have done something wrong myself (I am doing that atleast).

UPDATE

There was a question on how we do run our tests:

  1. Starts 2 instances of Visual Studio
  2. Open the same .sln in both of them
  3. Start the Service Fabric project.
  4. Wait until cluster reports OK.
  5. Run api test through a unit test (both service bus tests and REST tests) with Resharper test runner

Now we get the messages that is attached in diagnostics.

Diagnostics:

Event #1

{   
 "Timestamp": "2018-10-16T08:14:03.0590414+02:00",  
 "ProviderName": "Microsoft-ServiceFabric",   
 "Id": 23083,   
 "Message": ApplicationHostTerminated:   ApplicationId=fabric:/<MyService>,      ServiceName=fabric:/<MyService>,  ServicePackageName=<MyPackage>,      ServicePackageActivationId=8f36ac97-9271-4a49-94ce-dd296aebffa5,      IsExclusive=True,  CodePackageName=Code,  EntryPointType=Exe,      ExeName=MyExe,  ProcessId=24568, HostId=d2a820b5-5b4d-42af-ae87-350028a3fa72,  ExitCode=3221225786, UnexpectedTermination=False,  StartTime=10/16/2018 08:12:14. ",  
 "ProcessId": 22660,   
 "Level": "Informational",   
 "Keywords": "0x4000000000000001",   
 "EventName": "Hosting",   
 "ActivityID": null, 
 "RelatedActivityID": null,   
 "Payload": {
     "eventInstanceId": "\"07f15452-2f75-49e3-ad5d-d16ea49bdc8f\"",
     "applicationName": "MyAppName",
     "ServiceName": "fabric:/MyServiceName",
     "ServicePackageName": "MyPackageName",
     "ServicePackageActivationId": "8f36ac97-9271-4a49-94ce-dd296aebffa5",
     "IsExclusive": true,
     "CodePackageName": "Code",
     "EntryPointType": 1,
     "ExeName": "MyExe",
     "ProcessId": 24568,
     "HostId": "d2a820b5-5b4d-42af-ae87-350028a3fa72",
     "ExitCode": 3221225786,
     "UnexpectedTermination": false,
     "StartTime": "\"\/Date(1539670334917)\/\""   
 } 
}

Event #2

{   
 "Timestamp": "2018-10-16T08:14:02.3557708+02:00",  
 "ProviderName": "Microsoft-ServiceFabric",   
 "Id": 29625,   
 "Message": "Application deleted: Application = fabric:/MyApp, Application Type = MyServiceType ",   
 "ProcessId": 22660,   
 "Level": "Informational",  
 "Keywords": "0x4000000000000001",   
 "EventName": "CM",   
 "ActivityID": null,   
 "RelatedActivityID": null,   
 "Payload": {
     "eventInstanceId": "\"ca608cec-8d55-4606-a331-8ebfcfff8fa6\"",
     "applicationName": "fabric:/MyAppName",
     "applicationTypeName": "MyAppTypeName",
     "applicationTypeVersion": "1.0.0"   
 } 
}
1
Can you provide a bit more information of how do you execute API test? For example: 1) build & deploy application on local cluster. 2) run my the testing tool.Oleg Karasik
Sure, i have updated the question.Mikael Johansson
Are you starting the Service Fabric project through the F5? Does this situation happen if you publish the Service Fabric project to local cluster (using Publish functionality) and then run the tests?Oleg Karasik
Correct I start through F5. We want to have the debugger on when doing this when for example investigating a bug.Mikael Johansson
And regarding publish, that works as long as I dont attach the debuggerMikael Johansson

1 Answers

2
votes

I think you can experience a side effect of Application Debug Mode set for your .sfproj.

By default Application Debug Mode is set to Refresh Application (which if you are using 5-node cluster is automatically changed to Remove Application) or Remove Application debug mode. This instructs Visual Studio to recreate the application for each debugging session and remove it when session ends.

Changing it to Keep Application should prevent the Visual Studio from recreating the application during debugging session.