Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Users do not go Offline and always stay Online

Open CR0815 opened this issue 3 years ago • 4 comments

Problem: Since our update to 5.x (currently running 5.4.0) some users are always shown as Online even though they are not connected on any device. This results in no offline notification emails sent and confused users.

Details / attempts without success: Using the "Logout from other devices" function within the users profile does not change anything. Manually logging out from all clients (desktop, mobile) does not change anything. Deactivating / Locking the user as an Administrator does not change anything.

In all of those cases the user stays Online (which results in no offline email notifications beeing sent): image

Manually changing the status to Offline helps and changes the status, but would then stay Offline even if the user is online. Manually switching it back to Online changes the status, but now we are stuck again with beeing always Online (as before).

When Updating to 5.4.0 the affected users were automatically & directly online once RocketChat came online.

Old Bugreport with the identical issue: https://github.com/RocketChat/Rocket.Chat/issues/16455 (from 2020) https://github.com/RocketChat/Rocket.Chat/issues/27145 (October2022 to still open) https://github.com/RocketChat/Rocket.Chat/issues/27465 (opened today)

Logfiles: The server receives the Logout and it works as designed for most of the users:

{"level":35,"time":"2022-12-06T16:19:09.068Z","pid":8,"hostname":"REDACTED","name":"Meteor","method":"logoutCleanUp","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36","referer":"https://REDACTED/home","remoteIP":"REDACTED","instanceId":"REDACTED"}

{"level":35,"time":"2022-12-06T16:19:09.069Z","pid":8,"hostname":"REDACTED","name":"API","method":"POST","url":"/api/v1/method.callAnon/logoutCleanUp","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36","length":"27333","host":"REDACTED","referer":"https://REDACTED/home","remoteIP":"REDACTED","status":200,"responseTime":2}

Environment: Since the problem only affects a few instead of all users and only started recently, i do not believe that it is infrastructure related.

Running 2 Docker containers & natively running NGINX Reverse Proxy infront of it: image

Client: Docker Engine - Community Version: 20.10.21 API version: 1.41 Go version: go1.18.7 Git commit: baeda1f Built: Tue Oct 25 18:02:00 2022 OS/Arch: linux/amd64 Context: default Experimental: true

Server: Docker Engine - Community Engine: Version: 20.10.21 API version: 1.41 (minimum version 1.12) Go version: go1.18.7 Git commit: 3056208 Built: Tue Oct 25 17:59:53 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.10 GitCommit: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0

Rocket.Chat: Version der Anwendungs-Engine 1.36.0 Node-Version v14.19.3 Datenbankmigration 281 (6. Dezember 2022 17:25) MongoDB 5.0.8 / wiredTiger (oplog Aktiviert)

I can run additional tests or submit further logfiles if you want to test something.

CR0815 avatar Dec 06 '22 17:12 CR0815

Using https://github.com/RocketChat/Rocket.Chat/issues/27145 as a reference i tried my luck with resetting the sessions:

  • docker exec -it MongoDBDockerContainerNameHere mongo (since we are running Mongo in a Docker container)
  • use rocketchat
  • db.usersSessions.deleteMany({})
  • db.users.updateMany({status:"online"},{$set:{status:"offline"}})
  • exit

Now all users are Offline (even those that are Online and incl. rocket.cat which is now shown as offline too), but this fixes itself after a user closes/starts their Browser/App. Everything fine now!

Defenitely stuck entries in session table. Maybe add a cleanup into the "Logout from other/all devices function"?

CR0815 avatar Dec 06 '22 17:12 CR0815

same problem after update to 5.4

esnutd avatar Dec 06 '22 18:12 esnutd

same here since update from 4.8.* to 5.3.*

RocketChat 5.3.4
Mongo: 4.4.18 (oplog Enabled)
Node v14.21.1

db.usersSessions.deleteMany({}) This apparently helped with a few users, but not all.

tars21 avatar Dec 16 '22 09:12 tars21

Reproduced with 5.3.5

NoxInmortus avatar Dec 17 '22 10:12 NoxInmortus

same problem since update to 5.4.1

RedOne-Guerad avatar Dec 29 '22 17:12 RedOne-Guerad

Ich habe das Problem auch mit der Version 5.4.0. Der Admin ist dauerhaft online

mario2825 avatar Jan 04 '23 17:01 mario2825

Being able to see who is Online and Offline is a basic feature of any chat application. And still, this issue has been opened for two months, and nobody from RocketChat seems to have any interest.

I'm pretty sure there is a lot more impacted users than that this issue shows.

NoxInmortus avatar Feb 04 '23 09:02 NoxInmortus

Yes i agree , problem still persistent even on 5.4.2

AkimoA avatar Feb 04 '23 14:02 AkimoA

Me to, many users are persistent online...

q16marvin avatar Feb 09 '23 08:02 q16marvin

The problem persists on version 5.4.3. I hope there is still time to fix this on version 6.0+?

rrmt23 avatar Mar 01 '23 09:03 rrmt23

seems no one really is on about this would any of the devs mind pushing this ? @sampaiodiego maybe

AkimoA avatar Mar 01 '23 09:03 AkimoA

@ggazzo help

rrmt23 avatar Mar 01 '23 12:03 rrmt23

i have somewhat similar issue, push notifications are working for mobile app but desktop and browser are not, tried cleaning up sessions from mongodb and still no luck with desktop and browser, my main installation is 5.4.0 tried also with 6.0-rc6, and just for a test 4.5 and it worked on 4.5 rocketchat version.

Kot-o-pes avatar Mar 07 '23 13:03 Kot-o-pes

For us upgrading 5.4.5 from to 6.1.0 fixed the issue.

amottier avatar Apr 05 '23 08:04 amottier

Hi there, thanks for the contribution! 🚀 💯

Sorry, this error does not happen on the latest releases.


Questions? Help needed? Feature Requests?

hugocostadev avatar Apr 06 '23 12:04 hugocostadev

Can not confirm that its working on 6.1.1, autoaway is set to 60 but status remains the same (online) other users see account as offline

Kot-o-pes avatar Apr 13 '23 13:04 Kot-o-pes

I did have the problem while using the 5.x branch and fixed it by clearing the sessions as mentioned.

I've been on the 6.x branch for a few weeks now and have noticed that the stale session problem occurs again!

derjasa avatar May 27 '23 19:05 derjasa

The issue is still in 5.4.10 and the UsersSessions cleanup didn't solve the problem.

bseclier avatar Jun 20 '23 08:06 bseclier

I just experienced this bug on version 6.6.0. I adopted @CR0815 answer to write a simple script reset-sessions.sh to take care of this until the bug is resolved permanently.

#!/bin/bash
docker exec -it rocketchat-mongo-1 mongo --eval "\
    db = db.getSiblingDB('rocketchat'); \
    db.usersSessions.deleteMany({}); \
    db.users.updateMany({status:'online'},{'\$set':{status:'offline'}});"

Ideas why this bug returned?

pythys avatar Feb 16 '24 05:02 pythys

@pythys your script is not a workaround for the current issue.. the issue is just showing the correct status in the UI, the state that is stored in the database is correct at this time.

sampaiodiego avatar Feb 16 '24 13:02 sampaiodiego