Hi Stefan,

Oh, sorry for bothering you while you are busy.
Have a nice holidays with your child!

I will test my patch on my environment and post it later.

Thanks,
Iwase


On 2017年08月21日 22:08, Scheglmann, Stefan wrote:
Hi,

sry cannot test this right now. Currently switched to Bird as BGP speaker for 
our setup.
Did not have the resources to set up an additional speaker with ryu currently. 
I am on
parental leave for the next 2 Months, starting tomorrow, so did not have much 
time left today.

Sry.
Stefan
On 21. Aug 2017, at 08:19, Iwase Yusuke <iwase.yusu...@gmail.com> wrote:

Hi Stefan,

Sorry for the delay.


On 2017年08月10日 18:00, Scheglmann, Stefan wrote:
Update:
Other than stated in my previous post, it seems like that even connecting with 
'ryu rpc-cli --peers=bgp=127.0.0.1:50002’ to a locally running ryu-manager and 
then closing the session using ‘EOF’, raises the memory consumption of the 
rye-manager process by around 1-2 MB each time. This raise seems to be 
permanent.
The ryu-manager runs as follows:
/usr/bin/python2 /usr/bin/ryu-manager --app-lists 
/usr/lib/python2.7/site-packages/ryu/services/protocols/bgp/application.py 
--bgp-app-config-file /usr/lib/python2.7/site-packages/ryu/bgp_strato_conf.py 
--bgp-app-rpc-host 127.0.0.1 --default-log-level 200

Thank you for your reporting!
It helps me a lot for investigating why this memory leak occurred.

The following changes fixes this problem?
Could you test this workaround?


$ git diff
diff --git a/ryu/services/protocols/bgp/net_ctrl.py 
b/ryu/services/protocols/bgp/net_ctrl.py
index 7944ac2..29bef3f 100644
--- a/ryu/services/protocols/bgp/net_ctrl.py
+++ b/ryu/services/protocols/bgp/net_ctrl.py
@@ -123,6 +123,8 @@ class RpcSession(Activity):
                                self._process_incoming_msgs)
         LOG.info('RPC Session to %s started', self.peer_name)
         green_in.wait()
+        green_out.kill()
+        LOG.info('RPC Session to %s disconnected', self.peer_name)
         green_out.wait()

     def _next_msg_id(self):


Thanks,
Iwase


The config for the rye-manager:
#
# This file is maintained by Puppet.
#
import os
from ryu.services.protocols.bgp.bgpspeaker import RF_VPN_V4
from ryu.services.protocols.bgp.bgpspeaker import RF_VPN_V6
from ryu.services.protocols.bgp.bgpspeaker import RF_L2_EVPN
from ryu.services.protocols.bgp.bgpspeaker import EVPN_MAC_IP_ADV_ROUTE
from ryu.services.protocols.bgp.bgpspeaker import TUNNEL_TYPE_VXLAN
from ryu.services.protocols.bgp.bgpspeaker import EVPN_MULTICAST_ETAG_ROUTE
from ryu.services.protocols.bgp.bgpspeaker import EVPN_IP_PREFIX_ROUTE
# =============================================================================
# BGP configuration.
# =============================================================================
BGP = {
     # AS number for this BGP instance.
     'local_as': 6xxxxx,
     # BGP Router ID.
     'router_id': ‘xx.xx.xx.xx',
     # List of BGP neighbors.
     # The parameters for each neighbor are the same as the arguments of
     # BGPSpeaker.neighbor_add() method.
     'neighbors': [
         {
             'address': ‘xx.xx.xx.xx',
             'remote_as': 6xxxxx,
             'enable_ipv4': True,
             'enable_ipv6': False,
             'enable_vpnv4': False,
             'enable_vpnv6': False,
         },
         {
             'address': ‘xx.xx.xx.xx',
             'remote_as': 6xxxx,
             'enable_ipv4': True,
             'enable_ipv6': False,
             'enable_vpnv4': False,
             'enable_vpnv6': False,
         },
     ],
}
# =============================================================================
# Logging configuration.
# =============================================================================
LOGGING = {
     # We use python logging package for logging.
     'version': 1,
     'disable_existing_loggers': False,
     'formatters': {
         'verbose': {
             'format': '%(levelname)s %(asctime)s %(module)s ' +
                       '[%(process)d %(thread)d] %(message)s'
         },
         'simple': {
             'format': '%(levelname)s %(asctime)s %(module)s %(lineno)s ' +
                       '%(message)s'
         },
         'stats': {
             'format': '%(message)s'
         },
     },
     'handlers': {
         # Outputs log to console.
         'console': {
             'level': 'DEBUG',
             'class': 'logging.StreamHandler',
             'formatter': 'simple'
         },
         'console_stats': {
             'level': 'DEBUG',
             'class': 'logging.StreamHandler',
             'formatter': 'stats'
         },
         # Rotates log file when its size reaches 10MB.
         'log_file': {
             'level': 'ERROR',
             'class': 'logging.handlers.RotatingFileHandler',
             'filename': os.path.join('.', 'bgpspeaker.log'),
             'maxBytes': '10000000',
             'formatter': 'verbose'
         },
         'stats_file': {
             'level': 'DEBUG',
             'class': 'logging.handlers.RotatingFileHandler',
             'filename': os.path.join('.', 'statistics_bgps.log'),
             'maxBytes': '10000000',
             'formatter': 'stats'
         },
     },
     # Fine-grained control of logging per instance.
     'loggers': {
         'bgpspeaker': {
             'handlers': ['console', 'log_file'],
             'level': 'DEBUG',
             'propagate': False,
         },
         'stats': {
             'handlers': ['stats_file', 'console_stats'],
             'level': 'INFO',
             'propagate': False,
             'formatter': 'stats',
         },
     },
     # Root loggers.
     'root': {
         'handlers': ['console', 'log_file'],
         'level': 'DEBUG',
         'propagate': True,
     },
}
Greets
Stefan
On 10. Aug 2017, at 10:19, Scheglmann, Stefan <scheglm...@strato.de> wrote:

Hi,

got currently the following problem. I am running a rye-manager as bgp speaker 
to announce routes in a HA setup using pacemaker.
For the periodic checks (if routes still announced) i use the  following command ryu rpc-cli --peers=bgp=127.0.0.1:50002 -c 
'request bgp operator.show [{"params": ["rib", "ipv4"], "format": "cli" }]’ 
from with in my off file.
This leads to a growing memory consumption of the ryu-manager process to which 
the rpc-cli connects to (about 1 MB more per call).
It is only a problem when i use the single command (-c, —command) feature of 
rpc-cli, if i open the interactive shell with 'rpc-cli 
--peers=bgp=127.0.0.1:50002’, do the request from within the shell and finally 
close the interactive shell with ‘EOF’. the memory consumption of the 
rye-manager is stable.

Any ideas?

Thx Stefan
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to