psych-ds / psychds-validator

Validator tools for the psych-DS specification
0 stars 1 forks source link

Misplaced metadata #35

Closed bleonar5 closed 5 months ago

bleonar5 commented 5 months ago

Small PR to add warning when file named "dataset_description.json" is placed in a directory other than the root.

Made some necessary changes to the way "path" properties are used in filenameIdentify and how "baseDir" elements are stored (namely, differences in whether path is interpreted as a relative or full path, and whether initial "/"s are included). These changes are also reflected in some updates to the schema model.

bleonar5 commented 5 months ago

This PR, for the sake of simplicity and because an error was discovered during its development, now includes a fix for the Deno-related resource leaking issue.

I can now confirm that the resource leaking issue never had to do with my use of Deno file I/O generally. The leaks were all arising from my use of an external npm library called "jsonld". As can be inferred from the name, this library is essential to the app's functionality, so removing it is not an option. I tried to find a native deno dependency to replace it, but none were available. I also tried various different methods for integrating the npm library, and they all produced the same result.

Essentially, whenever I call jsonld.expand(...), which is the only jsonld function I ever need to use, a resource leak occurs. From my research, this doesn't appear to be some general property of using external npm libraries within the deno framework, but is a specific issue related either to the jsonld library itself or the way it is handled by deno.

For debugging purposes, this is a little more frustrating than what I had initially expected. If the problem were with my handling of deno file I/O, then I would have full control and visibility over the problem. Since the problem arises from an external library, everything is opaque, and even if it weren't, I couldn't change anything.

My approach for the time being: I have made use of a flag called sanitizeResources in the Deno test function in order to suppress this error. It is not an ideal solution, obviously, but the problem was minor to begin with, and only ever affected the results of unit tests. I will maintain a slightly modified version of issue #36 until the problem has a permanent solution, and I'll be posting issues to both jsonld.js and deno to try to get an answer.

ianchandlercampbell commented 5 months ago

@bleonar5 Sounds really frustrating! Here's hoping that you're able to get some answers soon.