Closed Bug 1234488 Opened 8 years ago Closed 8 years ago

[Email] E-mail list and " No mail in this Folder" display together.

Categories

(Firefox OS Graveyard :: Gaia::E-Mail, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(b2g-v2.5 affected, b2g-master verified)

RESOLVED FIXED
Tracking Status
b2g-v2.5 --- affected
b2g-master --- verified

People

(Reporter: hejingmei, Assigned: asuth)

References

Details

Attachments

(4 files)

[1.Description]:
[Aries KK v2.5&master][Flame KK v2.5&master][Email]If it's the first time to open the folder via E-mail,you will find that E-mail list and " No mail in this Folder" display together.

See attachment: Aries_master.3gp & logcat_1426.txt
Found time: 14:26

[2.Testing Steps]: 
Precondiction: 1. Have some e-mails in the text folder.
               2. The first time to open the text folder.

1. Launch " E-Mail".
2. Log in a valid account.
3. Click menu button.
4. Open a folder.(ex:Sent Items)
5. Observe the interface.

[3.Expected Result]: 
5. Only the E-mail list displays.

[4.Actual Result]: 
5. E-mail list and " No mail in this Folder" display together.

[5.Reproduction build]: 
Device: Aries KK master(Affected)
Build ID               20151221204910
Gaia Revision          14aefb2519becfa32f31bcc3c9c995693421f19c
Gaia Date              2015-12-21 06:34:35
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/8c9825377d0d8115e9fed64fd3700b1e54700dbe
Gecko Version          46.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20151221.200242
Firmware Date          Mon Dec 21 20:02:51 UTC 2015
Bootloader             s1

Device: Aries KK v2.5(Affected)
Build ID               20151222010746
Gaia Revision          42aa9b91a231572138509bbd942d918d0293110a
Gaia Date              2015-12-21 22:48:19
Gecko Revision         http://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/9c525eef094b710e8ea6d00613200282acf9b682
Gecko Version          44.0
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20151222.001825
Firmware Date          Tue Dec 22 00:18:33 UTC 2015
Bootloader             s1

Device: Flame KK master 512mb(Affected)
Build ID               20151221150211
Gaia Revision          14aefb2519becfa32f31bcc3c9c995693421f19c
Gaia Date              2015-12-21 06:34:35
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/8c9825377d0d8115e9fed64fd3700b1e54700dbe
Gecko Version          46.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20151221.182728
Firmware Date          Mon Dec 21 18:27:42 EST 2015
Firmware Version       V18D V4
Bootloader             L1TC000118D0

Device: Flame KK v2.5 512mb(Affected)
Build ID               20151218180935
Gaia Revision          eeed1451e0e48b63abe3199e4d6906adc2a762d2
Gaia Date              2015-12-17 14:53:36
Gecko Revision         http://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/766600655dfb1b67c380b9da4f4b19acb505a858
Gecko Version          44.0
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20151218.172320
Firmware Date          Fri Dec 18 17:23:30 UTC 2015
Firmware Version       V18D V4
Bootloader             L1TC000118D0


[6.Reproduction Frequency]: 
occasionally Recurrence,3/5

[7.TCID]: 
Free Test
It looks like there's a backend race in ActiveSync happening.  Specifically, I see these log lines that look very suspicious:

12-22 14:26:02.233 I/Gecko   (10067): WLOG: Sync completed: added 2, changed 0, deleted 0^M
12-22 14:26:02.253 I/Gecko   (10067): WLOG: Sync Completed! 2 messages synced^M
12-22 14:26:02.353 I/GeckoDump(10067): LOG: VSCROLL scrollTop: 0, RECALCULATE: 0, 0^M
12-22 14:26:02.353 I/GeckoDump(10067): LOG: message_list complete: 2 items of 0 alleged known headers. canGrow: false^M

Specifically, I would indeed expect "2 items of 0 alleged known headers" means the backend is telling the frontend gibberish which makes it display the UI like this.

This is likely a trivial plumbing issue.  I'll fix it now.
Assignee: nobody → bugmail
Status: NEW → ASSIGNED
This turned out to be complicated.  The brunt of the problem is captured in this log excerpt:
logic: <LogicEvent MailBridge/cmd {"type":"viewFolderMessages","msg":{"type":"viewFolderMessages","folderId":"7/0","handle":16}}>
logic: <LogicEvent MailBridge/cmd {"type":"viewFolderMessages","msg":{"type":"viewFolderMessages","folderId":"7/0","handle":17}}

Note that I'm not eliding a killSlice, we are creating two slices to view the same folder and keeping them around.  (And they do both get killed when I change folders, suggesting something like a custom element is getting multiply instantiated and wired up when it should not be.)

Because of the specialized mechanism we use for initial ActiveSync sync, We end up doing the right thing for handle 16, but the duplicate handle 17 which is the one actually shown to the user is broken because its slice gets initialized when headerCount was 0 but then it blocks waiting on a mutex to run its sync.  During this time the FolderStorage's headerCount takes on its true value but the slice is not visible to the FolderStorage at that point in time and the value was not otherwise updated during the sync path.  (This is mainly because headerCount was somewhat of an afterthought and we didn't really worry too much about the front-end issuing completely redundant requests.)

Although there's obviously something to fix in the front-end, I've prepared a back-end fix for this.  It actually is a bit superstitious and maybe redundantly sets headerCount a few times because I was very confused before I saw that logging.  However, I think all of the points I have retained where the updates happen are reasonably/sane choices and since the assignment is always idempotent, it's not really the end of the world to do it redundantly.
Comment on attachment 8701300 [details] [review]
[gaia-email-libs-and-more] asutherland:headercount-race > mozilla-b2g:master

So, this will likely help you appreciate the convoy branch and its sanity a lot!  (At least, the problem was complex and a little non-obvious; the fix is arguably trivial.)

Also, I'm going to spin off a UI bug now.
Attachment #8701300 - Flags: review?(m)
Attachment #8701300 - Flags: review?(m) → review+
This bug has been verified as pass on latest build of Flame KK master 512mb and Aries KK master by the STR in comment 0.
Actual results: Only the E-mail list displays in step 5.
Reproduce rate:0/10

Device: Flame KK master 512mb (pass)
Build ID               20151227150209
Gaia Revision          adf75f7a97ea0627b3211f0eef61eb72073f2dff
Gaia Date              2015-12-24 10:09:32
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/c39a71cf41460924d2988d2d63be2f5d267db82a
Gecko Version          46.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20151227.185219
Firmware Date          Sun Dec 27 18:52:32 EST 2015
Firmware Version        V18D V4
Bootloader             L1TC000118D0

Device: Aries KK master (pass)
Build ID               20151226120538
Gaia Revision          adf75f7a97ea0627b3211f0eef61eb72073f2dff
Gaia Date              2015-12-24 10:09:32
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/c39a71cf41460924d2988d2d63be2f5d267db82a
Gecko Version          46.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20151226.123841
Firmware Date          Sat Dec 26 12:38:49 UTC 2015
Bootloader             s1
QA Whiteboard: [MGSEI-Triage+]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: