Skip to content

Deno language server crashes all the time #1314

@pawsaw

Description

@pawsaw

Describe the bug

The Deno language server crashes all the time.

Thank you all for the great project ❤️

Output

Starting Deno language server...
  version: 2.3.3 (release, aarch64-apple-darwin)
  executable: /opt/homebrew/bin/deno
Connected to "Visual Studio Code" 1.101.1
Enabling import suggestions for: https://deno.land
Refreshing configuration tree...
  Resolved Deno configuration file: "file:///Users/pawel/VSCodeProjects/genprofile-generators/deno.json"
  Resolved lockfile: "file:///Users/pawel/VSCodeProjects/genprofile-generators/deno.lock"
Server ready.
TS server started.
Unable to send result to client.
Unable to send result to client.

<--- Last few GCs --->

[13731:0x1581b0000]    31069 ms: Scavenge 3058.0 (3075.1) -> 3050.6 (3075.1) MB, pooled: 0.0 MB, 0.46 / 0.00 ms (average mu = 0.343, current mu = 0.320) allocation failure; 
[13731:0x1581b0000]    31340 ms: Mark-Compact (reduce) 3064.3 (3081.3) -> 3048.7 (3059.6) MB, pooled: 0.0 MB, 243.62 / 0.00 ms (+ 10.8 ms in 214 steps since start of marking, biggest step 5.0 ms, walltime since start of marking 270 ms) (average mu = 0.327


#
# Fatal JavaScript out of memory: Ineffective mark-compacts near heap limit
#
==== C stack trace ===============================

    0   deno                                0x0000000103d998cc v8::base::debug::StackTrace::StackTrace() + 24
    1   deno                                0x0000000103da00ec v8::platform::(anonymous namespace)::PrintStackTrace() + 24
    2   deno                                0x0000000103d95930 v8::base::FatalOOM(v8::base::OOMType, char const*) + 68
    3   deno                                0x0000000103deae04 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) + 284
    4   deno                                0x0000000103ff6818 v8::internal::Heap::stack() + 0
    5   deno                                0x0000000103ff98d8 v8::internal::Heap::OldGenerationConsumedBytes() const + 0
    6   deno                                0x000000010400883c _ZZN2v88internal4Heap14CollectGarbageENS0_15AllocationSpaceENS0_23GarbageCollectionReasonENS_15GCCallbackFlagsEENK3$_1clEv + 1852
    7   deno                                0x00000001040080e8 _ZN4heap4base5Stack24SetMarkerAndCallbackImplIZN2v88internal4Heap14CollectGarbageENS4_15AllocationSpaceENS4_23GarbageCollectionReasonENS3_15GCCallbackFlagsEE3$_1EEvPS1_PvPKv + 40
    8   deno                                0x0000000104893c1c PushAllRegistersAndIterateStack + 40
    9   deno                                0x0000000103ff44a0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) + 708
    10  deno                                0x0000000103fbad48 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) + 2304
    11  deno                                0x0000000103fa0b04 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) + 624
    12  deno                                0x000000010444f908 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) + 100
    13  deno                                0x0000000105283fb4 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit + 84
    14  ???                                 0x00000003086d11d4 0x0 + 13026267604
    15  ???                                 0x0000000308193aa8 0x0 + 13020773032
    16  ???                                 0x00000003081801f4 0x0 + 13020692980
    17  ???                                 0x00000003086fb0e0 0x0 + 13026439392
    18  ???                                 0x00000003085440f0 0x0 + 13024641264
    19  ???                                 0x0000000308111028 0x0 + 13020237864
    20  ???                                 0x0000000308140260 0x0 + 13020430944
    21  ???                                 0x00000003086f7da0 0x0 + 13026426272
    22  ???                                 0x00000003082691cc 0x0 + 13021647308
    23  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    24  ???                                 0x0000000308191fa0 0x0 + 13020766112
    25  ???                                 0x00000003086f7a4c 0x0 + 13026425420
    26  ???                                 0x00000003082691cc 0x0 + 13021647308
    27  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    28  ???                                 0x0000000308140e64 0x0 + 13020434020
    29  ???                                 0x00000003086f7da0 0x0 + 13026426272
    30  ???                                 0x00000003082691cc 0x0 + 13021647308
    31  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    32  ???                                 0x0000000308191fa0 0x0 + 13020766112
    33  ???                                 0x00000003086f7a4c 0x0 + 13026425420
    34  ???                                 0x00000003082691cc 0x0 + 13021647308
    35  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    36  ???                                 0x0000000308140e64 0x0 + 13020434020
    37  ???                                 0x00000003086f7da0 0x0 + 13026426272
    38  ???                                 0x00000003082691cc 0x0 + 13021647308
    39  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    40  ???                                 0x0000000308191fa0 0x0 + 13020766112
    41  ???                                 0x00000003086f7a4c 0x0 + 13026425420
    42  ???                                 0x00000003082691cc 0x0 + 13021647308
    43  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    44  ???                                 0x0000000308140e64 0x0 + 13020434020
    45  ???                                 0x00000003086f7da0 0x0 + 13026426272
    46  ???                                 0x00000003082691cc 0x0 + 13021647308
    47  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    48  ???                                 0x0000000308191fa0 0x0 + 13020766112
    49  ???                                 0x00000003086f7a4c 0x0 + 13026425420
    50  ???                                 0x00000003082691cc 0x0 + 13021647308
    51  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    52  ???                                 0x0000000308140e64 0x0 + 13020434020
    53  ???                                 0x00000003086f7da0 0x0 + 13026426272
    54  ???                                 0x00000003082691cc 0x0 + 13021647308
    55  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    56  ???                                 0x0000000308191fa0 0x0 + 13020766112
    57  ???                                 0x00000003086f7a4c 0x0 + 13026425420
    58  ???                                 0x00000003082691cc 0x0 + 13021647308
    59  ???                                 0x00000003086fcfc8 0x0 + 13026447304
    60  ???                                 0x0000000308140e64 0x0 + 13020434020
    61  ???                                 0x00000003086f7da0 0x0 + 13026426272
[Info  - 11:53:55 AM] Connection to server got closed. Server will restart.

To Reproduce

I'm not sure what exactly triggers this behavior, but it seams to happen with a certain code file.

openaiClient.ts:

import OpenAI from "jsr:@openai/[email protected]";

import { zodResponseFormat } from "jsr:@openai/openai/helpers/zod";
import { z, ZodObject, ZodRawShape } from "npm:zod@canary";

// https://github.com/openai/openai-node

export const openaiClient = new OpenAI({
  apiKey: Deno.env.get("OPENAI_API_KEY"), // This is the default and can be omitted
});

export const openaiRequest = async <
  ZodResponseType extends ZodObject<ZodRawShape>,
>(
  responseSchema: ZodResponseType,
  systemPrompt: string,
  userPrompt: string,
) => {
  const response = await openaiClient.chat.completions.parse({
    model: "gpt-4",
    messages: [
      { role: "system", content: systemPrompt },
      { role: "user", content: userPrompt },
    ],
    response_format: zodResponseFormat(responseSchema),
  });

  return response.choices[0].message.content as ZodResponseType;
};

settings.json:

{
  "deno.enable": true,
  "deno.lint": true,
  "editor.formatOnSave": true
}

deno.json:

{
  "tasks": {
    "dev": "deno run --allow-net --allow-read --allow-write --allow-run=exiftool --allow-env --no-prompt --watch main.ts"
  },
  "imports": {
    "@std/assert": "jsr:@std/assert@1"
  }
}

Versions

deno --version

deno 2.3.3 (stable, release, aarch64-apple-darwin)
v8 13.7.152.6-rusty
typescript 5.8.3

VS Code:

Version: 1.101.1 (Universal)
Commit: 18e3a1ec544e6907be1e944a94c496e302073435
Date: 2025-06-18T13:35:12.605Z (4 days ago)
Electron: 35.5.1
ElectronBuildId: 11727614
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Darwin arm64 24.5.0

Extension:

Identifier
denoland.vscode-deno
Version
3.44.2
Last Updated
2025-05-14, 11:59:14
Size
1.51MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions