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

macOS app disconnects on idle #122

Open
melange-GRX opened this Issue Oct 13, 2018 · 20 comments

Comments

Projects
None yet
2 participants
@melange-GRX

melange-GRX commented Oct 13, 2018

After a moment or so in the background, the desktop client stops pinging the server, and does not respond to ping requests from the server even if the screen is not locked and the user is actively working in other applications. No messages will be received until the user opens the Monal window, at which point a notification appears about connecting to the server.

I understand the advantages of push notifications on the mobile side, but on the desktop side, is there a setting or something I am missing to keep the user connected? Trillian and Converse (via HTTP) behave differently on the desktop and mobile (push on mobile, ping on the desktop), so I am wondering if I am missing a setting, if the connection is purposefully closed from the client (this is what is appears to be), or if this is a bug with the XEP-0199 handling?

Using 2.1.2 (85) on Mojave.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Oct 13, 2018

This sounds like a bug. The Mac client is a normal xmpp client. I haven’t tested on Mojave yet will do

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 7, 2018

Have you tried the newest beta build on monal.im ? I am wondering if this was simply solved by building with the Mojave sdk (that has happened in the past)

@melange-GRX

This comment has been minimized.

melange-GRX commented Nov 11, 2018

Yes, I have tried Version 2.2 (89). The problem does not seem to be resolved. I launch the app, and I see a session from Monal-OSX.73 on my XMPP server. I also launch Aduim with my test account logged in, so I see them both online. Then I keep working as usual, with the Monal window still open but in the background. Five minutes later, I check the server, and the Monal session is closed while the Adium session is still open. I tried a test message from the test account to the one Monal is using - no notification, nothing. As soon as I try and send a message in Monal, it reconnects, and I get the message I missed plus my new one goes to Adium.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 11, 2018

Hmm this is strange. I use it as my desktop client and have not had this issue. Out of curiosity, could it be that your server is disconnecting it because of at time out? It might be an issue with the ping frequency I currently have it to ping every 60 seconds. It also sets the client as inactive when the window goes to the background. I've never heard of it disconnecting. I'll keep looking.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 13, 2018

I found one possible issue that could cause the connection to hand that I've fixed in iOS. I just put out a new Mac beta. Could you let me know if it helps?

@melange-GRX

This comment has been minimized.

melange-GRX commented Nov 13, 2018

It fixed the issue partially. The client no longer disconnects on idle, but there must be at least one active chat. So if all of my contacts are offline or close their chat windows, my client disconnects, and I won't get notifications for new messages.

Push notifications are not an option in our infrastructure, so we keep a couple hundred clients connected all day, but people generally close the chat until they need to chat with someone.

I am trying to get Wireshark working again under Mojave to get you more info.

P.S. - I really like the new dark mode, and truly appreciate the attention to this issue sooo much.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 13, 2018

Thanks. I don’t have any Mojave devices (my Macs are too old) working on getting one up and running to test this.

Mac client doesn’t have any push support, need planned on it. I will enable a debug menu on the Mac so you can view all the events in a window.

What server are you runnin our of curiosity? I really want to resolve this, it’s very weird and you are probably not the only person impacted

@melange-GRX

This comment has been minimized.

melange-GRX commented Nov 13, 2018

I'm connecting to a CloudFire server, but I can also replicate this with XMPP.jp, although setting up buddies has been unreliable there.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 13, 2018

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 14, 2018

I have Mojave installed and am testing on xmpp.jp and haven’t had any disconnects. Will test more tonight.

@melange-GRX

This comment has been minimized.

melange-GRX commented Nov 14, 2018

I did not either at first, because the welcome message from the robot admin kept the connection up.I had to remove the account and re-add it, so that I had nothing under the "Active Chat" tab.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 14, 2018

Ok, Ive closed all active chats and am currently connected on Mojave as monal1@xmpp.jp . Will observe when it diconnects.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 15, 2018

Oh I think I have identified the issue. App nap. (https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/AppNap.html) Monal is app nap enabled and it was never a problem before. However there appears to have been a change in the logic in Mojave where UI work can stop app nap.. which would bring the strange behavior linking the UI to networking.
Monal has a regular ping that should keep things open but I think you have identified a worst case scenario where the ping/network activity isn't frequent enough and the connection times out.

Working on a fix.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 15, 2018

Ive posted a new build with the fix. I do not see it napping anymore. I think the dark mode is mostly complete now too. canyon verify the fix so we can close this story.

@melange-GRX

This comment has been minimized.

melange-GRX commented Nov 15, 2018

It's a lot better, but still disconnects over time. If I just leave it and Safari open, and then click to change the focus rapidly back and forth between Monal and Safari, I can see a notification about my account connecting. I can't quite pin it down. If the application is in the foreground and the window open, it behaves perfectly. As soon as the window is closed, backgrounded, or hidden - it seems to disconnect at irregular intervals.

I think I really need Wireshark to see what Adium, Swift, and Wime are doing differently that is keeping them connected. I'll try and work on that more over the weekend. Sorry.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 15, 2018

Wireshark will be tricky because everything uses SSL so your traffic will be encrypted. Monal is a sandboxed app so ill have to see what changed in the sandbox. This is definitely one of the strangest issues . Glad the updates have progressively made it better. When it disconnects is it for a long time or does it immediately reconnect?

@melange-GRX

This comment has been minimized.

melange-GRX commented Nov 15, 2018

Monal does indeed immediately reconnect whenever the app is brought into the foreground again after a disconnect. I feel terrible about bringing you this issue - and I appreciate so much that you're looking into it.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 15, 2018

do you see a notification that is reconnects immediately when it is in the background? I have certainly seen other clients disconnect and reconnect. If it is staying disconnected, thats a problem. Dot feel bad im glad each iteration it is improving things.

@melange-GRX

This comment has been minimized.

melange-GRX commented Nov 15, 2018

Yes, I see the notification. So what I see logged in as another user on the InVerse web interface is that Monal goes offline after about five minutes. If I send a message, the server queues it up. Then I click on the Monal window, and I immediately see a notification that my account has connected, and I see myself switch to available on InVerse.

@anurodhp

This comment has been minimized.

Owner

anurodhp commented Nov 15, 2018

got it, thats not a good experience.

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