-
Notifications
You must be signed in to change notification settings - Fork 376
Closed
Description
Describe the bug
Following #1860 by @lukasz-kuzynski-11sigma we've been able to bump from Prism 4.1.2 to Prism 4.3.4.
However, some of servers started to restart due to Out of Memory issues. We've tracked down the issue to validateInput
and validateOutput
functions leaking memory.
To Reproduce
A complete standalone repro case is available at https://github.com/nulltoken/prism_repro
It triggers a loop of 1000 request and response validations, capturing the amount of used Heap every 10 steps, and triggering a garbage collection between every step.
Running yarn repro
shows the following output where one can clearly see the heap growing.
$ yarn repro
yarn run v1.22.5
$ yarn node -r ts-node/register --unhandled-rejections=strict --expose-gc ./src/repro.ts
unknown format "JSON Web Token RFC 7519" ignored in schema at path "#/properties/authorization"
unknown format "JSON Web Token RFC 7519" ignored in schema at path "#/properties/authorization"
[...snipped for brevity...]
unknown format "JSON Web Token RFC 7519" ignored in schema at path "#/properties/authorization"
unknown format "JSON Web Token RFC 7519" ignored in schema at path "#/properties/authorization"
i HeapUsed
0 114059736
10 113304496
20 113369808
30 113711088
[...snipped for brevity...]
930 131688256
940 131704024
950 131884168
960 132243528
970 132365232
980 132556000
990 132876080
Running prism v4.3.4
Done in 15.77s.
Expected behavior
No leak ? ;-)
/cc @chohmann