TextSecure icon indicating copy to clipboard operation
TextSecure copied to clipboard

Huge message delays

Open mjtorn opened this issue 9 years ago • 34 comments

Hi!

I recently downgraded/switched from Signal (off of Google Play) to the Jolla Edition, version 3.3.1, and noticed messages are sometimes delayed.

Since Moxie doesn't like different builds (open-source cat-herding can be a pain) I'll ask here first: is there any kind of wake-up delay interval thingies for polling messages? Do the sockets get closed and not often reopened?

Anything that might explain having only one tick on sending messages and not receiving anything, until three hours' worth of messages come in as a burst?

The missus and I would really love to get off Whatsapp and I wanted to get off Google so this fork is pretty much the only hope we have currently.

Thanks!

mjtorn avatar Dec 22 '15 18:12 mjtorn

You can try to get a debug log. There shouldn't be any artificial delay. Iirc there might be an exponential backoff if there are connection problems.

JavaJens avatar Dec 23 '15 09:12 JavaJens

https://gist.github.com/anonymous/68e8573064d73ec6cafb

I was kind of hoping for more...

Should it log about websockets? Could it be made to? ;)

mjtorn avatar Dec 23 '15 10:12 mjtorn

There is no log in there :wink:

I don't know if there is sth. special about Jolla. Maybe try adb?

JavaJens avatar Dec 23 '15 12:12 JavaJens

What's adb?

Yeah, unfortunately I don't have any contact to whomever built the Jolla Edition, but afaik it's 3.3.1 from this fork with no changes.

mjtorn avatar Dec 23 '15 13:12 mjtorn

I can confirm that occasionally I also get long delays between messages. I think it has something to do with the screen being off, as it only happens when the app is in the background. Also on version 3.3.1 - I need to update and see if that fixes it, it may just be a bug in 3.3.1 that got fixed in a later commit

relyt29 avatar Dec 24 '15 03:12 relyt29

adb http://developer.android.com/tools/help/adb.html

The most likely assumption that I can make is that some power savings mode kicks in. Could that be the case?

JavaJens avatar Dec 24 '15 07:12 JavaJens

Oh man.. That ADB thing looks like quite the hurdle, I'll have to see about whether or not that's worth it, really, when simple "lost the socket" and "could not reconnect, backing off for $t seconds" debug logging could cut it.

Very little sample data on this, but the messages worked pretty fast over wifi, so maybe something like the exponential backoff theory could be true.

Besides that, maybe I'll wish for a new build to hit the Jolla store for xmas ;)

mjtorn avatar Dec 24 '15 11:12 mjtorn

Usually the log from the menu should suffice, maybe just try again?

JavaJens avatar Dec 24 '15 16:12 JavaJens

Sorry @JavaJens but I have to ask you to explain this to me like I'm five ;) The gist above is the debug log, so you probably don't mean that, right?

If you mean a log from a menu in ADB, I'll need to have ADB running first, which is probably a huge hassle. This especially as Jolla's OS, SailfishOS, is a Linux with Alien Dalvik for Android support, so who knows how it'll work out.

mjtorn avatar Dec 25 '15 12:12 mjtorn

FWIW I found some online presence for the guy buildling this for us, so I pinged him in the only way I could find.

mjtorn avatar Dec 25 '15 12:12 mjtorn

@mjtorn iam using 3.8.1 from this repository on my blackberry and i dont have any delays. Have you tried compiling the latest version from javajens?

ton-io avatar Dec 25 '15 13:12 ton-io

@ton-io that's good news! Blackberry is not Jolla, of course, but that gives me hope.

I have not tried compiling it, because I have no idea about how to make it look like @llelectronics build of it, and I don't want to confuse my phone by installing different versions.

It's idealistic to expect things like this to Just Work but there is a pain threshold in going in deep for debugging, so I'd rather just wait for the next "official" release and get back to this issue after that.

And still hoping there'd be debug logging about the state of sockets and maybe powersaving, as it sounds like adb on sailfish is not easy.

mjtorn avatar Dec 25 '15 14:12 mjtorn

@mjtorn yes, I mean the gist. Usually this contains all debug information you get through adb without the hassle. If this doesn't work, I fear adb is the only way.

JavaJens avatar Dec 25 '15 22:12 JavaJens

Well, there's nothing there in the debug log. Like if I try to access my contacts, I don't see any (not sure if this warrants a new issue, as this happened with upstream Signal as well and obviously Jolla/Sailfish is completely unsupported) there's nothing about "no contacts found" in the debug log either.

Let's keep this issue open and see if this works at all and then I may consider adb.

