What causes Chrome Performance Tools occupying an immense amount of CPU when web workers are involved?

The problem I’m having can be boiled down to this:

The setup

There are two files: index.html and worker.js.

In index.html:

<script>
foo = new Worker("worker.js");
</script>

Worker.js contains no code in this example. In my actual code, the worker will wait for messages, but the only important part here is that it is not killed.

The problem

When I now go to the Performance tab within Chrome Dev Tools, and hit “Start profiling and reload page”. The workers will persistently use an immense amount of CPU time, even after the profiling has finished. That amount can be as high as 100% core utilization per worker.

The problem scales with the number of web workers and as soon as I kill them, the utilization stops. So I can be sure, that it is indeed the workers who cause this problem.

My questions

  • What causes this behaviour? Does the profiler inject some code into the workers themselves, which is not removed after the profiling finished?
  • What can I do about it?
  • Can I maybe somehow turn off the profiling for web workers while profiling my webapp?

This problem might sound minor, since it only happens when profiling and not on the users PCs, but my app uses as many web workers as the client has CPU cores, who all wait for jobs instructions. While debugging profiling that utilizes 100% of my CPU. And as I said, after profiling has finished, it doesn’t stop. I don’t want to kill the workers via console, every time I profile my app. I also don’t want to have my CPU run at 100% for hours when I forget to kill the workers after profiling and leaving the PC.

Changing my app, so that the workers are started and killed per job is not an option.