-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve resilience of Live Share to psql -f #123
Comments
Thanks for reporting @thenonameguy, we'll dig into this. cc @jgoux |
@thenonameguy by chance do you have the original migrations create by AI prior to using Live Share to help us closer reproduce this? |
I made something even better. Followed the repro steps and stopped live sharing after receiving:
Then exported the state of the PGLite: For completeness, here are the migrations: -- Migrations will appear here as you chat with AI
create table tenants (
id bigint primary key generated always as identity,
name text not null,
created_at timestamptz not null default now()
);
create table users (
id bigint primary key generated always as identity,
tenant_id bigint not null,
username text not null unique,
email text not null unique,
password text not null,
created_at timestamptz not null default now(),
foreign key (tenant_id) references tenants (id) on delete cascade
);
create table products (
id bigint primary key generated always as identity,
tenant_id bigint not null,
name text not null,
description text,
price numeric(10, 2) not null check (price > 0),
created_at timestamptz not null default now(),
foreign key (tenant_id) references tenants (id) on delete cascade
);
create table orders (
id bigint primary key generated always as identity,
tenant_id bigint not null,
user_id bigint not null,
total numeric(10, 2) not null check (total >= 0),
status text not null check (status in ('pending', 'completed', 'cancelled')),
created_at timestamptz not null default now(),
foreign key (tenant_id) references tenants (id) on delete cascade,
foreign key (user_id) references users (id) on delete set null
);
create table order_items (
id bigint primary key generated always as identity,
order_id bigint not null,
product_id bigint not null,
quantity int not null check (quantity > 0),
price numeric(10, 2) not null check (price > 0),
foreign key (order_id) references orders (id) on delete cascade,
foreign key (product_id) references products (id) on delete cascade
); |
Hello @thenonameguy and thanks for your detailed report! Unfortunately I wasn't able to reproduce the issue on my end. I tried in Firefox using your initial migration file then enabling Live Sharing and executing your Let's wait to see if there are other reports. 👍 Also, we just released the ability to drop |
Thanks for looking into it @jgoux! I've had some friends/ex-colleagues try out the demo flow with Live Share in different countries/web browsers, and the issues popped up the same. The demo is available here, after clicking "Yes". Since I'm using a single VPS to connect to the Websocket proxy, might it be related to hitting some form of rate limits? I've been also getting I'm adding metric & trace collection to connection failures so I can provide a bit more detail on the ticket, please don't close it just yet. Cheers! |
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).
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
psql -f ./schemamap_init.txt "$URI"
Expected behavior
The client does not get out of sync.
System information
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:
I haven't been able to reproduce the bug on Google Chrome
130.0.6723.92 (Official Build) (arm64)
The text was updated successfully, but these errors were encountered: