Skip to content

Postgres Server Crash #407

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

Open
2 tasks done
Arjith8 opened this issue May 24, 2025 · 8 comments
Open
2 tasks done

Postgres Server Crash #407

Arjith8 opened this issue May 24, 2025 · 8 comments
Labels
bug Something isn't working

Comments

@Arjith8
Copy link

Arjith8 commented May 24, 2025

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

┌─┘
└─┐pgt_lsp::handlers::completions::get_completions{params=CompletionParams { text_document_position: TextDocumentPositionParams { text_document: TextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/arjith/dev/exploration/support_app_BE/db/migrations/000001_create_users_table.up.sql", query: None, fragment: None } }, position: Position { line: 0, character: 19 } }, work_done_progress_params: WorkDoneProgressParams { work_done_token: None }, partial_result_params: PartialResultParams { partial_result_token: None }, context: Some(CompletionContext { trigger_kind: TriggerCharacter, trigger_character: Some(" ") }) }}
  └─┐pgt_workspace::workspace::server::get_completions{path="/home/arjith/dev/exploration/support_app_BE/db/migrations/000001_create_users_table.up.sql", position="19"}
    ├─2025-05-24 19:42:02.506470978   0ms DEBUG pgt_workspace::workspace::server No connection to database. Skipping completions.
  ┌─┘
┌─┘
└─┐pgt_lsp::handlers::text_document::did_change{params=DidChangeTextDocumentParams { text_document: VersionedTextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/arjith/dev/exploration/support_app_BE/db/migrations/000001_create_users_table.up.sql", query: None, fragment: None }, version: 25 }, content_changes: [TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 19 }, end: Position { line: 0, character: 19 } }), range_length: Some(0), text: "{" }] }}
  └─┐pgt_workspace::workspace::server::change_file{path="/home/arjith/dev/exploration/support_app_BE/db/migrations/000001_create_users_table.up.sql", version=25}
    ├─2025-05-24 19:42:05.683067555   0ms ERROR pgt_cli::panic Encountered an unexpected error
    │ 
    │ This is a bug in Postgres Tools, not an error in your code, and we would appreciate it if you could report it along with the following information to help us fixing the issue:
    │ 
    │ Source Location: crates/pgt_lexer/src/codegen.rs:3:1
    │ Thread Name: tokio-runtime-worker
    │ Message: Unknown token: 123
    │ 
  ┌─┘
┌─┘
┘
@Arjith8 Arjith8 added the bug Something isn't working label May 24, 2025
@psteinroe
Copy link
Collaborator

Hey, thanks for sharing! Could you share the file you were working on?

@Arjith8
Copy link
Author

Arjith8 commented May 25, 2025

Ya sure

Image

I wasn't getting any auto complete which was why i was checking the logs
I installed the lsp using mason.nvim

@Arjith8
Copy link
Author

Arjith8 commented May 25, 2025

Hi adding something extra for some reason after postgrestools init the config file has a unable to load schema warning, this time I was using Zed since I thought maybe I did something wrong with my nvim setup, The line on which the warning is shown is "$schema": "https://pgtools.dev/schemas/0.7.0/schema.json", . I dont have completions in zed either.

@Podymczak24h
Copy link

└─┐pgt_lsp::handlers::text_document::did_change{params=DidChangeTextDocumentParams { text_document: VersionedTextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/bedgurl58/ciezkaPraca/api/essa.sql", query: None, fragment: None }, version: 86 }, content_changes: [TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 13 }, end: Position { line: 0, character: 13 } }), range_length: Some(0), text: "a" }, TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 14 }, end: Position { line: 0, character: 14 } }), range_length: Some(0), text: "n" }, TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 15 }, end: Position { line: 0, character: 15 } }), range_length: Some(0), text: "g" }, TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 16 }, end: Position { line: 0, character: 16 } }), range_length: Some(0), text: "u" }, TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 17 }, end: Position { line: 0, character: 17 } }), range_length: Some(0), text: "a" }, TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 18 }, end: Position { line: 0, character: 18 } }), range_length: Some(0), text: "g" }, TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 19 }, end: Position { line: 0, character: 19 } }), range_length: Some(0), text: "e" }, TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 20 }, end: Position { line: 0, character: 20 } }), range_length: Some(0), text: "s" }] }}
└─┐pgt_workspace::workspace::server::change_file{path="/home/bedgurl58/narwi/api/data.sql", version=86}
├─2025-05-25 23:39:54.048455511 0ms ERROR pgt_cli::panic Encountered an unexpected error

│ This is a bug in Postgres Tools, not an error in your code, and we would appreciate it if you could report it along with the following information to help us fixing the issue:

│ Source Location: crates/pgt_workspace/src/workspace/server/change.rs:423:32
│ Thread Name: tokio-runtime-worker
│ Message: byte index 19 is out of bounds of insert into laanag

┌─┘
┌─┘
2025-05-25 23:39:54.048610104 INFO pgt_cli::commands::daemon Received shutdown signal

@psteinroe
Copy link
Collaborator

Thanks for sharing! Would it be possible to share a full log from opening the file to the crash? This way, we can repro it in tests easily.

@Podymczak24h
Copy link

This video might be helpfull

vod.mp4

server.log.2025-05-26-08.txt

@psteinroe
Copy link
Collaborator

This video might be helpfull

vod.mp4

server.log.2025-05-26-08.txt

That's indeed helpful. What client are you using? Is there anything special in your setup? The logs look like the ranges in the change that causes the crash are not related to the state before the change but to the previous within the batch of changes. The protocol does not allow that, and I am wondering where that comes from.

In your video it looks like you were simply adding and removing characters in the same line. Does this happen if you type slower too?

@Podymczak24h
Copy link

NVIM v0.12.0-dev-454+ga4f31857

{
    "neovim/nvim-lspconfig",
    config = function()
        local lspconfig = require("lspconfig")
        lspconfig.postgres_lsp.setup({
            filetypes = {
                'sql',
                'pgsql',
            },
        })
    end
},

postgres-language-server 0.7.0

And yes, for me this lsp is very bugged. It closes even when I type slowly. For example when I type Insert into cate. And I click enter to autocomplete as categories and the server shuts down. I have no problems with any of the other lsp and I use 13 of them in total.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants