Skip to content
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

Receiving error: The PL/pgSQL Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. #87

Open
1 of 4 tasks
elliotwaite opened this issue Aug 5, 2024 · 3 comments

Comments

@elliotwaite
Copy link

Whenever I start VS Code, I receive these error messages:

Screenshot 2024-08-05 at 2 26 18 PM

If I click the "Go to output" button, is shows this output:

...
/Users/elliotwaite/.vscode-insiders/extensions/uniquevision.vscode-plpgsql-lsp-2.11.3-darwin-x64/server/out/server.js:1
(()=>{var e={5375:(e,t,n)=>{e=n.nmd(e);try{process.dlopen(e,__dirname+n(1017).sep+n.p+"21b40845240c79b6d7f4e4c78e78fd69.node")}catch(e){throw new Error("node-loader:\n"+e)}},9262:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FILE_QUERY_COMMAND=void 0,t.FILE_QUERY_COMMAND={title:"PL/pgSQL: Execute the Current File Query",name:"plpgsql-lsp.executeFileQuery",execute:async function(e,t,n){const r=await e.connect();try{await r.query(t.getText())}catch(e){throw n.error(e.message),e}finally{await r.release()}}}},5409:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.COMMAND_TITLE_MAP=t.COMMAND_NAMES=t.COMMANDS=void 0;const r=n(9262),i=n(1899);t.COMMANDS=[r.FILE_QUERY_COMMAND,i.WORKSPACE_VALIDATION_COMMAND],t.COMMAND_NAMES=t.COMMANDS.map((e=>e.name)),t.COMMAND_TITLE_MAP=Object.fromEntries(t.COMMANDS.map((e=>[e.name,e.title])))},1899:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateFile=t.validateWorkspace=t.WORKSPACE_VALIDATION_COMMAND=void 0;const r=n(284),i=n(2695),o=n(5889),s=n(8906);async function a(e,t,n,r,i,o){for(const a of await(0,s.loadWorkspaceValidationTargetFiles)(n,r)){const u=await(0,s.readTextDocumentFromUri)(`${n.uri}/${a}`);await c(e,t,u,r,i,o)}}async function c(e,t,n,s,a,c){let u;if(!(0,o.disableValidation)(n)){const e=(0,r.getQueryParameterInfo)(n,n.getText(),s,c);u=null===e||"type"in e?await(0,i.validateTextDocument)(t,n,{isComplete:!0,hasDiagnosticRelatedInformationCapability:a.hasDiagnosticRelatedInformationCapability,queryParameterInfo:e,statements:s.statements},s,c):[e]}return e.sendDiagnostics({uri:n.uri,diagnostics:null!=u?u:[]}),u}t.WORKSPACE_VALIDATION_COMMAND={title:"PL/pgSQL: Validate the Workspace Files",name:"plpgsql-lsp.validateWorkspace",execute:a},t.validateWorkspace=a,t.validateFile=c},2241:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MigrationError=t.WorkspaceValidationTargetFilesEmptyError=t.ExecuteFileQueryCommandDisabledError=t.CannotExecuteCommandWithQueryParametersError=t.WrongCommandArgumentsError=t.CommandNotFoundError=t.PostgresPoolNotFoundError=t.DisableLanguageServerError=t.WorkspaceNotFound=t.NotCoveredFileError=t.ParsedTypeError=t.NeverReachError=t.PlpgsqlLanguageServerError=void 0;class n extends Error{get name(){return this.constructor.name}}t.PlpgsqlLanguageServerError=n,t.NeverReachError=class extends n{},t.ParsedTypeError=class extends n{},t.NotCoveredFileError=class extends n{constructor(){super("This file is not covered by Language Server.")}},t.WorkspaceNotFound=class extends n{constructor(){super("Workspace not found.")}},t.DisableLanguageServerError=class extends n{constructor(){super("Disable Language Server.")}},t.PostgresPoolNotFoundError=class extends n{constructor(){super("PostgresPool not found.")}},t.CommandNotFoundError=class extends n{constructor(e){super(`Command '${e}' not found`)}},t.WrongCommandArgumentsError=class extends n{constructor(){super("Arguments of the command are wrong.")}},t.CannotExecuteCommandWithQueryParametersError=class extends n{constructor(){super("Cannot execute the command with query parameters.")}},t.ExecuteFileQueryCommandDisabledError=class extends n{constructor(){super('"settings.enableExecuteFileQueryCommand" is false.')}},t.WorkspaceValidationTargetFilesEmptyError=class extends n{constructor(){super('"settings.workspaceValidationTargetFiles" is empty.')}},t.MigrationError=class extends n{constructor(e,t){super(t),this.document=e}}},9699:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPool=void 0;var r=n(6421);Object.defineProperty(t,"getPool",{enumerable:!0,get:function(){return r.getPool}})},854:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.PostgresKind=void 0,function(e){e[e.Schema=0]="Schema",e[e.Table=1]="Table",e[e.View=2]="View",e[e.MaterializedView=3]="MaterializedView",e[e.Type=4]="Type",e[e.Domain=5]="Domain",e[e.Index=6]="Index",e[e.Function=7]="Function",e[e.Trigger=8]="Trigger"}(n||(t.PostgresKind=n={}))},5256:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeFileWithDefaultQueryParameters=t.getDefaultQueryParameterInfo=void 0;const r=n(3902),i=n(8906),o=n(6652);t.getDefaultQueryParameterInfo=function(e,t,n,r){const o=(0,i.getFirstLine)(e);for(const e of[/^ *-- +plpgsql-language-server:use-query-parameter *$/,/^ *\/\* +plpgsql-language-server:use-query-parameter +\*\/$/])if(null!==o.match(e)){let e;e="string"==typeof n?[n]:n;const r=[];return e.forEach((e=>{const n=new RegExp(e,"g");r.push(...Array.from(new Set([...t.matchAll(n)].map((e=>e[0])))))})),{type:"default",queryParameters:r,queryParameterPattern:e}}return null},t.sanitizeFileWithDefaultQueryParameters=function(e,t,n){const i=new Set(t.queryParameters);for(const[t,n]of Array.from(i.values()).entries())e=e.replace(new RegExp((0,r.escapeRegex)(n),"g"),(0,o.makePositionalParamter)(t,n));return[e,i.size]}},6652:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makePositionalParamter=void 0,t.makePositionalParamter=function(e,t){let n=`$${e+1}`;return n+=" ".repeat(Math.max(0,t.length-n.length)),n}},284:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeFileWithQueryParameters=t.getQueryParameterInfo=void 0;const r=n(5809),i=n(3471),o=n(8906),s=n(5256),a=n(3554),c=n(1339);t.getQueryParameterInfo=function(e,t,n,i){let u;if(u=(0,s.getDefaultQueryParameterInfo)(e,t,n.queryParameterPattern,i),null!==u)return u;if(u=(0,c.getPositionalQueryParameterInfo)(e,t,i),null!==u)return u;try{u=(0,a.getKeywordQueryParameterInfo)(e,t,n.keywordQueryParameterPattern,i)}catch(t){if(t instanceof a.KeywordQueryParameterPatternNotDefinedError)return{severity:r.DiagnosticSeverity.Error,range:(0,o.getTextAllRange)(e),message:t.message}}return null!==u?u:null},t.sanitizeFileWithQueryParameters=function(e,t,n){if(null===t)return[e,0];{const r=t.type;switch(r){case"default":return(0,s.sanitizeFileWithDefaultQueryParameters)(e,t,n);case"position":return(0,c.sanitizeFileWithPositionalQueryParameters)(e,t,n);case"keyword":return(0,a.sanitizeFileWithKeywordQueryParameters)(e,t,n);default:{const e=r;(0,i.neverReach)(`"${e}" is unknown "queryParameterInfo.type".`)}}}}},3554:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeFileWithKeywordQueryParameters=t.getKeywordQueryParameterInfo=t.KeywordQueryParameterPatternNotDefinedError=void 0;const r=n(3902),i=n(8906),o=n(6652);class s extends Error{constructor(){super("'plpgsqlLanguageServer.keywordQueryParameterPattern' does not set in the settings."),this.name="KeywordQueryParameterPatternNotDefinedError"}}t.KeywordQueryParameterPatternNotDefinedError=s,t.getKeywordQueryParameterInfo=function(e,t,n,r){const o=(0,i.getFirstLine)(e);for(const e of[/^ *-- +plpgsql-language-server:use-keyword-query-parameter( +keywords=\[ *([A-Za-z_][A-Za-z0-9_]*)?((, *([A-Za-z_][A-Za-z0-9_]*))*),? *\])? *$/,/^ *\/\* +plpgsql-language-server:use-keyword-query-parameter( +keywords=\[ *([A-Za-z_][A-Za-z0-9_]*)?((, *([A-Za-z_][A-Za-z0-9_]*))*),? *\])? +\*\/$/]){const r=o.match(e);if(null!==r){if(void 0===n)throw new s;let e;e="string"==typeof n?[n]:n;const i=[],o=r[2],a=r[3];return void 0!==o?(e.forEach((e=>i.push(e.replace("{keyword}",o)))),""!==a&&a.split(",").map((e=>e.trim())).filter((e=>""!==e)).forEach((t=>{e.forEach((e=>i.push(e.replace("{keyword}",t))))}))):e.forEach((e=>{const n=new RegExp(e.replace("{keyword}","[A-Za-z_][A-Za-z0-9_]*"),"g");i.push(...Array.from(new Set([...t.matchAll(n)].map((e=>e[0])))))})),{type:"keyword",keywordParameters:i,keywordQueryParameterPattern:e}}}return null},t.sanitizeFileWithKeywordQueryParameters=function(e,t,n){const i=new Set(t.keywordParameters);for(const[t,n]of Array.from(i.values()).entries())e=e.replace(new RegExp((0,r.escapeRegex)(n),"g"),(0,o.makePositionalParamter)(t,n));return[e,i.size]}},1339:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeFileWithPositionalQueryParameters=t.getPositionalQueryParameterInfo[Error - 2:27:33 PM] Connection to server got closed. Server will not be restarted.

