Memory Leak
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- bun, deno, javascript
- Ambito
- cryptography
Direzione di ricerca
Riproduci la crescita dell'heap segnalata chiamando createHmac in Bun e Deno, confrontandola con la soluzione alternativa che consiste nell'eliminare la proprietà. Esamina prima Legacy.js e il comportamento delle dipendenze del pacchetto; il lavoro è completato quando chiamate HMAC ripetute non mostrano più l'aumento di memoria segnalato senza richiedere l'eliminazione manuale della proprietà.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi everyone, I've used this package in Bun (where it is used as part of the crypto module) and in Deno (importing it manually with npm:create-hmac).
Through using it and measuring performance, I noticed that this library creates memory leak when used as so:
const tokenString = `${secret}:${timestamp}`;
const hmac = createHmac("md5", secret);
const token = hmac.update(tokenString).digest("hex");
return {
token,
timestamp: timestamp,
};
despite the hmac getting freed from the scope and not stored in any global object / event handler, I could notice that the memory of the project would increased significantly. My test was calling this function once per second, and log the heapsize every 30s. Nothing else was happening in the code. Yet the memory increased every time (5MB for every 30s measurement).
However, the following code does not generate the memory leak:
const tokenString = `${secret}:${timestamp}`;
const hmac = createHmac("md5", secret);
const token = hmac.update(tokenString).digest("hex");
for (const property in hmac) {
delete hmac[property as keyof typeof hmac];
}
return {
token,
timestamp: timestamp,
};
I'm not sure if the issues lies in your own code (could not see anything incriminating in Legacy.js), or in a dependency you are using, but it is certainly there. I'm also not sure there is anything you can do about it as you need to support the nodeJS crypto signature so it's not like you can add a destroy function.
But I figured it was worth raising as an issue with this working solution in case anyone else falls down the same rabbit hole.
- Lingua principale
- JavaScript
- Stelle
- 60
- Fork
- 22
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di browserify/createHmac
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
browserify/createHmac#38 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 42/100
browserify/createHmac#35 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
browserify/createHmac#34 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
browserify/createHmac#30 · 1 commento ·
-
How use it in browser? Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
browserify/createHmac#29 · 4 commenti · 1 reazione ·
Tutte le issue di browserify/createHmac
Issue simili
-
bug confirmed issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
open-webui/open-webui#30750 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Mend: dependency security vulnerability untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100