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

Deno Worker memory leak #6320

Closed
highmountaintea opened this issue Jun 16, 2020 · 3 comments
Closed

Deno Worker memory leak #6320

highmountaintea opened this issue Jun 16, 2020 · 3 comments
Labels
bug Something isn't working correctly cli related to cli/ dir high priority

Comments

@highmountaintea
Copy link

I have a simple main / worker messaging demo that consumes memory continuously. The below sample will consume > 1GB after 10 minutes.

OS: Windows 10
Env: VMWare VM with 4 virtual procs and 32 GB RAM
Deno 1.1.0

to run: deno run --allow-read parent.js

parent.js

let worker = new Worker(new URL("worker.js", import.meta.url).href, { type: "module" });

let struct = {
  headers: ["database", 1, 2],
  value: 1
};

worker.postMessage(struct);

worker.onmessage = async (e) => {
  let { got, hit } = e.data;
  if (hit) console.log("hit: " + got);
  struct.value = got + 1;
  worker.postMessage(struct);
};

worker.js

let expected = 12345;

let struct = {
  got: null,
  hit: null,
};

self.onmessage = async (e) => {
  const { value } = e.data;
  if (value % 10000 === 0) console.log(value);
  struct.got = value;
  struct.hit = value === expected;
  postMessage(struct);
};
@ry ry added bug Something isn't working correctly cli related to cli/ dir high priority labels Jun 16, 2020
@highmountaintea
Copy link
Author

I performed more tests to see if the bug is OS specific or is a regression bug. The following environments all exhibit the same issue:

OS: Windows 10
Env: Intel i7-8550U laptop with 16GB RAM
Deno 1.1.0

OS: Ubuntu 19.10
Env: Intel Atom x5-Z8350 laptop with 4GB RAM
Deno 1.1.0

OS: Windows 10
Env: Intel i7-8550U laptop with 16GB RAM
Deno 1.0.2

@wongjiahau
Copy link
Contributor

I'm also able to replicate this on macOS, I think it might be related to this issue. But fortunately the memory will be freed once the worker is terminated via invoking worker.terminate().

@bartlomieju bartlomieju mentioned this issue Oct 10, 2020
22 tasks
@satyarohith
Copy link
Member

This is no longer an issue with 1.9.0.

(cc @bartlomieju)

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

No branches or pull requests

5 participants