VSCode ElixirLS Debugger on MBP hangs after retrieving data

I can start the debugger and set breakpoints in the router for example so I believe things are setup properly.

But when I navigate to a page that does a db request it hangs. I am using SQLite. My task was updated because a message stated that these two modules should be excluded.

            "type": "mix_task",
            "name": "mix (Default task)",
            "request": "launch",
            "task": "phx.server",
            "projectDir": "${workspaceRoot}",
            "exitAfterTaskReturns": false,
            "excludeModules": [

The debug console shows:

[info] Running BmvpWeb.Endpoint with cowboy 2.10.0 at (http)
[info] Access BmvpWeb.Endpoint at http://localhost:4000
Mix.Task.run returned:
Sleeping. The debugger will need to be stopped manually.
[watch] build finished, watching for changes...


Done in 281ms.
[info] GET /
[debug] Processing with BmvpWeb.PageController.home/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="users_tokens" db=2.4ms queue=0.2ms idle=1214.2ms
SELECT u1."id", u1."email", u1."username", u1."hashed_password", u1."confirmed_at", u1."inserted_at", u1."updated_at" FROM "users_tokens" AS u0 INNER JOIN "users" AS u1 ON u1."id" = u0."user_id" WHERE ((u0."token" = ?) AND (u0."context" = ?)) AND (u0."inserted_at" > CAST (strftime('%Y-%m-%d %H:%M:%f000Z',?,-(60) || ' day') AS TEXT)) [<<70, 236, 50, 95, 24, 171, 92, 188, 108, 90, 115, 19, 200, 202, 119, 43, 111, 185, 41, 212, 19, 85, 58, 64, 185, 128, 162, 69, 48, 114, 177, 225>>, "session", ~U[2023-11-28 00:25:20.721142Z]]
[info] Sent 200 in 1149ms

The output shows

[Global] Adding watch patterns: /Users/bartonhammond/projects/elixir/tut/assets/tailwind.config.js, /Users/bartonhammond/projects/elixir/tut/assets, /Users/bartonhammond/projects/elixir/tut
[assets/tailwind.config.js] Initializing...
[assets/tailwind.config.js] Failed to load workspace modules.
[assets/tailwind.config.js] Using bundled version of `tailwindcss`: v3.3.0
[assets/tailwind.config.js] Using bundled version of `postcss`: v8.4.31
[assets/tailwind.config.js] Building...

I turned off reload in dev.exs as such code_reloader: false,

The console in the browser shows nothing.

Try adding this to launch configuration

"debugAutoInterpretAllModules": false,
"debugInterpretModulesPatterns": ["BmvpWeb*"],

I suspect your problem may be related to Huge memory usage (10GB+) during Phoenix debugging on a new project · Issue #1017 · elixir-lsp/elixir-ls · GitHub

That worked! Thanks…Appreciate your help :slight_smile:

But it is reallllllly slow - like ~30s from the click of Edit button to page display. It appears to me to be sqlite itself that is taking so long. From the log output, after the db select query the response appears about ~30s later. There are no timestamps in the log though.

Is there a way to ignore the two sqlite deps

      {:ecto_sql, "~> 3.10"},
      {:ecto_sqlite3, ">= 0.0.0 "},

I don’t understand how the values in the launch.json were derived (I copied them from elsewhere) How is a module related to the deps?

 "excludeModules": ["Exqlite.Sqlite3NIF", "Bcrypt.Base", ],

Is there a way to ignore the two sqlite deps

"debugAutoInterpretAllModules": false, makes all modules not interpreted as default. You shouldn’t be seeing

Interpreting Ecto.Wothever

in debugger output

I don’t understand how the values in the launch.json were derived

Here is documentation on launch.json options GitHub - elixir-lsp/elixir-ls: A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"

IDK why it’s that slow. Do you have a sample project that reproduces this?

Ah! So I changed the launch.json with "debugInterpretModulesPatterns": ["BmvpWeb.Articles*"] and debugger responsiveness is fine now. Many thanks!

1 Like