Improve tunnel_sync server side rpc to handle race conditions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Expired
|
Medium
|
Unassigned |
Bug Description
We have a concern that we may have race conditions with the following code snippet:
if host:
if (ip_endpoint and ip_endpoint.host is None
Consider two threads (A and B), where for
Thread A we have following use case:
if Host is passed from an agent and it is not found in DB but the passed tunnel_ip is found, delete the endpoint from DB and add the endpoint with
(tunnel_ip, host), it's an upgrade case.
whereas for Thread B we have following use case:
if passed host and tunnel_ip are not found in the DB, it is a new endpoint.
Both threads will do the following in the end:
tunnel = driver.
tunnels = driver.
entry = {'tunnels': tunnels}
# Notify all other listening agents
# Return the list of tunnels IP's to the agent
return entry
Since, Thread A first deletes the endpoints and adds it, we may have chances where Thread B doesn't get that endpoint in get_endpoints call during race condition.
One way to overcome this problem would be instead of doing delete_endpoint we could introduce update_endpoint method in type_drivers.
Changed in neutron: | |
status: | New → Incomplete |
Changed in neutron: | |
status: | Incomplete → Invalid |
summary: |
- Improve tunnel_sync server side rpc + Improve tunnel_sync server side rpc to handle race conditions |
description: | updated |
Changed in neutron: | |
assignee: | nobody → Romil Gupta (romilg) |
status: | Invalid → New |
tags: | added: ml2 |
Changed in neutron: | |
importance: | Undecided → Medium |
Changed in neutron: | |
status: | In Progress → Incomplete |
assignee: | Romil Gupta (romilg) → nobody |
Fix proposed to branch: master /review. openstack. org/189686
Review: https:/