Skip to content

Segfault in CRUDService.read() #535

@knightjoel

Description

@knightjoel

Hi. I'm seeing a segmentation fault in CRUDService.read() if I call this method multiple times in the same script:

from ydk.services import CRUDService
from ydk.providers import NetconfServiceProvider
from ydk.models.cisco_ios_xe import CISCO_CDP_MIB
from ydk.models.cisco_ios_xe import IF_MIB


address = '172.26.47.103'
username = 'admin'
password = 'cisco123'

provider = NetconfServiceProvider(address=address,
				  username=username,
				  password=password,
				  protocol='ssh',
				  port=830)

crud = CRUDService()

cdp = CISCO_CDP_MIB.CiscoCdpMib()
cdp = crud.read(provider, cdp)

if len(cdp.cdpcachetable.cdpcacheentry) > 0:
    print("**** CDP neighbor count: {}".format(len(cdp.cdpcachetable.cdpcacheentry)))
else:
    print("**** There are no CDP neighbors")

intf = IF_MIB.IfMib()
intf = crud.read(provider, intf)
print("**** Interface count: {}".format(len(intf.iftable.ifentry)))

The above script seg faults:

~/git/sdapov% python issue.py
**** CDP neighbor count: 1
[2]    59312 segmentation fault  python issue.py

However, if I reverse the order of operations and call crud.read() against the IF_MIB first, the script runs fine:

--- issue.py	2017-08-31 11:40:06.000000000 -0600
+++ issue2.py	2017-08-31 11:41:41.000000000 -0600
@@ -16,6 +16,10 @@

 crud = CRUDService()

+intf = IF_MIB.IfMib()
+intf = crud.read(provider, intf)
+print("**** Interface count: {}".format(len(intf.iftable.ifentry)))
+
 cdp = CISCO_CDP_MIB.CiscoCdpMib()
 cdp = crud.read(provider, cdp)

@@ -24,6 +28,3 @@
 else:
     print("**** There are no CDP neighbors")

-intf = IF_MIB.IfMib()
-intf = crud.read(provider, intf)
-print("**** Interface count: {}".format(len(intf.iftable.ifentry)))
~/git/sdapov% python issue2.py
**** Interface count: 74
**** CDP neighbor count: 1

I appologize, but I don't know how or where to start debugging this.

YDK-Py 0.6.0
libydk 0.6.0
Python 2.7.10
macOS 10.11.6

Python modules:
ncclient (0.5.3)
pip (9.0.1)
pybind11 (2.1.1)
setuptools (36.3.0)
six (1.10.0)
wheel (0.29.0)
ydk (0.6.0)
ydk-models-cisco-ios-xe (16.6.1)
ydk-models-cisco-ios-xr (6.2.2)
ydk-models-ietf (0.1.3)
ydk-models-openconfig (0.1.3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions