Freeze on KSP .21 Mac
mmuszynski opened this issue ยท 13 comments
Rich, fantastic plugin. Was testing some interfacing with an iPad this evening and noticed that sometimes KSP on my Mac will freeze when ending a mission. This happens after Telemachus stops sending data to the iPad as well. Here's the steps to reproduce:
- Load KSP and craft for launch
- Start flying
- Wait until Telemachus stops relaying data
- Attempt to end or revert the mission
- By this point the KSP instance has locked up and will not respond
Thanks for the report.
Could I just ask which version you are using (It is displayed on the About tab of the Telemachus landing page)?
I'm not at my computer right now, but I have tried both the version currently on Spaceport and the version downloaded from the dropbox last night. In addition, the dropbox version doesn't ever send me successfully to the landing page, rather just to the 404.
Rich, the version that's installed currently is 1.4.6.0 according to the Telemachus server running through the game.
Thanks, I will take a look at this problem next week because this week is going to horrendous.
Sounds good. Is there any other info that I can give? Debug reports or anything else?
On Sep 21, 2013, at 5:27 AM, Richard Bunt [email protected] wrote:
Thanks, I will take a look at this problem next week because this week is going to horrendous.
โ
Reply to this email directly or view it on GitHub.
Did a little bit more looking at this. Looks like the freeze happens after I lose my Telemachus link (possibly because the server has crashed?) when my iPad app asks for data too frequently. I changed the time between requests from .25s to 1.0s, and things appear to be working better.
Was I maybe perpetrating a DDoS on my own Telemachus server?
EDIT: I lied, there seems to still be an issue if I leave the server running for long enough.
Sure, but running more tests and it looks like it happens sometimes even without polling at all. Are there more debug settings that I can use to get a better idea of what's going on? Let's see if this formats properly:
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%@/telemachus/datalink?throttle=f.throttle&velocity=v.surfaceVelocity&altitude=v.altitude", _ipAddressField.text, _portField.text]]];
[request setTimeoutInterval:2];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error){
if(!data) {
[_telemetryWarningLabel setText:@"Lost Connection to Telemachus Server!"];
[_telemetryWarningLabel setTextColor:[UIColor redColor]];
NSLog(@"No Data Bailing out");
[telemetryTimer invalidate];
telemetryTimer = [NSTimer timerWithTimeInterval:10 target:self selector:@selector(getTelemetryData:) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:telemetryTimer forMode:NSDefaultRunLoopMode];
return;
} else {
if( ![telemetryTimer isValid] ) {
telemetryTimer = [NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(getTelemetryData:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:telemetryTimer forMode:NSDefaultRunLoopMode];
}
}
id telemetry = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
if ([[telemetry objectForKey:@"throttle"] floatValue] > 1.00) {
[_telemetryWarningLabel setText:@"Invalid Telemetry Data -- Check Source"];
[_telemetryWarningLabel setTextColor:[UIColor redColor]];
[_throttleLabel setText:[NSString stringWithFormat:@"--"]];
[_velocityLabel setText:[NSString stringWithFormat:@"--"]];
[_altitudeLabel setText:[NSString stringWithFormat:@"--"]];
} else {
[_telemetryWarningLabel setText:@"Receiving Valid Data"];
[_telemetryWarningLabel setTextColor:[UIColor greenColor]];
[_throttleLabel setText:[NSString stringWithFormat:@"%.f %%", [[telemetry objectForKey:@"throttle"] floatValue] * 100]];
[_velocityLabel setText:[NSString stringWithFormat:@"%.2f m/s", [[telemetry objectForKey:@"velocity"] floatValue]]];
[_altitudeLabel setText:[NSString stringWithFormat:@"%.1f m", [[telemetry objectForKey:@"altitude"] floatValue]]];
}
}];
On Sep 22, 2013, at 4:45 AM, Richard Bunt [email protected] wrote:
Is it possible for you to show me the code you are using to poll the server?
โ
Reply to this email directly or view it on GitHub.
Sorry, I should say that the above polling strategy bounds the number of outstanding requests at the server to the number of devices/tabs/instances you have requesting information.
Rich- I haven't managed to reproduce this bug in several days. Not sure why really. I'm managing the telemetry grabs from a central location and not requesting them more than once a second. This previously resulted in a loss of function in the Telemachus server, but I haven't had it happen for a while. And all on existing installs that previously exhibited the issue. I am at a loss.
I have run into this bug before and as you have discovered it is nigh on impossible to figure out what is causing this problem as it is highly transient.
I have one question (mainly because I am not familiar with the language you are using) - how is your polling set up exactly? Do you "spam" requests or wait for the completion of one request before starting the next poll?
Thanks for your efforts on this matter - hopefully we can track it down eventually.
I am spamming them for sure. They are set to timeout before the next one fires, but they are not triggered by the completion of the previous request. If it's a better way, I might do that.
On Sep 30, 2013, at 2:48 PM, Richard Bunt [email protected] wrote:
I have run into this bug before and as you have discovered it is nigh on impossible to figure out what is causing this problem as it is highly transient.
I have one question (mainly because I am not familiar with the language you are using) - how is your polling set up exactly? Do you "spam" requests or wait for the completion of one request before starting the next poll?
Thanks for your efforts on this matter - hopefully we can track it down eventually.
โ
Reply to this email directly or view it on GitHub.
My only theory on this bug is that it is caused by a request backlog at the server, so I believe it is a better way because it ensures that there is only one outstanding request at the server. In addition to this, you get a free dynamic delay in that requests are sent only as quickly as the server can handle them.