account-polld plugins hang when displaying a notification on startup

Bug #1498214 reported by Niklas Wenzel on 2015-09-21
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Bill Filler
account-polld (Ubuntu)
Niklas Wenzel

Bug Description

How to reproduce:

1) Add an avatar image to the contacts book for one of your email addresses
2) Set up a Gmail account
3) stop ubuntu-push-client
4) Send an email from the address with the avatar to the Gmail account you added
5) start ubuntu-push-client

Excerpt from the logs:

2015/09/22 00:30:27 Creating account with id 2 for com.ubuntu.developer.webapps.webapp-gmail_webapp-gmail
2015/09/22 00:30:27 gmail plugin 2: last state loaded from storage
2015/09/22 00:30:27 Starting poll for account 2
2015/09/22 00:30:27 Previous messages: []string{}
2015/09/22 00:30:27 Polling account 2
QSocketNotifier: Can only be used with threads started with QThread
QSocketNotifier: Can only be used with threads started with QThread
2015/09/22 00:34:27 Poll for account 2 has timed out out after 4m0s
2015/09/22 00:34:27 Ending poll for account 2

As this also happens in my IMAP plugin, I guess that the issue probably lies in the Persist() method in plugins.go.

Related branches

Niklas Wenzel (nikwen) on 2015-09-21
Changed in account-polld (Ubuntu):
assignee: nobody → Niklas Wenzel (nikwen)
Niklas Wenzel (nikwen) wrote :

Ok, it's not the Persist() method. It's the following line which is blocking:

avatarPath = qtcontact.GetAvatar(address.Address)

Niklas Wenzel (nikwen) on 2015-09-21
Changed in account-polld (Ubuntu):
status: New → In Progress
Niklas Wenzel (nikwen) wrote :

It looks as if the issue is related to the following line from the logs:

QSocketNotifier: Can only be used with threads started with QThread

Inspecting the dbus calls sent by the system, I found out that the contact information request dbus call isn't made until after the timeout (in my updated code) when this bug appears.

Niklas Wenzel (nikwen) wrote :

Finally fixed this issue! :)

The problems encountered were:

1) Improper multithreading in the go code
2) Qt's and Go's multithreading interfering with each other

For now the code still lies in my imap-mails branch but I'll soon create a separate one for this. ;)

Niklas Wenzel (nikwen) wrote :

Ok, looks like 2) was indeed fixed by my code but it introduced some other issues so I'll look for a better fix.

Niklas Wenzel (nikwen) wrote :

Ok, I now found a fix for 2) as well. :)

Niklas Wenzel (nikwen) wrote :

As this bug really consists of two different ones (the timeout handler not working properly as well as the actual timeout), I split the fix into two different MPs which makes them easier to understand.

Changed in canonical-devices-system-image:
assignee: nobody → Bill Filler (bfiller)
importance: Undecided → High
milestone: none → ww46-2015
status: New → In Progress
Jonas G. Drange (jonas-drange) wrote :

I can't reproduce this bug. Is it still an issue?

Niklas Wenzel (nikwen) wrote :

Yes, this is still an issue. I'll edit the reproduction steps. I forgot something.

description: updated
Niklas Wenzel (nikwen) wrote :

Edited. Should be fine now and the two branches fix this.

Changed in account-polld (Ubuntu):
status: In Progress → Incomplete
status: Incomplete → In Progress
Jonas G. Drange (jonas-drange) wrote :

Thanks, Niklas! I'll take another look at both branches.

Niklas Wenzel (nikwen) wrote :

Jonas, have you seen my comment on your review? We need to get this in for OTA-8. ;)

Jonas G. Drange (jonas-drange) wrote :

Are you sure the steps are good? I really can't reproduce the issue with the steps you've given.

But I'm also not seeing any avatar in the notification indicator, even though the receiving gmail account has access to the contacts.

Niklas Wenzel (nikwen) wrote :

Yes, that's what I'm doing. However, you should see definitely see avatars in the notification indicator.

Some details on how I added the avatars to the contacts book:

1) Create a new contacts book entry with your own e-mail address and save it in the "personal"/system contacts book.
2) Then add an avatar to it.
3) The avatar should now be shown in the contacts book.


0) stop ubuntu-push-client
1) Add a Gmail account. Do not grant account to the contacts (even though I don't think that this part is relevant as the contacts are accessed by account-polld and not by the Gmail app).
2) Send yourself an email from the account for which you added the avatar. Send it to the Gmail account you added.

Wait a few seconds and then:

3) start ubuntu-push-client

Starting/stopping ubuntu-push is important as this bug only appears when polling from outside of the regular polling mechanism, e.g. when the account is initialized in account-polld!

Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package account-polld - 0.1+16.04.20151103-0ubuntu1

account-polld (0.1+16.04.20151103-0ubuntu1) xenial; urgency=medium

  [ Niklas Wenzel ]
  * Fix a timeout error in the qtcontacts module which occured when a
    notification was shown directly after creating an account (fixes LP:
    #1498214) (LP: #1498214)
  * Fix the timeout logic in the qtcontacts module (part of LP:
    #1498214) (LP: #1498214)

 -- <email address hidden> (Jonas G. Drange) Tue, 03 Nov 2015 13:40:49 +0000

Changed in account-polld (Ubuntu):
status: In Progress → Fix Released
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers