insidegui / WWDC

The unofficial WWDC app for macOS
https://wwdc.io
BSD 2-Clause "Simplified" License
8.63k stars 783 forks source link

WWDC 6.1.2 hangs after launch on 10.14.5 #544

Closed JayBrown closed 5 years ago

JayBrown commented 5 years ago

WWDC launches fine, but then starts to hang after 2 or 3 seconds, complete with spinning beach ball of death, and "Application not responding" warning.

system: macOS 10.14.4 & macOS 10.14.5 with supplemental firmware update for T2 MBPs app: WWDC 6.1.2 when: happens after launching the app note: no special hw/sw configuration, but I tested launches without any background security apps, and the problem persists

sample attached WWDC_sample.txt

allenhumphreys commented 5 years ago

@JayBrown Any chance you could profile the app in instruments to see what it's doing during the hang? It's hard to get a good picture of the problem with a sample report.

JayBrown commented 5 years ago

How do I do that, "profile the app in instruments"?

EDIT: seem to have found it: https://gist.github.com/loderunner/36724cc9ee8db66db305

JayBrown commented 5 years ago

Here's a profile. One thing was a little different this time: WWDC did not launch with an empty window, as before, but actually had some contents, like video titles etc., but was still hanging. wwdc-profile.trace.zip

insidegui commented 5 years ago

Thanks!

insidegui commented 5 years ago

@JayBrown we had a similar issue (#284 / #464) a long time ago and it came down to a problem with Realm (which we use for data storage) which was causing database files to become corrupted in a way that made the app hang like you're seeing. Could you check the size of your database file? It's located in ~/Library/Application Support/io.wwdc.app/ConfCore.realm.

Something you can try is to move the entire io.wwdc.app folder somewhere else to cause the app to rebuild the entire database and see if that solves the problem.

There's a script in the root of the repository which you can run by calling ./cleardata.sh that'll clear the database, if you prefer to do it that way (you'll loose any favorites, progress, etc).

JayBrown commented 5 years ago

The ConfCore.realm db was 144 MB. I removed the whole AppSupport folder, and WWDC rebuilt it, and now it's 18 MB. But WWDC is still hanging. After 5 minutes or so, it loads the main window contents, though without images, but immediately goes into a hang again, with CPU at 100%.

insidegui commented 5 years ago

Would it be possible for you to zip your app support folder io.wwdc.app and send us a link so we can inspect it?

If you prefer, you can e-mail it to me: insidegui [at] gmail.com

Thanks

JayBrown commented 5 years ago

See here: https://transfer.sh/hCIOh/io.wwdc.app-20190523_231358.tar

allenhumphreys commented 5 years ago

I took a look and there are definitely no photos in the image cache, but when I put these files into my application support folder the app started up fine and loaded the images. I tested with network link conditioner too just to make sure it wasn't being caused by a slower network.

I took a look at the trace and it's left me wanting to ask a seemingly unrelated question, but what are your locale settings on your computer? Country/language/etc?

JayBrown commented 5 years ago

location: Germany language: English (US) keyboard setting: German (QWERTZ)

Question: did you put the app into ~/Applications? That's where I'm launching it from. But I don't believe that's the problem.

Question: does WWDC in some form rely on AppleScript or something similar, e.g. to control other apps (macOS apps) or use some of their functionality?

allenhumphreys commented 5 years ago

Question 1: To test, I took your application data and dropped into my production app's application data and ran the app located in /Applications (not ~/Applications)

Question 2: No, it doesn't. It's really just a video player that gets streaming links for the WWDC videos and lets you play them. Nothing too fancy.

After a bit of fiddling I got the trace to symbolicate and I think the problem has to do with WWDC synchronizing the download status. By default, files are downloaded into ~/Library/Application Support/WWDC, but I'm guessing you've changed it to a location that you're using for other things too.

You can figured out the location without opening the app by executing the following on the command line:

defaults read io.wwdc.app localVideoStoragePath

You can also remove the preference, which should get you back into a functioning state and the app will again be using the default location using this:

defaults delete io.wwdc.app localVideoStoragePath

Unfortunately you've stumbled into some code that was written under the assumption that the downloads folder wasn't going to be user choosable I think. The offending code starts here: https://github.com/insidegui/WWDC/blob/master/WWDC/DownloadManager.swift#L453 and it works well if the file count is in the range of less than all the sessions 😄

If you do have a decent number of downloaded sessions, you can keep them in sync with the app as long as you move them to the directory the new directory preserving the general hierarchy. That's actually what the bad code does!

JayBrown commented 5 years ago

Thank you. I've deleted the localVideoStoragePath key and removed the AppSupport folder, and now everything's back to normal again. Will stick to the default settings.

insidegui commented 5 years ago

Leaving a comment here in case other people run into the same problem: the issue occurs when the downloads folder for the videos is set to a folder that contains lots of files and/or subfolders. We strongly suggest not changing the downloads folder or creating a separate folder specifically for this on your file system.

kubatruhlar commented 5 years ago

Happened to me as well. After I changed the path and moved the files, the app just refused to work. Thanks @allenhumphreys.

allenhumphreys commented 5 years ago

@kubatruhlar See https://github.com/insidegui/WWDC/issues/544#issuecomment-495807483 to reset the preference