Juniper / jtimon

Junos Telemetry Interface (JTI) client
Apache License 2.0
30 stars 10 forks source link

Encountered a segmentation fault (SIGSEGV) with "invalid memory address or nil pointer dereference" error while running AFT sensors with logging enabled #39

Open penieljacobpaulg opened 3 months ago

penieljacobpaulg commented 3 months ago

While running AFT sensors with logging enabled using the specified configuration, I encountered a runtime error: "invalid memory address or nil pointer dereference." The error message is as follows:

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xae088f]

goroutine 78 [running]: main.jLogInternalJtimonForGnmi(0xc000436000, 0xc0004b5200, 0xc000555090) /Users/amohit/go/src/jtimon/internal_jtimon.go:130 +0x6f main.gnmiHandleResponse(0xc000436000, 0xc000555090) /Users/amohit/go/src/jtimon/subscribe_gnmi.go:407 +0xb0d main.subscribegNMI.func1() /Users/amohit/go/src/jtimon/subscribe_gnmi.go:555 +0x189 created by main.subscribegNMI /Users/amohit/go/src/jtimon/subscribe_gnmi.go:516 +0x72f

JSON configuration:

{ "host": "[2001:4860::192:168:0:5]", "port": 10162, "user": "csim", "password": "Juniper123", "gnmi": { "mode": 0, "encoding": 2 }, "cid": "r5_ocst_ext_1", "vendor": { "gnmi": { "encoding": "protobuf" } }, "grpc": { "ws": 5242880 }, "eos": true, "internal-jtimon": { "data-log-file": "TelemetrySensorData.log" }, "tls": { "clientcrt": "/home/csim/B2_2024/certs/client/client.crt", "clientkey": "/home/csim/B2_2024/certs/client/client.key", "ca": "/home/csim/B2_2024/certs/ca/ca.crt", "servername": "R6" }, "paths": [ { "path": "/network-instances/network-instance/afts/", "freq": 300000, "gnmi_submode": 2 }, { "path": "/network-instances/network-instance/mpls/signaling-protocols/rsvp-te/sessions/session/record-route-objects/", "freq": 0, "gnmi_submode": 1 } ] }

penieljacobpaulg commented 3 months ago

@M-Vivek @amohit1315 please look into it

amohit1315 commented 3 months ago

The above panic error is seen because juniper header extension value was nil. Have added checks for this now to avoid parsing results, if its nil