Closed Bug 867043 Opened 7 years ago Closed 7 years ago

[Buri][Contacts]Contacts appearing dupilcated in the list

Categories

(Core :: DOM: Device Interfaces, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla23
blocking-b2g tef+
Tracking Status
firefox21 --- wontfix
firefox22 --- wontfix
firefox23 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- fixed

People

(Reporter: sync-1, Assigned: gwagner)

References

Details

(Whiteboard: [fixed-in-birch] Buri, Poland, IOT)

Attachments

(9 files, 1 obsolete file)

SW125
 AU_LINUX_GECKO_ICS_STRAWBERRY_V1.01.00.01.019.080
 Firefox os  v1.0.1
 Mozilla build ID:20130418070206
 
 
 
 +++ This bug was initially created as a clone of Bug #445951 +++
 
 DEFECT DESCRIPTION:
 (1)Import contacts from SIM card, or from facebook account
 (2)Open the contacts app, in the list, you will find some contacts will be displayed as duplicated, or even 3 or 4 same items appear for 1 contact.----NOK
 
 When searching, you will find there is only one contact, no duplicated contacts.
 So only list displaying has problems. Storage is fine.
 
  REPRODUCING PROCEDURES:
 
  EXPECTED BEHAVIOUR:
 
  ASSOCIATE SPECIFICATION:
 
  TEST PLAN REFERENCE:
 
  TOOLS AND PLATFORMS USED:
 
  USER IMPACT:
 serious
  REPRODUCING RATE:
 100%
  For FT PR, Please list reference mobile's behavior:
 
 ++++++++++ end of initial bug #445951 description ++++++++++
 
 
 
 CONTACT INFO (Name,Phone number):
 
  DEFECT DESCRIPTION:
 
  REPRODUCING PROCEDURES:
 
  EXPECTED BEHAVIOUR:
 
  ASSOCIATE SPECIFICATION:
 
  TEST PLAN REFERENCE:
 
  TOOLS AND PLATFORMS USED:
 
  USER IMPACT:
 
  REPRODUCING RATE:
 
  For FT PR, Please list reference mobile's behavior:
Attached image facebook friends
Attached image SIM contacts
Clone from brother
Attached image ScreepSnap
Clone from brother
Clone from brother
Clone from brother
blocking-b2g: --- → tef?
So, it looks like not every contact has duplicated entry, but only some of them, right?
yes, not all has duplicated entry
reproduced on unagi (20130429230201 nightly) with several contacts.
had to add a contact to favorite
had rebooted the phone
then i can see my favorite contact being duplicated and one of the duplicated contact near my favorite contact
actaully, upon restarting contacts app, i don't see the dup contacts anymore. the list seem to be generated each time when contact is launched (if killed) so i feel that the result that i am seeing can be inconsistent
so far i notice the "E" section is more problematic. my wife's name starts with E
i am seeing different results every time i kill contacts and enter contacts.
1. sometimes i notice some of my contacts in "E" sections are missing so i see a short list in "E" and sometimes i see a long list in "E"
2. sometimes i see duplicated contacts in "E" sections 
3. sometimes the contacts list seem correct
Priority: P2 → P1
I guess these tests are with an old build.

Dup Bug 862351 ?
No, we also tested on new build,based on 4/22 , the problem is still there.
Tested on Inari with the following build information:

Gecko  http://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/45aa5ba0ed53
Gaia   cf2d4136f0ebc66039637fdbeb72ed184dfbc0f2
BuildID 20130429070204
Version 18.0

I can reproduce whatever is in Comment 11. 'E' section has long list sometimes and short list sometimes. It is inconsistent. Shows different results each time the contacts app is killed and reopened. 

Does anyone else see the same issue?
Flags: needinfo?
Yes I can reproduce it as well on v1-train after changing the "order by last name" setting. The sorting for E is also off.
Flags: needinfo?
So this is a race in ContactDB. ContactDispatcher cancels the timeout and sends more contacts right away when it receives a SendNow message, but sometimes the timeout runs before it's cancelled, so we send the same chunk twice. I think I can workaround it by capturing the current index in the timeout and checking if we're sending stuff twice. In any case, this is a Gecko bug, and certainly tef+.
Assignee: nobody → reuben.bmo
Blocks: 855015
Component: Gaia::Contacts → DOM: Device Interfaces
OS: Gonk (Firefox OS) → All
Product: Boot2Gecko → Core
Hardware: ARM → All
Version: unspecified → Trunk
And,please check your list more carefully,when you see the abnormal E list,try to check the F list.The duplicated item will not displayed side by side as the screenshots.In fact,the whole F list will be duplicated.I mean:
fa
fb
fc
...
fz
fa
fb
fc
...
fz
And,please check your list more carefully,when you see the abnormal E list,try to check the F list.The duplicated item will not displayed side by side as the screenshots.In fact,the whole F list will be duplicated.I mean:
fa
fb
fc
...
fz
fa
fb
fc
...
fz
While,of course,not only limited to F,F may be OK,any other charactor's list may be wrong.
blocking-b2g: tef? → tef+
There is no need for this complex dispatch system. We should just get rid of the timer and only send if the child requests more.
Simpler is better these days.
Attached patch patchSplinter Review
Attached patch patchSplinter Review
Assignee: reuben.bmo → anygregor
Attachment #744722 - Flags: review?(reuben.bmo)
Attachment #744695 - Flags: review?(reuben.bmo)
Attachment #743976 - Attachment is obsolete: true
Attachment #743976 - Flags: review?(anygregor)
Comment on attachment 744722 [details] [diff] [review]
patch

Review of attachment 744722 [details] [diff] [review]:
-----------------------------------------------------------------

Nice catch.
Attachment #744722 - Flags: review?(reuben.bmo) → review+
Comment on attachment 744695 [details] [diff] [review]
patch

Review of attachment 744695 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!

::: dom/contacts/fallback/ContactDB.jsm
@@ +43,1 @@
>            aClearDispatcher();

To avoid the repetition in the else, you can do:

let chunk = aContacts.splice(0, CHUNK_SIZE)
if (chunk.length > 0) {
  aCallback(chunk);
}
if (aContacts.length === 0) {
  aCallback(null);
  aClearDispatcher();
}

@@ +62,5 @@
>                  aClearDispatcher();
>                } else if (chunk.length === CHUNK_SIZE) {
>                  aCallback(chunk);
>                  chunk.length = 0;
>                  nextIndex += CHUNK_SIZE;

Move this outside of the loop to avoid sending duplicate contacts if for some reason sendNow is called before we're done with the chunk.
Attachment #744695 - Flags: review?(reuben.bmo) → review+
Patch 1 rebased to b2g18 applies cleanly.
https://hg.mozilla.org/mozilla-central/rev/08c582b1c486
https://hg.mozilla.org/mozilla-central/rev/5140723575f5
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Whiteboard: [fixed-in-birch] → [fixed-in-birch] Buri, Poland, IOT
You need to log in before you can comment on or make changes to this bug.