Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed/missing push messages #970

Closed
fd0 opened this issue Mar 3, 2014 · 162 comments
Closed

Delayed/missing push messages #970

fd0 opened this issue Mar 3, 2014 · 162 comments
Assignees

Comments

@fd0
Copy link

fd0 commented Mar 3, 2014

When messaging a friend of mine via push, most messages are delayed a few hours. Background data is enabled. Sometimes messages are even not delivered at all or arrive in different order than sent. This also happens with messages other people send him, although I can exchange messages with these people without problems (delivered within a few seconds). He runs a Nexus 5 with the latest stock Google Android and is perfectly reachable via Hangouts the whole time.

Any idea how to debug this?

@lablans
Copy link

lablans commented Mar 4, 2014

I can confirm this problem, see #937. Please correct me: GCM works on a "best effort" basis. Messages can arrive at any time in any order. And it seems that this is not just an academic problem, it's actually happening.

We need some "server notices that a message has not been delivered and resend it" mechanism. Maybe possible with the delivery reports (#957)? Resending means, however, that the client would need a mechanism to deal with these duplicate messages (those would be two GCM messages; it would need to detect the duplicate content) - but he needs that anyway, see #937.

@fd0
Copy link
Author

fd0 commented Mar 5, 2014

Issue #1029 may also be caused by this.

@Certhas
Copy link

Certhas commented Mar 5, 2014

Edit: This was a user error. leaving the following up for reference.

I am having this issue as well, Alice's messages go through immediately to Bob, but Bobs messages get delayed/don't arrive (been testing for two days/a few hours), though they are shown as sent on Bobs phone. This happens with both phones on WiFi, and with both phones on mobile data.

This also caused a confusion of encrypted sessions that are ended "simultaneously" (during the delay), which led to lots of "bad encrypted message" errors, and the inability to reestablish a secure session.

This could only be solved by reinstalling the app. After reinstalling the delayed messages were delivered immediately (but as "bad encrypted messages" obviously).

Devices are Nexus 4 and Nexus 5 with stock Android.

This makes TextSecure push completely broken. Multi hour delays/delivery failures, while both parties are online, without the sender being notified is just the worst kind of broken for a communication program.

@rbieb
Copy link

rbieb commented Mar 5, 2014

#1038 Might be related.

@joshproehl
Copy link

Having exactly the same problem as Certhas, for multiple days now. Everything works fine when forced to SMS-only, so the problem appears to be in the transport, rather than the app or the phone.
Happy to provide any debugging, logs, etc if needed.

@behrmann
Copy link

behrmann commented Mar 7, 2014

I too can confirm this, running on a HTC Desire Z with Android 2.3.3 and Textsecure 2.0.4

Messages arrive instantenously from Alice to Bob, but do not seem to arrive when send from Bob to Alice even though they are shown as sent. The initial key exchange works fine and also the exchange of encrypted messages via SMS works fine.

I would very much like to see this problem solved, since it prohibits me from spreading Textsecure among my friends.

@rbieb
Copy link

rbieb commented Mar 8, 2014

Is the background of your messages blue also? It seems to be green if the mesage was actually received, but mine all have a blue background.

@behrmann
Copy link

behrmann commented Mar 8, 2014

@Nordic89: Green messages are sent via SMS and blue messages are sent via push. As I described, everything works for SMS text messages, but push messages (the blue ones) only arrive immediately when sent from Alice to Bob and not when sent from Bob to Alice.

@Certhas
Copy link

Certhas commented Mar 8, 2014

So in my case it turned out to be a user error. Alice had restrict background data on the google services app checked (the tricky bit being that it still transfers some data and thus doesn't actually display as restricted in the list of apps). Alice had not been using any chat applications but was relying on SMS before.

While this is a user error, it's fairly non-obvious. Some online tutorials online suggest doing this for privacy/data/battery reasons (as google services has been known to be buggy at times). Alice presumably did this without being aware that google services would have anything to do with delivering messages in a superficially unrelated SMS replacement app.

I don't know if this is technically possible, but it would be great if text secure could pop up a warning box if it detects that background services are restricted.

@rbieb
Copy link

rbieb commented Mar 8, 2014

@behrmann
Ah, that makes sense. My green messages always arrive and the blue ones don't, so it's definitely a problem with push messages.

@moxie0
Copy link
Contributor

moxie0 commented Mar 8, 2014

@Certhas I'm not sure if that's possible to detect, but it'd be cool if you did some research to see whether there's an API for that and reported back.

@wickedshimmy
Copy link
Contributor

The recommendation from ICS onward seems to be to use something like the following if you're running in the foreground or the background, but that's not really helpful unless it's TS code running. AFAICT it will take into account the global "Restrict background data" state, but I can't find any way to query it for a specific other app (like the @Certhas case of Google services being explicitly disallowed from using background data).

ConnectivityManager connectivityService = Context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo network = connectivityService.getNetworkActivityInfo();
if (network != null && network.isAvailable()) { // or network.isConnected() here
    // background data should not be restricted
}

I wonder if this is another thing that can just be addressed by better messaging around the push transport (you need to have Play services/GCM running and able to access the network in the background, etc.).

@fd0
Copy link
Author

fd0 commented Mar 10, 2014

Today it happened again to me: Yesterday evening I sent a push-messages to a colleague while his phone had no data connection. It was delivered about 10 hours later this morning.

I'm curious now: What service level does GCM offer? For example, does it guarantee delivery? What about caching, why does it take so long to deliver a message after a device regained network connectivity?

@tinloaf
Copy link
Contributor

tinloaf commented Mar 10, 2014

@wickedshimmy The problem is that I don't see how to differentiate between "no internet connection" and "background data restricted" with that code. Do you know if any of these checks explicitly only fails if background data is restricted?

@wickedshimmy
Copy link
Contributor

No, that was sort of my point -- since ICS you can't. If you query the
network state, you can get yes/no, but not why. Even the detailed info
doesn't expose that setting on its own. That would work for either
foreground or background services (if I can't send because the network
isn't available, alert), but the problem specifically here is that the
background play services isn't running any TS code, so there's no pace to
make that check and warn what happened, and for cases like the above the
availability can differ from app to app even with the same network info and
permissions, so checking this ahead of time or from TS is also no good.
There might be another API to use, but I don't think this one will work.
Sorry for being unclear!

@behrmann
Copy link

Is it confirmed now, that the Problem is with restricted background data? I just wonder, because I habe not restricted background data and habe both been the party to not receive PUSH messages and to send PUSH messages that have not been received (with two different communication partners).

@joshproehl
Copy link

I have confirmed that neither of the devices I'm having trouble with have restricted background data enabled. The one that is having the most trouble sending/receiving does wander through areas of reduced cell service, but still fails to send messages that are created once it's back in a good service area until much later, all with no indication to the sending user that the message has not been delivered.

@rbieb
Copy link

rbieb commented Mar 11, 2014

I don't have background data restricted, yet still can't send any messages.

@JavaJens
Copy link

@Nordic89 can't you sent messages altogether or are they delayed heavily?

@tinloaf
Copy link
Contributor

tinloaf commented Mar 11, 2014

By the way: Restricting background data should never interfere with sending messages. If you can't send messages, something else is wrong...

@rbieb
Copy link

rbieb commented Mar 11, 2014

@JavaJens Sms work just fine, I can't send any messages whatsoever by using data. They are not just delayed, they never arrive. I receive messages just fine.

@behrmann
Copy link

@JavaJens: Sending never seems to be the problem (at least not in the cases I witnessed), but very late delivery/no delivery of messages is and the latter always seems to be a one-sided problem.

@JavaJens
Copy link

But it his comment @Nordic89 clearly said "I can't send any messages",
thats why I was asking. Because these should be unrelated.
The idea behind my question was, is something wrong with Nordics setup,
e.g. do you get any errors leading to your assumption that sending doesn't
work or are just all of your recipients not receiving.
@tinloaf hence my question :)
Maybe I didn't express my self clearly enough, sorry.

@rbieb
Copy link

rbieb commented Mar 11, 2014

@JavaJens That's right. I can not send any messages (via push, that is). I'm registered at the server and I don't personally see anything wrong when I try to send a message, but they just don't ever arrive.

@JavaJens
Copy link

Could you provide a debug log? Maybe we can see an error message in the
logs.

@rbieb
Copy link

rbieb commented Mar 11, 2014

Don't know if that helps. http://hastebin.com/losawogiji I just tried to send another message, but I don't exactly know what the log logs, so it might not be included. If you need anything else just tell me what to do.

@Mihahn
Copy link

Mihahn commented Sep 7, 2015

@Wikinaut the android version on his phone is 4.1.2, I guess, but I have no idea where to find such settings on an lg rom. But I'll check it again anyway!

@jeremymasters
Copy link

Split off my stuff as new issue #4052 since symptoms weren't exactly the same.

@donateur
Copy link

As a follow up to my own previous post, I've now tried "push notifications fixer" from Google play with various settings but no success.

Now I've been paying attention to it, I've found that all text secure messages sent to me are delayed if I have another app in the foreground. It's really frustrating!

Unless it's the only way is to regenerate new keys (or reinstall the app) I'm not prepared to do that as I've got a lot of people using text secure who I often talk with. It seems crazy to have to ask them all to accept a new random key from me, keys shouldn't change for no significant reason.

If anybody has any suggestions or knows anything I can do to ensure GCM will work reliably with Text secure please let me know. (I seem to get gmail in a timely manner)

@moxie0
Copy link
Contributor

moxie0 commented Sep 11, 2015

if you just unregister and reregister, your keys won't change

On 09/10/2015 06:26 AM, donateur wrote:

As a follow up to my own previous post, I've now tried "push
notifications fixer" from Google play with various settings but no success.

Now I've been paying attention to it, I've found that all text secure
messages sent to me are delayed if I have another app in the foreground.
It's really frustrating!

Unless it's the only way is to regenerate new keys (or reinstall the
app) I'm not prepared to do that as I've got a lot of people using text
secure who I often talk with. It seems crazy to have to ask them all to
accept a new random key from me, keys shouldn't change for no
significant reason.

If anybody has any suggestions or knows anything I can do to ensure GCM
will work reliably with Text secure please let me know. (I seem to get
gmail in a timely manner)


Reply to this email directly or view it on GitHub
#970 (comment).

http://www.thoughtcrime.org

@donateur
Copy link

@moxie0 Thanks, I hadn't realised that!

Unfortunately I cannot actually unregister as the app keeps crashing after I click OK on the OK in the dialog box, this happens even after a reboot of android. Could this be a hint toward the cause of the delayed messages?
I've sent logs via the crash report with the URL to this conversation as text.

PS: Thanks for your work on this great app! Textsecure is the first fully encrypted messaging app which I've been able to get nontechnical members of my family using. It's seamless to them (aside from this unfortunate problem which also affects my mom anyway!).

@donateur
Copy link

It seems to be in some kind of in between state now. One user reported problems messaging me, until I messaged him.
Also I no longer get the second confirmation tick for message delivery, even after the other person has replied to my message.
Is this now a separate issue?

Thanks

@donateur
Copy link

Ok, I'm unregistered from secure messages, even though the app crashed while doing so. The app believes I'm still using secure messages though.
In short: I can send but not receive secure messages in this state.

@moxie0
Copy link
Contributor

moxie0 commented Sep 11, 2015

Please post a debug log

@donateur
Copy link

@moxie0
Copy link
Contributor

moxie0 commented Sep 11, 2015

Looks like you don't have google play services installed, or your gapps install is otherwise messed up. That is the cause of both the crash as well as your failure to receive notifications.

@donateur
Copy link

OK, any suggestions please?

I'm not aware of problems with any apps or google services.
I can try flashing a gapps zip?

@bonanza123
Copy link

@donateur try using a gapps zip from http://opengapps.org/

@donateur
Copy link

@bonanza123 Thanks! I hadn't heard of that site before.

I was able to flash the Google Apps without problem, and cleared caches, but after reboot TextSecure still wouldn't let me unregister/re-register for Secure Messages.
I'm afraid to report that in frustration (I was ill at the time) I ended up reinstalling TextSecure, which along with regenerating my keys (darn, missed that in the backup!) resolved the problem. As far as I can tell all my messages are now delivered on time, even if TextSecure isn't in the foreground.

This doesn't resolve the problem my mom has, as her phone is running stock Android. I'll try to get more evidence/debug log.

Thanks for your help guys.

@McLoo
Copy link
Contributor

McLoo commented Sep 16, 2015

Just opened EDIT: and unlocked TS and received a message from 16 hours ago. Used the phone all day long expect for TS.
Battery always 75%+
https://gist.github.com/6a868f5e04079c1f8e49

The other day was similar, though I opened TS only some hours after the message was sent https://gist.github.com/anonymous/c916ce1fb7ea807760d9

@merkste
Copy link

merkste commented Sep 20, 2015

Maybe these information are already known. I've already posted them in #4070.

Needless to say that none of the usual explanations like using Titanium fits here.
I wonder, whether it might possible to detect those situations automatically and fix it or request user action?

@wizardofid
Copy link

In my case the problem was solved with upgrade to TS 2.26.5. But i can't tell the reason, because PlayStore forced me remove some apps and i also upgraded some Google-apps at the same session.
So it could have been:

@jnachtigall
Copy link

I reported on this issue 18 months ago. I fixed it back then by reregistering. Haven't had the problem again since then.

Maybe this very broad and general ticket could be closed. I do not know if any of the other early reporters have seen the issue of missed/delayed messages again lately?

@janvlug
Copy link

janvlug commented Dec 20, 2015

I support the idea to close this broad general ticket. I haven't had any delivery issues lately.

@agrajaghh
Copy link
Contributor

closing, please reopen if you encounter this again...

@Frankstar
Copy link

i also have this problem on the phone from my wife. (fairphone - latest updates) i tried everything/alot, gapp reinstall, google services to latest version, Push Notifications Fixer (changed nothing) .... - mobile internet working fine. also if the app is in foreground everything is fine. a few seconds after close - everything fine. but then after 5minutes or 2 or 30min , no messages

@Wermorl
Copy link

Wermorl commented Jan 4, 2016

Just for the record: My Problem is solved, without changing something. The problem started in January last year out of nowhere. I know now, it was a GCM issue. The same day jnachtigall commented two weeks ago the problem was solved without changing something. All other GCM apps started working again too which did not work for the last year too. To make that clear again: I haven't changed any google settings or anything related on this phone since months, because I already gave up on this issue.

@jnachtigall
Copy link

@Frankstar I think you should send the Signal debug logs from your and your wife's phone (See the point Debug logs under https://github.com/WhisperSystems/Signal-Android/wiki/Submitting-useful-bug-reports#how-to-capture-data)

@Frankstar
Copy link

well, thats weird.
My Wife dont Update Apps she dont use - so there was an Update for Google+ and Gmail.
I updated both and now its working without a problem on mobile data and wifi.

@AlfonsoMuskedunder
Copy link

@Frankstar I've owned a Fairphone before, and part of what you describe sounds familiar to me.

After every update to, say, a new FP OS, my phone wouldn't connect to Play Services, so that Google Cloud Messaging wouldn't work. After a week or so, my phone would automatically connect to Play Services again. Before that, an update of an arbitrary existing app or the download of a new one would lead to a connection, so that Signal messages would be received again. See a post in the FP forum: https://forum.fairphone.com/t/phone-not-connected-to-google-play-services-after-every-reboot/6279

If the behavior reappears, you could enter *#*#426#*#* in your FP's dialer to test whether a missing connection to Play is the root of the problem. If so, the phone would be to "blame", not Signal.

@Frankstar
Copy link

@AlfonsoMuskedunder
Ok, but the Updade was months ago - it never connect on its own.
Also the Apps worked in Foreground and we/she downloaded things from Play Store without a Problem.
Anyway - i never blamed Signal for that behavior - but i like to Update "Threads" like this for others that run in similar issues.

Ty for the tip (*#*#426#*#*)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests