Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Put" watch events with nil value cause SIGSEGV #434

Closed
dzvancuks opened this issue Mar 31, 2021 · 1 comment
Closed

"Put" watch events with nil value cause SIGSEGV #434

dzvancuks opened this issue Mar 31, 2021 · 1 comment

Comments

@dzvancuks
Copy link

  1. Setup https://github.com/ligato/vpp-agent to watch Redis "config/vpp/v2/interfaces" events. Set up Redis to notify all events CONFIG SET notify-keyspace-events AKE
  2. Create many Put watch events by writing some values into Redis /vnf-agent/$mslbl/config/vpp/v2/interfaces/. E.g. 4000 GRE tunnels.
  3. Immediately (<1sec) after Redis provisioning do launch Lua script that deletes these keys EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 /vnf-agent/*/config/vpp/v2/interfaces/*.

According to redis-cli watch CN-Infra has queue of keys to notify VPP-Agent with Put events. On each event it separately reads value for given key. But since Lua script blocks Redis and wipes all keys these values becomes nil. As soon as keys are deleted, Redis gets unblocked and plugin continues to read data that is already deleted.

[1 [::1]:35468] "get" "/vnf-agent/vpp1589/config/vpp/v2/interfaces/<GRE tunnel #1899>
[1 [::1]:35468] "get" "/vnf-agent/vpp1589/config/vpp/v2/interfaces/<GRE tunnel #1900>
[1 [::1]:35468] "get" "/vnf-agent/vpp1589/config/vpp/v2/interfaces/<GRE tunnel #1901>
[1 [::1]:35468] "get" "/vnf-agent/vpp1589/config/vpp/v2/interfaces/<GRE tunnel #1902>
[1 lua] "del" "/vnf-agent/vpp1589/config/vpp/v2/interfaces/<GRE tunnel #1>" "/vnf-agent/vpp1589/config/vpp/v2/interfaces/<GRE tunnel #2>" <...>
[1 [::1]:35468] "get" "/vnf-agent/vpp1589/config/vpp/v2/interfaces/<GRE tunnel #1903> <-- nil value, SIGSEGV

Expected results:
On nil value watch event CN-Infra protoWatchResp.GetValue() should return error. VPP agent's orchestrator plugin Plugin.watchEvents() should get an error, log it, and continue operating.
Actual results:
proto_watcher_impl.go:GetValue() tries to unmarshall protoWatchResp.BytesWatchResp.value that is nil. VPP-agent crashes with SIGSEGV

@dzvancuks
Copy link
Author

Sorry, this was my local changes issue. Did some experiments with orchistrator without checking for nil event value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant