Khan / khan-windows

Khan Academy for Windows 8
31 stars 15 forks source link

App crashes when opening in airplane mode #88

Closed christiango closed 10 years ago

christiango commented 10 years ago

I have noticed that the app crashes often when opening it in airplane mode after being offline for a while. It happens on a Surface 2 running Windows RT 8.1.

Here are the relevant logs from the event viewer:

bbondy commented 10 years ago

I tried to reproduce this but couldn't. Can you reproduce this reliably? If so, could you outline the exact steps used to reproduce it?

In particular, are there any downloads happening at the time?

Is the app opening from a fully closed state? Or was the app suspended and then airplane mode is turned on?

Are you logged in when the airplane mode changes?

I've tried changing many of these settings here myself to try and reproduce, but cannot.

christiango commented 10 years ago

Here are the steps I have been following to repro it:

Don't open the app for a few days.

Turn the device on in airplane mode.

The app tries to boot and immediately closes. In the brief time that the app UI is showing in the top right corner is showing "log in".

It reproes on both my Surface 2 (Windows RT 8.1) and Samsung Series 9 laptop (Windows 8.1). So I've ruled out that it is a Surface-specific or Windows 8.1 RT specific bug. Unfortunately, I haven't had much time to look into a fix.

My first theory is that it was trying to reauthenticate (and failing due to the lack of internet) since it had been a while since I was last logged in, but I'm not sure that's the issue here.

bbondy commented 10 years ago

An easy fix would probably be to move this block: //init logging WinJS.Promise.onerror = KA.handleError; WinJS.Application.onerror = KA.handleError; window.onerror = function (err) { KA.handleError(err); };

A bit higher in the initialization process in global.ts (Probably due to some ordering of callback returns)

But it would be nice to see a crash dump so I could see if there's a better fix than that.

christiango commented 10 years ago

I'll give your suggestion a try later this week to see if that resolves the issue.

On Wed, Feb 19, 2014 at 9:04 AM, Brian R. Bondy notifications@github.comwrote:

An easy fix would probably be to move this block: //init logging WinJS.Promise.onerror = KA.handleError; WinJS.Application.onerror = KA.handleError; window.onerror = function (err) { KA.handleError(err); };

A bit higher in the initialization process in global.ts (Probably due to some ordering of callback returns)

But it would be nice to see a crash dump so I could see if there's a better fix than that.

Reply to this email directly or view it on GitHubhttps://github.com/Khan/khan-windows-8/issues/88#issuecomment-35521689 .

christiango commented 10 years ago

I've got a fix. The issue was that when a sendRequest fails due to the lack of internet connection, the service.handleError call is passed a value of null for err and a function for the value of error. This causes a null reference exception when handleError in utilities.ts tries to access event.detail. A simple null check resolves the issue. I will submit the fix shortly.

bbondy commented 10 years ago

Great, thanks!

bbondy commented 10 years ago

Merged changeset b0cdb144cdc59edcf2403c6c1baa7dd4c5bd572e