diff options
author | Sergey Elantsev <elantsev.s@yandex.ru> | 2022-04-01 22:43:40 +0300 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2022-05-05 01:29:15 +0000 |
commit | 945b7c7ae69c414ef851f85596be4edeb1d9290e (patch) | |
tree | 9aaa14e1461dbd6ea4b175215bd1844f3672c40e /doc.go | |
parent | 4a4094e6cdc7f5d9e5a470ccf82df1c780c7e224 (diff) |
fixed data race in core.Connection.Close().
The problem is triggered by the following events:
1. VPP stops.
2. core.Connection.healthCheckLoop() detects it and calls disconnectVPP(),
which does close healthCheckDone channel for the first time.
At this point Connection becomes unusable - re-entrance to
connectLoop() will return immediately because of a closed
healthCheckDone channel.
But, the race is that connection may set c.vppConnected = 1
before terminating the connect loop.
3. User calls Connection.Close(), who seed c.vppConnected = 1,
and tries to close already closed channel, which leads to a panic.
This commit fixes this race by telling disconnectVPP() whether
it is a terminal stop triggered via Close(), or a temporary one
from connectLoop().
Change-Id: I555149da35ca3dc2b606bad59f2101266c0ef6b9
Signed-off-by: Sergey Elantsev <elantsev.s@yandex.ru>
Diffstat (limited to 'doc.go')
0 files changed, 0 insertions, 0 deletions