-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory issues in 1.5 #1148
Comments
What is the endpoint doing? Does it load schemas? Or does it just validate against a set of preloaded schemas? By default any schemas that are loaded get cached. This is configurable but not caching the schema reduces performance quite significantly. Your dumps just show that more schemas are cached by the 4th run and hence there are more locations and paths cached which doesn't really say anything. If your endpoint is taking a schema as input data then you shouldn't be caching the I don't really see any change between 1.4.0 to 1.5.4 that would make a difference. There is a change in |
I'm going to attempt to bisect the commits like you suggested and see if I can find where it all began. |
Is the |
It is the same on each run. So I'd expect after the first run that all the relevant schemas are cached. Then subsequent runs use the cached data and no more memory is used by the validator. |
Tried but was unable to replicate the out of memory issue. A reproducer unit test will be needed. I did notice that the cache can't be directly used as the config is potentially different. You should use the same config instance. This shouldn't be the cause of the out of memory issue though. public class JsonValidator {
...
private static final SchemaValidatorsConfig CONFIG = SchemaValidatorsConfig.builder().build();
...
public void validate(String schemaId, String json) throws JsonMappingException, JsonProcessingException {
...
final JsonSchema schema = VALIDATOR.getSchema(SchemaLocation.of(schemaId), CONFIG);
...
}
} |
When trying to upgrade from 1.4.0 to 1.5.4, we're seeing memory issues with
com.networknt.schema.JsonNodePath
increasing its memory usage each time an endpoint is run until the service OOMs. See the memory profiling screenshots below. The first of which is after an endpoint is hit once, the second is after 4 times (the 5th time OOMs). The memory usage ofcom.networknt.schema.JsonNodePath
seems to be increasing indefinitely.1st run:

4th run:

The text was updated successfully, but these errors were encountered: