[L2SWITCH-22] Out of memory error when l2 switch installed Created: 27/Sep/14  Updated: 28/Sep/14  Resolved: 28/Sep/14

Status: Resolved
Project: l2switch
Component/s: General
Affects Version/s: unspecified
Fix Version/s: None

Type: Bug
Reporter: Jan Medved Assignee: Amit Mandke
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: File bin.tar.gz     Zip Archive log.zip     Zip Archive sfc-restconf-test.zip    
External issue ID: 2104

 Description   

Out of memory error is observed when l2switch is installed and flows are being added to the controller through the REST API. The out of memory condition seems to be related to the PS Survivor space (see attached jconsole snapshot). The exception message observed last was as follows (but it can vary):

objc[2718]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Exception in thread "DOM-OPER-DCL-77" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:949)
at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:1017)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1163)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

To reproduce:
1. Get the RC2 image distribution-karaf-0.2.0-Helium-RC2-verify-v201409250627

2. Install features as shown below (basically, openflow and l2switch)

3. Run the attached python scripts to generate/ clear flows until the
out of memory issue occurs:
3.1 > python flow_config_perf.py --nflows=200 --nthreads=10 --ncycles=10 --no-delete --auth

3.2 Wait until 20000 flows show up in the operational data space. Use:
> python inventory_crawler.py --plevel=2 --auth

3.3 clear the flows from the controller:
> python config_cleanup.py --auth

3.4 Repeat until the out of memory condition occurs

Installed features:

