postgres-new
postgres-new copied to clipboard
Improve resilience of Live Share to psql -f
Bug report
While building a demo using the Live Share feature of database.build, I've seen many intermittent failures of the connection. Usually fixed by stopping the Live Share, reloading the tab and restarting the Live Share.
Describe the bug
While running many statements (via psql -f) against a Live Share'd non-trivial DB the server/proxy regularly loses sync, while seemingly hallucinating gigabyte-sized messsage sizes (1853122928 bytes or 1667196005 bytes as examples).
psql:schemamap_init.sql:462: lost synchronization with server: got message type "e", length 1667196005
psql:schemamap_init.sql:462: error: connection to server was lost
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Open database.build
- Run prompt: Create a well-modeled ERP schema, with multi-tenancy, constraints on most columns (especially tenant_id) and mock data.
- Enable Live Share, copy URI
- Download schemamap_init.txt (sql script)
- Run:
psql -f ./schemamap_init.txt "$URI" - Expectation: it should succeed, although there are sometimes failures here as well
- Try rerunning step 5 a few times, eventually you will a get a "lost synchronization".
Expected behavior
The client does not get out of sync.
System information
- OS:
- MacOS: psql (PostgreSQL) 15.8
- Linux: psql (PostgreSQL) 15.8
- Browser: Firefox 131.0.3 (aarch64)
- Version of supabase-js: N/A
- Version of Node.js: N/A
Additional context
I'm aware the client is not major 16 version, but for these simple statement executions, it should not matter.
Another invocation failed later:
psql:schemamap_init.txt:1361: lost synchronization with server: got message type "m", length 1701737504
psql:schemamap_init.txt:1361: error: connection to server was lost
I haven't been able to reproduce the bug on Google Chrome 130.0.6723.92 (Official Build) (arm64)