VSCode Extension 4.10.1 & 4.11.0: memory access out of bounds

Open
#1,386 11 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript, vscode, wasm
Domain
devtools, tooling

Research direction

Start by reproducing the failure while editing a schema.prisma file, then trace the reported calls through prisma-fmt, format.js, MessageHandler.js, and server.js. Done means linting, formatting, and completion continue working after extended editing without the "memory access out of bounds" error.

Written by the indexing model from the issue text.

Description

bug/1-unconfirmed domain/schema kind/bug tech/engines/formatter engine topic: formatting

Bug description

I'm in the process of designing a new schema/db. After editing the schema.prisma file for a couple of hours (with breaks to look up documentation/etc), the Prisma Language Server starts throwing "memory access out of bounds" errors on every attempt to format/lint/autocomplete.

Restarting VSCode so that the Prisma Language Server gets restarted will allow linting/formatting again for another couple of hours before the Prisma Language Service starts throwing the memory access errors again.

I have tested this on both version 4.10.1 and 4.11.0 - both run into the same memory access errors after a few hours.

VSCode Extension version 4.10.1 and 4.11.0

How to reproduce

Steps to reproduce the behavior:

  1. Install the VSCode plugin Prisma
  2. Open a schema.prisma file in VSCode
  3. Continue making changes to the schema.prisma file for a few hours
  4. See error log below

Expected behavior

The Prisma Language Server should not start failing on all access due to memory issues.

Prisma information

This occurs when editing the schema file itself.

Environment & setup

  • OS: Debian 11
  • Editor: VSCode 1.75.1
  • Editor version: 1.75.1
  • Extension version: 4.10.1 and 4.11.0

Prisma Language Server log from a few lines before the errors started:

running lint() from prisma-fmt
running lint() from prisma-fmt
running lint() from prisma-fmt
running lint() from prisma-fmt
Did not receive any native type suggestions from prisma-fmt call.
running lint() from prisma-fmt
running lint() from prisma-fmt
[Error - 2:23:49 PM] prisma-fmt error'd during linting.

[Error - 2:23:49 PM] [object Object]
[Error - 2:23:49 PM] Request textDocument/completion failed.
  Message: Request textDocument/completion failed with message: memory access out of bounds
  Code: -32603 
running lint() from prisma-fmt
[Error - 2:23:51 PM] prisma-fmt error'd during linting.

[Error - 2:23:51 PM] [object Object]
[Error - 2:23:52 PM] Request textDocument/completion failed.
  Message: Request textDocument/completion failed with message: memory access out of bounds
  Code: -32603 
running lint() from prisma-fmt
[Error - 2:24:47 PM] prisma-fmt error'd during linting.

[Error - 2:24:47 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:47 PM] prisma-fmt error'd during linting.

[Error - 2:24:47 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:47 PM] prisma-fmt error'd during linting.

[Error - 2:24:47 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:48 PM] prisma-fmt error'd during linting.

[Error - 2:24:48 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:49 PM] prisma-fmt error'd during linting.

[Error - 2:24:49 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:50 PM] prisma-fmt error'd during linting.

[Error - 2:24:50 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:50 PM] prisma-fmt error'd during linting.

[Error - 2:24:50 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:50 PM] prisma-fmt error'd during linting.

[Error - 2:24:50 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:51 PM] prisma-fmt error'd during linting.

[Error - 2:24:51 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:51 PM] prisma-fmt error'd during linting.

[Error - 2:24:51 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:52 PM] prisma-fmt error'd during linting.

[Error - 2:24:52 PM] [object Object]
running lint() from prisma-fmt
[Error - 2:24:59 PM] prisma-fmt error'd during linting.

[Error - 2:24:59 PM] [object Object]
running format() from prisma-fmt

prisma-fmt error'd during formatting. Please report this issue on [Prisma Language Tools](https://github.com/prisma/language-tools/issues). 
Linter output:

RuntimeError: memory access out of bounds
    at format (wasm://wasm/00a1175e:wasm-function[35]:0x7c13d)
    at module.exports.format (/home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/@prisma/prisma-fmt-wasm/src/prisma_fmt_build.js:113:14)
    at format (/home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/@prisma/language-server/dist/src/prisma-fmt/format.js:10:42)
    at Object.handleDocumentFormatting (/home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/@prisma/language-server/dist/src/MessageHandler.js:118:44)
    at /home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/@prisma/language-server/dist/src/server.js:182:35
    at /home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/vscode-languageserver/lib/common/server.js:637:20
    at handleRequest (/home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/connection.js:459:41)
    at processMessageQueue (/home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/connection.js:321:17)
    at Immediate._onImmediate (/home/user/.vscode/extensions/prisma.prisma-4.10.1/node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/connection.js:311:13)
    at process.processImmediate (node:internal/timers:466:21)
Dominant language
TypeScript
Stars
298
Forks
53
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from prisma/language-tools

All issues in prisma/language-tools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.