Any tips for how to fix or debug this?

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
@macnewbold
Copy link

I'm getting a very similar error on Windows as well.

@renaldodev
Copy link

Make sure to setup the connection in your vscode settings.

{ "plpgsqlLanguageServer.database": "postgres", "plpgsqlLanguageServer.user": "postgres", "plpgsqlLanguageServer.password": "postgres", "plpgsqlLanguageServer.host": "localhost", "plpgsqlLanguageServer.port": 54322, }

@hi2u
Copy link

hi2u commented Jan 13, 2025

I tried this extension out today for the first time. I'm getting a similar error.

I do have the DB settings configured. Tried in both my global settings.json, and workspace-specific one.

Some additional output:

Error: node-loader:
Error: c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\fd51af29867b810570dc552fae6adee4.node is not a valid Win32 application.

c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\fd51af29867b810570dc552fae6adee4.node
    at 5375 (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:1:143)
    at n (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:42:233748)
    at 2737 (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:42:13179)
    at n (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:42:233748)
    at 3630 (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:1:13410)
    at n (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:42:233748)
    at 5844 (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:30:598)
    at n (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:42:233748)
    at 1245 (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:24:2048)
    at n (c:\Users\username\.vscode\extensions\uniquevision.vscode-plpgsql-lsp-2.7.2-win32-x64\server\out\server.js:42:233748)

Node.js v20.18.1
[Error - 7:32:10 PM] Connection to server got closed. Server will not be restarted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants