Leaks Detected
Hey guys - got a couple of blocks of tests that are flagging detected leaks. It would be awesome if we could get more details on these detections.
I understand from past issues there are challenges to do with the layers that Deno tests are built on.
So this is a bit of a hail-Mary in case someone can guide me as to how to track down a leaked file.
4 Replies
Can you show one of the tests that are leaking?
I actually had 3 sets of tests with the issue, but the I realised the error was suggesting to mark the test steps as async.
Even though they are not required to be async, I added this, then just tell Deno lint to ignore an async function that doesn't have an away.
So that went well for two sets of tests.
In this final set of tests, you see I take the same approach, but the test steps are required to be async as they do have awaited calls within.
At the top, I start an API server, and at the bottom I close that server, which in turn starts/stops PGLite database.
So clearly I have a lot going on here, but nothing which I expect is uncommon.
Many thanks for the reply!
The error message say you're opening a file. Do you know which file it's talking about?
Relative to the code
I’ll check it out - I may have incorrectly assumed somewhere that a file is closed automatically.
Hey Doc (not Doc) 🤪 Nailed it. Thanks for bringing my attention back to where it needed to be on the error message. It was all my fault and very logical. I had two methods running that open the PgLite database when the tests initialised. Of course, the PgLite file is closed at the end, but as it opened two times at the begining, clearly, one file handle leaked. Thank you so much for the inspiration!