There is one user in our Rocket.Chat which is shown online all the time, even after the user has been logged out at all devices. An Error is being thrown everytime the user logs in/out.
I tried to manually set the status to "offline" in the Collection, but that didn't help.
A restart of the Rocket-Chat-Container fixes the error.
User should be displayed offline and no error should be thrown, the Rocket.Chat-Service should not need a restart.
user is displayed as online until services is restarted
error in console after user logout
TypeError: Cannot read property '_id' of null
at Accounts.onLogout.info (packages/rocketchat:statistics/server/lib/SAUMonitor.js:125:29)
at packages/callback-hook/hook.js:130:22
at _onLogoutHook.each.callback (packages/accounts-base/accounts_server.js:193:7)
at Hook.each (packages/callback-hook/hook.js:108:15)
at AccountsServer._successfulLogout (packages/accounts-base/accounts_server.js:192:24)
at MethodInvocation.methods.logout (packages/accounts-base/accounts_server.js:529:16)
at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12)
at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
at Promise (packages/ddp-server/livedata_server.js:715:46)
at new Promise (<anonymous>)
at Session.method (packages/ddp-server/livedata_server.js:689:23)
at packages/ddp-server/livedata_server.js:559:43
error in console after user login
TypeError: Cannot redefine property: loginAt
at Function.defineProperty (<anonymous>)
at Object.keys.forEach.p (packages/rocketchat:statistics/server/lib/SAUMonitor.js:279:12)
at Array.forEach (<anonymous>)
at SAUMonitorClass._updateConnectionInfo (packages/rocketchat:statistics/server/lib/SAUMonitor.js:278:22)
at Accounts.onLogin.info (packages/rocketchat:statistics/server/lib/SAUMonitor.js:120:9)
at packages/callback-hook/hook.js:130:22
at _onLoginHook.each.callback (packages/accounts-base/accounts_server.js:178:7)
at Hook.each (packages/callback-hook/hook.js:108:15)
at AccountsServer._successfulLogin (packages/accounts-base/accounts_server.js:177:23)
at AccountsServer._attemptLogin (packages/accounts-base/accounts_server.js:350:12)
at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:520:23)
at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12)
at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
at Promise (packages/ddp-server/livedata_server.js:715:46)
at new Promise (<anonymous>)
at Session.method (packages/ddp-server/livedata_server.js:689:23)
at packages/ddp-server/livedata_server.js:559:43
After user disconnection from web interface in MongoDB :
Then, restart Rocket.chat instance :
This still seems to be an issue in Rocket.Chat Server version 1.0.3.
up!
Now this problem is present in version 1.0.3.
p.s. snap install
up!!
my version is 1.0.3 too.
Same problem with 1.1.0 release
Help me Fix bug user is marked as "online" after logout , my version is 1.0.3 too.
Same as #14702
Same problem in version 1.1.1
Hi simillar problem after login. Another users do not see status change to active. When user manually change stauts, works correct. Another useres see change immediately.
I have tested on old 0.74.3 version and issue not exists.
In "/admin/users" status is presented in proper way, but on user details not. Exmaple on picture below.

Same problem in 1.1.2
I can reproduce the problem if I log out one account and do not close the browser window, but login again with another account on the same tab. The status of the first (now logged out) account remains "online".
Interestingly, when logging out of an account, the status of the account always stays "online" until I finally close the browser window.
Closing the browser window / tab after logging out is therefore the only way to avoid this error.
Btw: The setting "Accounts_ForgetUserSessionOnWindowClose" seems to have no effect on my installation.
Most helpful comment
This still seems to be an issue in Rocket.Chat Server version 1.0.3.