RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.51k stars 10.56k forks source link

Users getting session timeout and don't recieve messages/sent messages are greyed out #12206

Open maik28 opened 6 years ago

maik28 commented 6 years ago

Description:

Diverse users are getting in different times a session timeout although expiration day is set to 90 days. After reconnecting there are several problems with sending and receiving messages in direct message and channels. Occurs in web browser as well as in rc-client.

Steps to reproduce:

  1. User A gets disconnected and logs in again.
  2. User A sends a message to any User B.
  3. The sent message is greyed out for user A/User B receives message ordinarily.
  4. Now if user B sends a message to user A, he can see "User B is typing" and he gets a new message notification, but there are no new messages visible for User A in chat window.
  5. Refreshing browser cache or relogin solves this bug.

Expected behavior:

Actual behavior:

Server Setup Information:

Additional context

In browser console for the greyed out message: id=123xyz“ class=“message background-transparent-dark-hover own temp“

Relevant logs:

Couldn't lookup logs yet.

reetp commented 6 years ago

Can you please test on latest 0.70.x please. You probably need to post some logs as well.

iostat commented 5 years ago

I've actually been noticing the same issue on our install. We have session timeout set to 90 days, however sometimes our users get logged out or have sent messages grayed out until they refresh and have to log in again. Upgrading Rocket.Chat did not help.

Found a bunch of this error in the instance logs, might be relevant?

I20190227-14:46:26.455(0) Exception in onLogin callback:
 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 

Instance details:

Rocket.Chat Version: 0.74.3 Apps engine version: 1.4.0 DB Migration: 137 DB Migration Date: Fri Feb 22 2019 20:09:59 GMT-0500 (Eastern Standard Time) Installed at: Thu Sep 27 2018 12:02:01 GMT-0400 (Eastern Daylight Time) Uptime: 4 days, 16 hours, 15 seconds OpLog: Enabled

iostat commented 5 years ago

Also saw this pop up numerous times before that loginAt exception. Probably also relevant given that this sounds like a DDP problem?:

I20190223-01:20:33.489(0) Exception in handling DDP reset:
 { MongoError: not master and slaveOk=false
     at queryCallback (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/cursor.js:248:25)
     at /app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:532:18
     at _combinedTickCallback (internal/process/next_tick.js:131:7)
     at process._tickDomainCallback (internal/process/next_tick.js:218:9)
  => awaited here:     at Function.Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
     at Promise.asyncApply (packages/mongo/mongo_driver.js:1042:14)
     at /app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
  => awaited here:     at Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:60:12)
     at SynchronousCursor._nextObject (packages/mongo/mongo_driver.js:1091:12)
     at SynchronousCursor.forEach (packages/mongo/mongo_driver.js:1105:22)
     at SynchronousCursor.map (packages/mongo/mongo_driver.js:1115:10)
     at SynchronousCursor.fetch (packages/mongo/mongo_driver.js:1139:17)
     at Cursor.(anonymous function) [as fetch] (packages/mongo/mongo_driver.js:887:44)
     at MongoConnection.findOne (packages/mongo/mongo_driver.js:794:56)
     at Object.<anonymous> (packages/matb33_collection-hooks.js:819:16)
     at Object.collection.(anonymous function) [as findOne] (packages/matb33_collection-hooks.js:146:21)
     at ns.Collection.findOne (packages/mongo/collection.js:356:29)
     at authorizeConnection (server/stream/streamBroadcast.js:41:38)
     at Connection.connections.(anonymous function).onReconnect (server/stream/streamBroadcast.js:95:12)
     at Connection._callOnReconnectAndSendAppropriateOutstandingMethods (packages/ddp-client/common/livedata_connection.js:1563:30)
     at Connection.onReset (packages/ddp-client/common/livedata_connection.js:1748:10)
     at runWithEnvironment (packages/meteor.js:1356:24)
     at packages/meteor.js:1369:14
     at forEachCallback.callback (packages/socket-stream-client/node.js:83:7)
     at Array.forEach (<anonymous>)
     at ClientStream.forEachCallback (packages/socket-stream-client/common.js:30:31)
     at ClientStream._onConnect (packages/socket-stream-client/node.js:82:10)
     at client.on.Meteor.bindEnvironment (packages/socket-stream-client/node.js:158:21)
     at runWithEnvironment (packages/meteor.js:1356:24)
   operationTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1550884829 },
   ok: 0,
   errmsg: 'not master and slaveOk=false',
   code: 13435,
   codeName: 'NotMasterNoSlaveOk',
   '$clusterTime':     { clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1550884829 },      signature: { hash: [Object], keyId: 0 } },
   name: 'MongoError',
   [Symbol(mongoErrorContextSymbol)]: {}
} 
joshmartindev commented 5 years ago

We're also having the same issue, but we don't have any exceptions in our logs.

dkoo761 commented 3 years ago

Also having the same issue but only when using the mobile web version on my Android phone. When it happens I see this in the logs:

Exception while invoking method loadMissedMessages Error: Invalid user [error-invalid-user]

That exception is thrown when Meteor.userId() is undefined, so it might just be a consequence of the logout and not actually related to it or part of the cause.