tandard | 3.0.1 | x | standard-3.0.1 | Karaf standard feature
config | 3.0.1 | x | standard-3.0.1 | Provide OSGi ConfigAdmin support
package | 3.0.1 | x | standard-3.0.1 | Package commands and mbeans
http | 3.0.1 | x | standard-3.0.1 | Implementation of the OSGI HTTP Service
war | 3.0.1 | x | standard-3.0.1 | Turn Karaf as a full WebContainer
kar | 3.0.1 | x | standard-3.0.1 | Provide KAR (KARaf archive) support
ssh | 3.0.1 | x | standard-3.0.1 | Provide a SSHd server on Karaf
management | 3.0.1 | x | standard-3.0.1 | Provide a JMX MBeanServer and a set of MBeans in K
odl-netconf-api | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-netconf-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Netconf :: API
odl-netconf-mapping-api | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-netconf-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Netconf :: Mapping API
odl-netconf-util | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-netconf-0.2.5-Helium-RC2-verify-v201409250627 |
odl-netconf-impl | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-netconf-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Netconf :: Impl
odl-config-netconf-connector | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-netconf-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Netconf :: Connector
odl-netconf-netty-util | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-netconf-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Netconf :: Netty Util
odl-netconf-monitoring | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-netconf-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Netconf :: Monitoring
odl-yangtools-models | 0.6.2-Helium-RC2-verify-v201409250627 | x | odl-yangtools-0.6.2-Helium-RC2-verify-v201409250627 | OpenDaylight :: Yangtools :: Models
odl-yangtools-data-binding | 0.6.2-Helium-RC2-verify-v201409250627 | x | odl-yangtools-0.6.2-Helium-RC2-verify-v201409250627 | OpenDaylight :: Yangtools :: Data Binding
odl-yangtools-binding | 0.6.2-Helium-RC2-verify-v201409250627 | x | odl-yangtools-0.6.2-Helium-RC2-verify-v201409250627 | OpenDaylight :: Yangtools :: Binding
odl-yangtools-common | 0.6.2-Helium-RC2-verify-v201409250627 | x | odl-yangtools-0.6.2-Helium-RC2-verify-v201409250627 | OpenDaylight :: Yangtools :: Common
odl-yangtools-binding-generator | 0.6.2-Helium-RC2-verify-v201409250627 | x | odl-yangtools-0.6.2-Helium-RC2-verify-v201409250627 | OpenDaylight :: Yangtools :: Binding Generator
odl-config-persister | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-config-persister-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config Persister
odl-config-startup | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-config-persister-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config Persister:: Config Startup
odl-mdsal-common | 1.1-Helium-RC2-verify-v201409250627 | x | odl-config-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config :: All
odl-config-api | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-config-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config :: API
odl-config-netty-config-api | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-config-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config :: Netty Config API
odl-config-core | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-config-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config :: Core
odl-config-manager | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-config-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config :: Manager
odl-l2switch-switch | 0.1.0-Helium-RC2-verify-v201409250627 | x | l2switch-0.1.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: L2Switch :: Switch
odl-l2switch-hosttracker | 0.1.0-Helium-RC2-verify-v201409250627 | x | l2switch-0.1.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: L2Switch :: HostTracker
odl-l2switch-addresstracker | 0.1.0-Helium-RC2-verify-v201409250627 | x | l2switch-0.1.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: L2Switch :: AddressTracker
odl-l2switch-arphandler | 0.1.0-Helium-RC2-verify-v201409250627 | x | l2switch-0.1.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: L2Switch :: ArpHandler
odl-l2switch-loopremover | 0.1.0-Helium-RC2-verify-v201409250627 | x | l2switch-0.1.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: L2Switch :: LoopRemover
odl-l2switch-packethandler | 0.1.0-Helium-RC2-verify-v201409250627 | x | l2switch-0.1.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: L2Switch :: PacketHandler
odl-openflowjava-protocol | 0.5-Helium-RC2-verify-v201409250627 | x | odl-openflowjava-0.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Openflow Java :: Protocol
odl-restconf | 1.1-Helium-RC2-verify-v201409250627 | x | odl-controller-1.1-Helium-RC2-verify-v201409250627 | OpenDaylight :: Restconf
odl-restconf-noauth | 1.1-Helium-RC2-verify-v201409250627 | x | odl-controller-1.1-Helium-RC2-verify-v201409250627 | OpenDaylight :: Restconf
odl-config-netty | 0.2.5-Helium-RC2-verify-v201409250627 | x | odl-config-persister-0.2.5-Helium-RC2-verify-v201409250627 | OpenDaylight :: Config-Netty
odl-flow-model | 1.1-Helium-RC2-verify-v201409250627 | x | odl-flow-1.1-Helium-RC2-verify-v201409250627 | OpenDaylight :: Flow :: Model
odl-flow-services | 1.1-Helium-RC2-verify-v201409250627 | x | odl-flow-1.1-Helium-RC2-verify-v201409250627 | OpenDaylight :: Flow :: Services
odl-protocol-framework | 0.5.0-Helium-RC2-verify-v201409250627 | x | odl-protocol-framework-0.5.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: Protocol Framework
odl-aaa-authn | 0.1.0-Helium-RC2-verify-v201409250627 | x | odl-aaa-0.1.0-Helium-RC2-verify-v201409250627 | OpenDaylight :: AAA :: Authentication
odl-openflowplugin-southbound | 0.0.3-Helium-RC2-verify-v201409250627 | x | openflowplugin-0.0.3-Helium-RC2-verify-v201409250627 | OpenDaylight :: Openflow Plugin :: SouthBound
odl-openflowplugin-flow-services | 0.0.3-Helium-RC2-verify-v201409250627 | x | openflowplugin-0.0.3-Helium-RC2-verify-v201409250627 | OpenDaylight :: Openflow Plugin :: Flow Services
odl-openflowplugin-drop-test | 0.0.3-Helium-RC2-verify-v201409250627 | x | openflowplugin-0.0.3-Helium-RC2-verify-v201409250627 | OpenDaylight :: Openflow Plugin :: Drop Test
pax-jetty | 8.1.14.v20131031 | x | org.ops4j.pax.web-3.1.0 | Provide Jetty engine support
pax-http | 3.1.0 | x | org.ops4j.pax.web-3.1.0 | Implementation of the OSGI HTTP Service
pax-http-whiteboard | 3.1.0 | x | org.ops4j.pax.web-3.1.0 | Provide HTTP Whiteboard pattern support
pax-war | 3.1.0 | x | org.ops4j.pax.web-3.1.0 | Provide support of a full WebContainer
odl-mdsal-broker | 1.1-Helium-RC2-verify-v201409250627 | x | odl-mdsal-1.1-Helium-RC2-verify-v201409250627 | OpenDaylight :: MDSAL :: Broker



 Comments   
Comment by Jan Medved [ 27/Sep/14 ]

Attachment log.zip has been added with description: logs

Comment by Jan Medved [ 27/Sep/14 ]

Attachment sfc-restconf-test.zip has been added with description: Python utilities to reproduce the bug

Comment by Jan Medved [ 27/Sep/14 ]

Attachment bin.tar.gz has been added with description: Mininet flow check scripts

Comment by Tony Tkacik [ 27/Sep/14 ]

L2Switch is allocating new ThreadPoolExecutor (with thread count which equals to number of CPU count) for each data event to process and submit only one new task.

L2Switch could do processing in data change callback instead of allocating threadpool.

In Jan case there is lot of data change events happening, which could lead to
allocating lot of threads which are unused and only consumes memory.

Comment by Tony Tkacik [ 27/Sep/14 ]

I tested it, and really L2Switch code base allocates new threadpool on each data change event. This threadpools are not shutdown, so they stay in background consuming
resources.

The count of allocated threads increases over time (64 nodes topolofy, no traffic) it is 5000 thread started per hour, count is not decreasing. All threads belong to unnamed threadpool.

Comment by Colin Dixon [ 28/Sep/14 ]

Fixed by: https://git.opendaylight.org/gerrit/#/c/11629/

Waiting for confirmation from Jan.

Comment by Jan Medved [ 28/Sep/14 ]

I do not see the problem anymore.

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