Closed lookfirst closed 10 years ago
I'm having the same problem and spent a couple minutes deleting things and testing different accounts. It looks like it only crashes for me with accounts using app specific passwords (i.e. 2fa enabled) as I have two with 2fa and two without and it's consistent on the one machine I'm having this problem with. (I thought that #26 might be related but I see console spam without crashes, so probably just a coincidence in terms of timing.)
I also have 2fa enabled, so maybe that is it? It was working ok for a while though.
Guys if it's truly 2fa related then we're likely to reproduce this.
Any chance you would debug it in Xcode? If not I'll have to setup an account with 2fa enabled and try to reproduce the issue.
Just wanted to drop a quick note before you look into 2fa: I think that was an unrelated coincidence, that's what I get for trying to find an easy workaround instead of actually debugging last night :)
I thought it was a heisenbug when I built and ran from source without a problem and the MAS version ran without a problem too a couple minutes ago. But I decided to check and backtracked to my inbox state last night when the crashing started and it definitely crashes on at least one Google+ "x added you" email and possibly a similar one that arrived a short while later in the other account (and no such emails in my non-2fa accounts). Not sure why I couldn't repro on my laptop last night if that's what's going on, but there's one (better) place to start looking and I'll try to debug if I have some time later today.
I'd be happy to try to debug it in xcode, but I'm not familiar with doing so. If you give me a bit of direction, I can certainly follow it.
@janeylicious Thanks for this info Jane. In worst case it could be a bug in code that needs to be fixed.
@lookfirst Since the traceback shows your version is 0.9.0, below is how to run that version locally in Xcode (you need to have CocoaPods installed):
In Terminal:
gem install cocoapods (or sudo gem install cocoapods)
git clone --recursive https://github.com/ashchan/gmail-notifr-objc.git
cd gmail-notifr-objc
git checkout v0.9.0
pod install
When above is done, go to gmailn-notifr-objc folder, find a file named 'Gmail Notifr.Gmail Notifr.xcworkspace' and click it. Xcode will open it.
In Xcode use 'CMD+R' to start running and debugging the app. It will reads your accounts in your current Gmail Notifr installation. Please choose allow when keychain asks for permission.
Now if it crashes, a detailed traceback will show in debug area (use menu View - Debug Area - Show Debug Area to show it if it's hidden).
If Xcode complains it cannot build it, just stop there. Xcode updates very frequently some versions might not be working anymore.
Thank you very much!
Thanks for great directions. Followed them and it didn't crash. I then ran the original version that I have on my mac and it works too. So, my guess is that the subject line of an email was causing the issue?
@lookfirst Thanks! I updated the comment correcting the tag name.
If it's subject line related, we'll be able to reproduce the issue by marking that email as unread in Gmail, then relaunch Gmail Notifr again.
Yea, I have no idea which email it was that caused the issue though. ;-) Maybe look to add a bit more defensive programming around that block of code?
From the stack trace...
grep -r "dictionaryWithObjects" * Binary file Libs/Growl.framework/Growl matches Binary file Libs/Growl.framework/Versions/A/Growl matches Binary file Libs/Growl.framework/Versions/Current/Growl matches
I don't actually have Growl enabled for both accounts though.
Yes, I believe if any value is nil then this dictionary construction throws exception:
https://github.com/ashchan/gmail-notifr-objc/blob/master/Classes/GNChecker.m#L233
Okay, I figured it out. I also thought I pasted the particular XML causing problems in my previous comment, but guess I was in a rush and thought @lookfirst might do that.
On Google's end, the actual time and date on the emails (which on the second account had narrowed down to multiple emails) were something along the lines of
<issued>2014-03-09T02:30:00Z</issued>
and I was really confused as to why NSDateFormatter dateFromString: returned nil only for these timestamps. Subsequently after a little testing, it turns out anything between 2:00:00 and 2:59:59 will and I realized that I forgot to account for DST and that 2 to 2:59am does not exist on March 9, 2014 in the US as a result.
So it's one hell of an edge case (I see you have another one involving the time too, not sure if google returns 0-23 or 1-24 or 0-24 (lol)) and I don't know how you want to deal with that so I don't have a pull request for you, but there you go. :smile:
@janeylicious You make our day! I don't think I'll ever figure this out without your help.
Timestamps are difficult to parse. Instead of trying to deal with all edge cases (who knows what other time ranges will cause issue like this), I guess I'll just take care of the nil value by inserting a time.
Not sure why you are parsing it yourself? There should be some objc library for doing that.
@lookfirst that's what's being used right now at https://github.com/ashchan/gmail-notifr-objc/blob/master/Classes/GNChecker.m#L194, and NSDateFormatter with the currently defined locale doesn't like the timestamp being returned by Google (which would be okay in other locales).
Timestamps are definitely annoying to deal with in general though.
I'm a java guy... we are lucky with joda time which handles all this stuff with ease. ;-)
@lookfirst, @janeylicious
I made a quick dirty fix in df2a447. Please see if this fixes the issue.
What it did is returning an NSDate (1 hour before current time) if parsed date is NULL. Better return a valid but wrong date than nil which causes dictionary insert error.
As I didn't plan to upgrade the none app store version, if you guys are with 0.9.0 please let me know I'll send you redeem code for the store version.
Thanks!
Thanks. I just bought the paid version, so hopefully there will be an update there soon. I have no problem supporting your hard work. ;-)
@lookfirst I really appreciate your support. I'm going to add support for global 'Check All' shortcut in the weekend. So if everything goes smoothly I'll be able to submit a new version next week.
It was working great for a while. Now it just crashes when I start it up. Sad face.