(I really wish people weren't afraid of extreme logging settings and advanced options)

mjtorn avatar Dec 26 '15 11:12 mjtorn

For contacts did you check if it is allowed for android apps to have access to contacts? If it isn't that would explain this issue.

llelectronics avatar Dec 26 '15 11:12 llelectronics

For contacts: Probably related https://github.com/WhisperSystems/Signal-Android/issues/4943

mimi89999 avatar Dec 26 '15 13:12 mimi89999

@llelectronics it's not that. It's on by default and if I turn it off, Signal crashes without any greater ceremony or grace.

https://gist.github.com/anonymous/ae6fc99138a7818acf6b

Not sure at all what's happening with android.media.AudioAttributes$Builder but yeah. It's not about the contacts access.

mjtorn avatar Dec 26 '15 14:12 mjtorn

Maybe it could be related to upstream issues, but I did see the contacts list for a while with this Jolla Edition / JavaJens build, and then it vanished and never returned.

mjtorn avatar Dec 26 '15 14:12 mjtorn

@JavaJens There will be huge message delays in android 6. Please look at: https://developer.android.com/training/monitoring-device-state/doze-standby.html :-(

mimi89999 avatar Dec 26 '15 14:12 mimi89999

Hmh, but with wifi, things seem to work, so despite how the missus might have configured or updated, I still like to think there's something screwy with mobile internet and websockets...

We'll be looking into her Android version and that URL I'm sure, thanks!

mjtorn avatar Dec 26 '15 17:12 mjtorn

Note: Google Play policies prohibit apps from requesting direct exemption from Power Management features in Android 6.0+ (Doze and App Standby) unless the core function of the app is adversely affected.

So, stupid question, @mimi89999 but isn't a messager exactly the kind of thing whose core is adversely affected? Therefore these apps should be exempt, yes?

I just heard she's sometimes wondered why she hasn't received Whatsapp messages either, and after digging her phone from her purse, she gets a burst of messages.

But even that does not explain why sending me messages (while I'm on mobile internet) from a wifi (eg. my place) do not arrive.

So it still could be something about mobile internet and websockets on my part :(

mjtorn avatar Dec 26 '15 17:12 mjtorn

@mjtorn capture du 2015-12-26 21-06-02

mimi89999 avatar Dec 26 '15 20:12 mimi89999

@mjtorn "Note: Google Play policies prohibit apps from requesting direct exemption from Power Management features in Android 6.0+ (Doze and App Standby) unless the core function of the app is adversely affected." "Google Play policies" only apply to apps published in the Play Store...

mimi89999 avatar Dec 26 '15 20:12 mimi89999

@mjtorn there is heavy logging in the app, but I'm afraid this is a limitation of Jolla.

JavaJens avatar Dec 26 '15 21:12 JavaJens

@mimi89999 Yeah, saw that note as well, but didn't read through it well enough to worry about whether or not IM apps are prohibited or allowed.

@JavaJens thanks for the info, at least that's something I can bring up somewhere, maybe, to ask why there's nothing sticking to the debug log.

mjtorn avatar Dec 27 '15 09:12 mjtorn

I snuck the debug log off of her normal Signal installation and it's all a lot more verbose

https://gist.github.com/anonymous/625d7ed1bd9a14aa273f

Interesting that the mainstream client would use websockets? Am I interpreting something wrong here?

mjtorn avatar Dec 27 '15 09:12 mjtorn

@mjtorn If it was using WebSockets, then there would be wss:// somewhere in the log...

Edit: Sorry, there is "wss://" in line 296. I was writing non-sense :-(

mimi89999 avatar Dec 27 '15 11:12 mimi89999

@mjtorn I found a WebSocket echo test: https://www.websocket.org/echo.html

mimi89999 avatar Dec 27 '15 11:12 mimi89999

@mjtorn The regular client uses websockets while the app is open. This is used to prevent the delay introduced by GCM. But as battery usage increases with websockets, the socket is closed when the app is in the background.

In her log you see a timeout exception reaching the server, maybe similar things are happening to you?

JavaJens avatar Dec 27 '15 12:12 JavaJens

@mimi89999 Testing that with the browser over 3G works.

@JavaJens The timestamps in her log are mainly early morning, so probably the app was in the background at the time. Well, I need to figure out how to enable logging here so I can check if I have wss:// somewhere in the log that I just can't see.

But that cleared why there were mentions of websockets, at least :)

PS. Sent a message to her just now and it worked just fine. She's on 4G and when I switched to 3G, I got stuck with only one tick. Switching back to WLAN pushed out the messages.

Going to try to look at /opt/alien/system/bin/logcat at some point. Too bad I can't be in on my phone over 3G, that local access isn't as good as ssh, and that it doesn't provide me with timestamps or a clear idea of which app is doing what :D But maybe something will stick.

mjtorn avatar Dec 28 '15 09:12 mjtorn