Skip to content

extractSourceMap takes a huge amount of RAM on boot #1772

@NikhilVerma

Description

@NikhilVerma

I run a series of workers on my Temporal pod bootup. They sometimes take up over 2GB of RAM simply from parsing the source maps. I've confirmed this using clinic.js.

Image

const [actualCode, sourceMapJson] = extractSourceMap(code);

I am curious if there is a way to optionally allow turning off source maps? I can do so via the builder

	const { code } = await bundleWorkflowCode({
		workflowsPath: worker.workflowsPath,
		// Remove source maps
		webpackConfigHook: config => {
			config.devtool = false;
			return config;
		}
	});

But then the extractSourceMap throws, and if I patch it I see further failures down the line in addWorkflowBundle > SourceMapConsumer

I managed to patch it (in a dirty way)

    return [code, JSON.stringify({
            version: 3,
            file: '',
            sources: [],
            mappings: '',
    })];
    // throw new Error("Can't extract inlined source map from the provided Workflow Bundle");

Which results in significantly lower bootup + IDLE ram usage

Before

Image

After

Image

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