parse-community / parse-community/parse-server

Parse Server LiveQuery not updating after client reconnect

Open
#8,019 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

Hi Folks,

Issue Description

We stumbled upon strange behavior of LiveQuery subscription.
As long as the React Native app keeps open connection to Parse server all the websockets (all class subscriptions) are working just fine
and the subscription update event is sent after any of the objects change.
Now, once the client disconnects (app goes to background) and reconnects again (app is started) the subscription got all renewed and start working except for only one Parse class where UPDATE is never triggered ever since.

Logs

Looking into the logs, this specific class behaves as follows:

1. CLIENT NORMALLY CONNECTED (SUBSCRIPTION UPDATE running just fine)

verbose: ClassName: Effector | ObjectId: undefined
verbose: Current client number : 1
verbose: Original {“createdAt”:“2022-01-26T21:19:57.968Z”,“updatedAt”:“2022-06-01T08:57:59.389Z”,“effectorType”:{“__type”:“Pointer”,“className”:“EffectorTypes”,“objectId”:“Cmjjsh7rY5”},“alias”:“ELEWACJA”,“commandChannel”:“safeh/cmnd/tasmota_ED6E47/POWER”,“stateChannel”:“safeh/stat/tasmota_ED6E47/RESULT”,“name”:“tasmota_ED6E47”,“state”:“ON”,“stateFormula”:“POWER”,“room”:{“__type”:“Pointer”,“className”:“Room”,“objectId”:“mI7FKSenDO”},“ip”:“192.168.20.140",“description”:“1.1_elewacja_swiatlo”,“__type”:“Object”,“className”:“Effector”,“objectId”:“taS_ED6E47"} | Current {“createdAt”:“2022-01-26T21:19:57.968Z”,“updatedAt”:“2022-06-01T08:57:59.529Z”,“effectorType”:{“__type”:“Pointer”,“className”:“EffectorTypes”,“objectId”:“Cmjjsh7rY5”},“alias”:“ELEWACJA”,“commandChannel”:“safeh/cmnd/tasmota_ED6E47/POWER”,“stateChannel”:“safeh/stat/tasmota_ED6E47/RESULT”,“name”:“tasmota_ED6E47”,“state”:“OFF”,“stateFormula”:“POWER”,“room”:{“__type”:“Pointer”,“className”:“Room”,“objectId”:“mI7FKSenDO”},“ip”:“192.168.20.140",“description”:“1.1_elewacja_swiatlo”,“__type”:“Object”,“className”:“Effector”,“objectId”:“taS_ED6E47"} | Match: true, true, true, true | Query: Effector:|[]
verbose: Push Response : “{\“op\“:\“update\“,\“clientId\“:\“169eccea-af3d-4fc7-b42c-7b4fd541fafa\“,\“installationId\“:\“1168bf5b-33df-4bf7-b301-488ee0ff12cb\“,\“requestId\“:2,\“object\“:{\“createdAt\“:\“2022-01-26T21:19:57.968Z\“,\“updatedAt\“:\“2022-06-01T08:57:59.529Z\“,\“effectorType\“:{\“__type\“:\“Pointer\“,\“className\“:\“EffectorTypes\“,\“objectId\“:\“Cmjjsh7rY5\“},\“alias\“:\“ELEWACJA\“,\“commandChannel\“:\“safeh/cmnd/tasmota_ED6E47/POWER\“,\“stateChannel\“:\“safeh/stat/tasmota_ED6E47/RESULT\“,\“name\“:\“tasmota_ED6E47\“,\“state\“:\“OFF\“,\“stateFormula\“:\“POWER\“,\“room\“:{\“__type\“:\“Pointer\“,\“className\“:\“Room\“,\“objectId\“:\“mI7FKSenDO\“},\“ip\“:\“192.168.20.140\“,\“description\“:\“1.1_elewacja_swiatlo\“,\“__type\“:\“Object\“,\“className\“:\“Effector\“,\“objectId\“:\“taS_ED6E47\“},\“original\“:{\“createdAt\“:\“2022-01-26T21:19:57.968Z\“,\“updatedAt\“:\“2022-06-01T08:57:59.389Z\“,\“effectorType\“:{\“__type\“:\“Pointer\“,\“className\“:\“EffectorTypes\“,\“objectId\“:\“Cmjjsh7rY5\“},\“alias\“:\“ELEWACJA\“,\“commandChannel\“:\“safeh/cmnd/tasmota_ED6E47/POWER\“,\“stateChannel\“:\“safeh/stat/tasmota_ED6E47/RESULT\“,\“name\“:\“tasmota_ED6E47\“,\“state\“:\“ON\“,\“stateFormula\“:\“POWER\“,\“room\“:{\“__type\“:\“Pointer\“,\“className\“:\“Room\“,\“objectId\“:\“mI7FKSenDO\“},\“ip\“:\“192.168.20.140\“,\“description\“:\“1.1_elewacja_swiatlo\“,\“__type\“:\“Object\“,\“className\“:\“Effector\“,\“objectId\“:\“taS_ED6E47\“}}”
verbose: RESPONSE from [POST] /parse/batch: {
  “response”: [
    {
      “success”: {
        “updatedAt”: “2022-06-01T08:57:59.529Z”
      }
    }
  ]
} {“result”:{“response”:[{“success”:{“updatedAt”:“2022-06-01T08:57:59.529Z”}}]}}

2. CLIENT NORMALLY RECONNECTED (SUBSCRIPTION UPDATE not triggered)

verbose: ClassName: Effector | ObjectId: undefined
verbose: Current client number : 1
verbose: Original {“createdAt”:“2022-01-26T21:19:57.968Z”,“updatedAt”:“2022-06-01T09:00:11.929Z”,“effectorType”:{“__type”:“Pointer”,“className”:“EffectorTypes”,“objectId”:“Cmjjsh7rY5”},“alias”:“ELEWACJA”,“commandChannel”:“safeh/cmnd/tasmota_ED6E47/POWER”,“stateChannel”:“safeh/stat/tasmota_ED6E47/RESULT”,“name”:“tasmota_ED6E47”,“state”:“OFF”,“stateFormula”:“POWER”,“room”:{“__type”:“Pointer”,“className”:“Room”,“objectId”:“mI7FKSenDO”},“ip”:“192.168.20.140",“description”:“1.1_elewacja_swiatlo”,“__type”:“Object”,“className”:“Effector”,“objectId”:“taS_ED6E47"} | Current {“createdAt”:“2022-01-26T21:19:57.968Z”,“updatedAt”:“2022-06-01T09:00:12.111Z”,“effectorType”:{“__type”:“Pointer”,“className”:“EffectorTypes”,“objectId”:“Cmjjsh7rY5”},“alias”:“ELEWACJA”,“commandChannel”:“safeh/cmnd/tasmota_ED6E47/POWER”,“stateChannel”:“safeh/stat/tasmota_ED6E47/RESULT”,“name”:“tasmota_ED6E47”,“state”:“OFF”,“stateFormula”:“POWER”,“room”:{“__type”:“Pointer”,“className”:“Room”,“objectId”:“mI7FKSenDO”},“ip”:“192.168.20.140",“description”:“1.1_elewacja_swiatlo”,“__type”:“Object”,“className”:“Effector”,“objectId”:“taS_ED6E47"} | Match: false, false, false, false | Query: Effector:room|[{“$inQuery”:{“className”:“Room”,“where”:{“home”:{“__type”:“Pointer”,“className”:“Home”,“objectId”:“F0Z6mCkVps”}}}}]
verbose: RESPONSE from [POST] /parse/batch: {
  “response”: [
    {
      “success”: {
        “updatedAt”: “2022-06-01T09:00:12.111Z”
      }
    }
  ]
} {“result”:{“response”:[{“success”:{“updatedAt”:“2022-06-01T09:00:12.111Z”}}]}}

In case 2) the Match resulted with [Match: false, false, false, false] and the query looks to be different even though there were no changes with respect to this.
Note: this only happens to this particular Class (having a Pointer to Room one). All other classes’ subscription are running just fine after CLIENT RECONNECTS

Steps to reproduce
  1. A JS Parse app with LiveQuery client up & running
  2. Temporarily disconnect connection
  3. After reconnection LiveQueryClient is no longer receiving updates from parse-server for some classes.
Actual Outcome

After reconnection LiveQueryClient is no longer receiving updates from parse-server for some classes.
Match is false in logs

Expected Outcome

After reconnection LiveQueryClient should receive all updated from parse-server.

Environment

Server

  • Parse Server version: 5.2.0 (docker : latest)
  • Operating system: Ubuntu 20.4 LTS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): self hosted raspberry pi

Database

  • System (MongoDB or Postgres): Postgres
  • Database version: 13
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Javascrpt

Is it a bug? Any tips or debug steps are appreciated!

Regards

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue using the listed LiveQuery reconnect steps and compare the logged subscription query and Match results before and after reconnection. Investigate the affected class with its Room pointer; done means the reconnected client receives updates for that class as well as the other subscriptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, postgresql
Domain
api, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.