powersync-ja / powersync-service

Other
124 stars 9 forks source link

diagnostics app: Closed. Original cause [Error: [429] Maximum active concurrent connections limit has been reached undefined]. #82

Closed Dieterbe closed 3 weeks ago

Dieterbe commented 1 month ago

i regularly run into this issue when trying to use the diagnostics app (https://diagnostics-app.powersync.com/login) against my local docker stack. the docker stack seems to work fine, it's a pretty basic setup, without much load. based on the django standalone demo

the logs don't show anything revealing:

powersync-1  | {"level":"info","message":"powersync_2_d37f replicating op 2443200 00000001/3E79F820","timestamp":"2024-09-15T17:39:09.490Z"}
powersync-1  | {"level":"info","message":"powersync_2_d37f replicating op 2443300 00000001/3E85A570","timestamp":"2024-09-15T17:39:09.661Z"}
powersync-1  | {"level":"info","message":"powersync_2_d37f replicating op 2443400 00000001/3E9007F0","timestamp":"2024-09-15T17:39:09.834Z"}
powersync-1  | {"level":"info","message":"powersync_2_d37f replicating op 2443500 00000001/3E9A64B8","timestamp":"2024-09-15T17:39:10.006Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T19:29:16.795Z"}
powersync-1  | {"duration_ms":187791,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T19:32:24.577Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T19:36:07.027Z"}
powersync-1  | {"duration_ms":88681,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T19:37:35.702Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T19:37:45.263Z"}
powersync-1  | {"duration_ms":298674,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T19:42:43.934Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T19:42:43.941Z"}
powersync-1  | {"duration_ms":280846,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T19:47:24.785Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T19:47:24.793Z"}
powersync-1  | {"duration_ms":260215,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T19:51:45.005Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T19:51:45.010Z"}
powersync-1  | {"duration_ms":290877,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T19:56:35.884Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T19:56:35.889Z"}
powersync-1  | {"duration_ms":280118,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T20:01:16.005Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T20:01:16.010Z"}
powersync-1  | {"duration_ms":279997,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T20:05:56.004Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T20:05:56.009Z"}
powersync-1  | {"duration_ms":279998,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T20:10:36.005Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T20:10:36.011Z"}
powersync-1  | {"duration_ms":259998,"level":"info","message":"POST /sync/stream","method":"POST","path":"/sync/stream","route":"/sync/stream","status":200,"timestamp":"2024-09-15T20:14:56.005Z"}
powersync-1  | {"level":"info","message":"New checkpoint: 38 | write: null | buckets: 2 [\"global[]\",\"user_lists[4]\"]","timestamp":"2024-09-15T20:14:56.009Z"}

image

stevensJourney commented 1 month ago

Does this happen while co-developing with a certain client SDK or is it only from continued (multiple reconnects) use of the diagnostics application?

Dieterbe commented 1 month ago

I have tried to connect with diagnostic app several times (from a single tab) and failed. At the same time I'm testing a dart/flutter app that is connected. Usually after a bunch of attempts it will start working again.

stevensJourney commented 1 month ago

I could not reproduce this on my side. This might have been an issue in older versions of the PowerSync Service Docker image. Can you confirm you are using the latest version of the PowerSync image, 0.5.4?

Dieterbe commented 1 month ago

this was with journeyapps/powersync-service latest 3f06e9aaea9d 8 days ago 285MB

strangely: this version doesn't show up on https://hub.docker.com/r/journeyapps/powersync-service/tags ? but :

~ ❯❯❯ docker pull journeyapps/powersync-service:latest
latest: Pulling from journeyapps/powersync-service
Digest: sha256:04a273da296ab6a30dc9d5588fb2549d6409151b7e64767fea135bbcd80da117
Status: Image is up to date for journeyapps/powersync-service:latest
docker.io/journeyapps/powersync-service:latest
~ ❯❯❯ docker images | grep powersync-service
journeyapps/powersync-service   latest      3f06e9aaea9d   8 days ago     285MB
stevensJourney commented 1 month ago

That's interesting. I'm not sure why those digests seem different... The latest image should log the current number of active web socket connections. There should be log entries of the form Currently have [number] active WebSocket connection(s). Do you currently see logs like that? If those logs are missing I get the feeling the container is not using the latest image.

Another way to confirm the version of the PowerSync service is to run cat service/package.json inside the container. The version should relate to the image version. Could you please confirm the output?

Dieterbe commented 1 month ago

ok still using the "latest" image, 3f06e9aaea9d

web@4ca2e64f70d7:/app$ cat service/package.json 
{
  "name": "@powersync/service-image",
  "version": "0.5.4",
(...)

i also see "Currently have 1 active WebSocket connection(s)" messages. right now i don't have time to do the full stack testing again however with my flutter app and with the diagnostics app. let me know what else you need.

stevensJourney commented 1 month ago

I've tried to reproduce this, but have not been successful.

Could you please share what kind of error you were receiving when trying to connect (and failing) to the Diagnostics app?

It would be very helpful if you could monitor the service logs and share which error causes the number of active WebSocket connections to increase on your side.

stevensJourney commented 3 weeks ago

Closing this issue for now since I could not reproduce this. Feel free to reopen with steps to reproduce.