Skip to content

Instantly share code, notes, and snippets.

Created November 9, 2021 16:43
What would you like to do?
Fleet memory leak
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
// Put this file at "x-pack/plugins/fleet/server" and then modify ""
// to have the setting "KIBANA_PROJECT=x-pack/plugins/fleet/jest.config.js"
// And then run it:
// ./ ~/projects/kibana/x-pack/plugins/fleet/server/test_sample.test.ts
// And you will see the memory leak unless you use the import outside of the pattern
// "x-pack/plugins/fleet/server"
// Any functions we import directly from ${PLUGIN_NAME}/server seems to start the memory leak.
// This will be a memory leak if we import from "x-pack/plugins/fleet/server"
// Comment this out and uncomment the line underneath it to remove the memory leak
import { relativeDownloadUrlFromArtifact } from '.';
// This will not be a memory leak if we import from within the mappings folder
// import { relativeDownloadUrlFromArtifact } from './services/artifacts/mappings';
describe('memory leak', () => {
test('it has a memory leak by just iterating over an import', () => {
// You just have to ensure you're touching the import, not actually invoke it to see the leak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment