[CONTROLLER-1505] OutOfMemoryError in YangStoreSnapshot Created: 30/Mar/16  Updated: 25/Jul/23  Resolved: 31/Mar/16

Status: Resolved
Project: controller
Component/s: config
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Tom Pantelis Assignee: Tom Pantelis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 5625

 Description   

I've observed OutOfMemoryError in YangStoreSnapshot while pushing a config:

Exception in thread "config-pusher" java.lang.OutOfMemoryError
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:259)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:152)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.eclipse.osgi.baseadaptor.bundlefile.ZipBundleEntry$ZipBundleEntryInputStream.read(ZipBundleEntry.java:161)
at com.google.common.io.ByteStreams.copy(ByteStreams.java:70)
at com.google.common.io.ByteStreams.toByteArray(ByteStreams.java:115)
at org.opendaylight.controller.config.facade.xml.osgi.YangStoreSnapshot.getModuleSource(YangStoreSnapshot.java:159)
at org.opendaylight.controller.config.facade.xml.osgi.YangStoreService.getModuleSource(YangStoreService.java:98)
at org.opendaylight.controller.config.facade.xml.ConfigSubsystemFacadeFactory.getCurrentCapabilities(ConfigSubsystemFacadeFactory.java:48)
at org.opendaylight.controller.config.persist.impl.ConfigPusherImpl.waitForCapabilities(ConfigPusherImpl.java:180)
at org.opendaylight.controller.config.persist.impl.ConfigPusherImpl.pushConfigWithConflictingVersionRetries(ConfigPusherImpl.java:159)
at org.opendaylight.controller.config.persist.impl.ConfigPusherImpl.internalPushConfigs(ConfigPusherImpl.java:129)
at org.opendaylight.controller.config.persist.impl.ConfigPusherImpl.processSingle(ConfigPusherImpl.java:83)

This is reproducible if you change or add an invalid required capability so it retries. After a period of time the OutOfMemoryError will occur.

This is caused by a resource leak in YangStoreSnapshot getModuleSource - it doesn't close the InputStream returned via yangTextSchemaSource.openStream().

I think this error can also occur for valid configs if there are enough of them but it definitely occurs with failure retries.



 Comments   
Comment by Tom Pantelis [ 30/Mar/16 ]

Submitted https://git.opendaylight.org/gerrit/#/c/36886/

Comment by Tom Pantelis [ 30/Mar/16 ]

Looks like the offending code was added in Be so we'll need to cherry-pick.

Comment by Robert Varga [ 31/Mar/16 ]

be: https://git.opendaylight.org/gerrit/#/c/36916/

Generated at Wed Feb 07 19:55:43 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.