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

Fix UPG proxy race conditions for multi core setup #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions upf/upf_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ proxy_start_connect_fn (const u32 * session_index)

/* TODO: RACE: should not access the flow on the main thread */
flow = pool_elt_at_index (fm->flows, ps->flow_index);
if (pool_is_free_index (gtm->sessions, flow->session_index))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look exactly like a fix, isn't that more of a workaround? The idea which was mentioned in the comment above is that with a separate single worker thread, we should only access the flowable from that worker thread. With multiple workers, things become harder as we have concurrent access to the flowtable from multiple workers. So perhaps we should add a comment that we still have a race here, and create a follow-up issue for proper multithreaded flowtable handling?

{
ps->refcnt--;
ps->active_open_establishing = 0;
goto out;
}
sx = pool_elt_at_index (gtm->sessions, flow->session_index);
if (sx->generation != flow->generation)
{
Expand All @@ -380,6 +386,12 @@ proxy_start_connect_fn (const u32 * session_index)
ASSERT (flow_pdr_id (flow, FT_ORIGIN) != ~0);
pdr = pfcp_get_pdr_by_id (active, flow_pdr_id (flow, FT_ORIGIN));
ASSERT (pdr);
if (!pdr)
{
ps->refcnt--;
ps->active_open_establishing = 0;
goto out;
}
far = pfcp_get_far_by_id (active, pdr->far_id);

memset (a, 0, sizeof (*a));
Expand Down