You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this is not optimal, I should use pipeline promise function instead, but that does not fix the problem.
module.exports=async(jobFileSalt,storedFileName,jobRelativeFilePath,fileEncryptionKey,physicalFileStoragePath,inputFilePath,inputFileBase64,)=>{constfullDiskStoragePath=`${physicalFileStoragePath}${jobRelativeFilePath}`;constCIPHER_KEY=crypto.createHash('sha256').update(fileEncryptionKey).digest();returnnewPromise((resolve,reject)=>{letreadStream;// if file input is a path, stream sourceif(inputFilePath)readStream=fs.createReadStream(inputFilePath);else{readStream=newstream.PassThrough();readStream.write(Buffer.from(inputFileBase64,'base64'));readStream.end();}constgzip=zlib.createGzip();// Generate the cipher to encrypt from CIPHER_KEY and Salt.constcipher=crypto.createCipheriv('aes256',CIPHER_KEY,jobFileSalt);// Create a write stream with a different file extension.constwriteStream=fs.createWriteStream(`${fullDiskStoragePath}.enc`);consthandleStreamErrors=(e)=>{readStream.destroy();gzip.destroy();cipher.destroy();writeStream.destroy();reject(newError(`Error processing ${storedFileName}: ${e.message}`));};readStream.on('error',handleStreamErrors);gzip.on('error',handleStreamErrors);cipher.on('error',handleStreamErrors);writeStream.on('error',handleStreamErrors);writeStream.on('close',()=>{// Ensure that the streams are closed properlyreadStream.destroy();gzip.destroy();cipher.destroy();resolve();});readStream.pipe(gzip).pipe(cipher).pipe(writeStream);});};
How often does it reproduce? Is there a required condition?
Execute this function with a binary version of nodejs in a different folder than C:\Program Files\nodejs and add it to the system PATH.
What is the expected behavior? Why is that the expected behavior?
Expected behaviour is not to shoot the memory up to 900Mo RSS, heap is fine.
What do you see instead?
The memory shoots up to 900Mo RSS when my portable nodejs is in any other folder than C:\Program Files\nodejs.
It only worked when installing to the default C:\Program Files\nodejs folder with the msi.
After noticing that, I uninstalled the msi version and put the content of node-v20.19.2-win-x64.zip, in the same folder and it stopped the memory leak.
I also tried other node versions, the problem is not present with node 18 but is present with any version from node 20.x.x
The text was updated successfully, but these errors were encountered:
I might have wrongfully called that a memory leak, under normal use, the app consumes about 150Mo of RAM, when node is not under C:\Program Files\nodejs, it goes from 100Mo to 950Mo after just one processing and doesn't come back down.
One thing I'd like to add is that, it doesn't cause any problem when putting node under C:\Program Files\nodejs\node-v20.19.2 or any subdirectory to that.
I will try to identify which part creates that big memory consumption.
For info, we're using OpenSSL 3.0.16.
One other thing to notice is that it works normally with node 18.
Uh oh!
There was an error while loading. Please reload this page.
Version
20.19.2
Platform
Subsystem
No response
What steps will reproduce the bug?
I know this is not optimal, I should use pipeline promise function instead, but that does not fix the problem.
How often does it reproduce? Is there a required condition?
Execute this function with a binary version of nodejs in a different folder than C:\Program Files\nodejs and add it to the system PATH.
What is the expected behavior? Why is that the expected behavior?
Expected behaviour is not to shoot the memory up to 900Mo RSS, heap is fine.
What do you see instead?
The memory shoots up to 900Mo RSS when my portable nodejs is in any other folder than C:\Program Files\nodejs.
Additional information
I tried a bunch of different binaries:
https://nodejs.org/download/release/latest-v20.x/win-x64/node.exe
https://nodejs.org/download/release/latest-v20.x/node-v20.19.2-win-x64.zip
https://nodejs.org/download/release/latest-v20.x/node-v20.19.2-x64.msi
It only worked when installing to the default C:\Program Files\nodejs folder with the msi.
After noticing that, I uninstalled the msi version and put the content of node-v20.19.2-win-x64.zip, in the same folder and it stopped the memory leak.
I also tried other node versions, the problem is not present with node 18 but is present with any version from node 20.x.x
The text was updated successfully, but these errors were encountered: