Memory leak when using async subtle decrypt module in setup on data from init sharedarray

I managed to somehow build a memory leak into our k6 script.

Originally we loaded test data as a ~26mb .json file into a SharedArray during the init part of the script, inside a SharedArray.

That worked fine and there were no memory leaks. However the data is confidential and we had to find a way to both have the data in our repository while keeping it secret.

I encrypted the file locally with openssl and used the subtlecrypto decrypt function. That apparently has some restrictions, as those are all async functions and I had to move that into the setup() function, as that one may be async.

The full process is:

load (open()) encrypted file in init, b64 encode into sharedarray

b64decrypt in setup(), decrypt file into data structure and pass it to the VUs in return

But this causes massive increases in memory over time. Does anyone have an idea what could be going wrong or what would be the right way to properly set up test data in setup?

Just wanted to add that I fixed the problem by just using a shell script to run the files through openssl for a quick decryption before running k6. Here’s to trying to solve simple problems in the most complicated ways.