[YANGTOOLS-660] SchemaContext - excessive memory consumption Created: 20/Sep/16 Updated: 10/Apr/22 Resolved: 19/Oct/16 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Highest |
| Reporter: | Andrej Mak | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Issue Links: |
|
||||||||||||||||
| Epic Link: | Parser Performance | ||||||||||||||||
| External issue ID: | 6757 | ||||||||||||||||
| Description |
|
When I try to create SchemaContext including 500 complicated models (8 MB of yang sources), SchemaContext instance occupies 1.6 GB of memory. Profiling has shown, that one of the causes could be large number of duplicated objects - probably EnumMaps in class SubstatementContext. |
| Comments |
| Comment by Robert Varga [ 15/Oct/16 ] |
|
Can you share a heap dump and the list of models? |
| Comment by Robert Varga [ 17/Oct/16 ] |
|
Analysis of the provided memory dump shows quite clearly that we are retaining implementation-internal details and state in the end result. We retain BuildSchemaContext, SourceSpecificContext, SubstatementContext and similar, which should certainly not be retained once EffectiveSchemaContext has been built. It would seem that the problem is EffectiveStatementBase.unknownSubstatementsToBuild, introduced in https://git.opendaylight.org/gerrit/#/c/28300/. |
| Comment by Robert Varga [ 17/Oct/16 ] |
|
The approach taken to fix the recursion issue needs to be revised so that that field does not exist at all. |
| Comment by Robert Varga [ 17/Oct/16 ] |
| Comment by Robert Varga [ 17/Oct/16 ] |
| Comment by A H [ 18/Oct/16 ] |
|
Reopening bug since it needs to be fixed in Beryllium SR4. |
| Comment by A H [ 18/Oct/16 ] |
|
To better assess the impact of this bug and fix, could someone from your team please help us identify the following: |
| Comment by Robert Varga [ 18/Oct/16 ] |
|
Severity: The problem is triggered by presence of an 'extension' statement containing another extension. The only workaround is to not to load models containing such constructs, which is not practical. The issue could be exploited by a malicious SB device to cause a resource exhaustion on the controller. Given the SR4 is our last planned maintenance release, we should not be releasing it without this issue being fixed. Testing: The combination of the two patches has been manually tested against the device which flushed the original bug report and confirmed to work (no regression on BUG-4456) and to have eliminated the memory leak (reported memory usage was ~240MB). We currently do not have system tests which would identify this sort of issues, but we are in process of introducing such a test suite in Carbon. Impact: |
| Comment by Robert Varga [ 18/Oct/16 ] |
|
beryllium: https://git.opendaylight.org/gerrit/47091 |
| Comment by A H [ 19/Oct/16 ] |
|
Has this bug been verified as fixed in the latest Beryllium SR4 Build 20161019? |