From f8c8809d009ea6e3785e4b66047d2b4982d6286e Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 9 Feb 2022 19:17:02 -0800 Subject: session: avoid debug half-open session pool contention Half-opens are only allocated from main with worker barrier but can be cleaned up, i.e., session_half_open_free, from main without a barrier. In debug images, the free_bitmap can grow while workers peek the sessions pool, e.g., session_half_open_migrate_notify, and as a result crash while validating the session. To avoid, proactively grow bitmap in debug images. Type: fix Signed-off-by: Florin Coras Change-Id: I2410793f933fb638651fe8dc08ba78e9bee0bd77 --- src/vnet/session/session.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/vnet/session') diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index c2984198bf7..fe8a85cd5f4 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -676,6 +676,17 @@ ho_session_alloc (void) s = session_alloc (0); s->session_state = SESSION_STATE_CONNECTING; s->flags |= SESSION_F_HALF_OPEN; + /* Not ideal. Half-opens are only allocated from main with worker barrier + * but can be cleaned up, i.e., session_half_open_free, from main without + * a barrier. In debug images, the free_bitmap can grow while workers peek + * the sessions pool, e.g., session_half_open_migrate_notify, and as a + * result crash while validating the session. To avoid this, grow the bitmap + * now. */ + if (CLIB_DEBUG) + { + session_t *sp = session_main.wrk[0].sessions; + clib_bitmap_validate (pool_header (sp)->free_bitmap, s->session_index); + } return s; } -- cgit 1.2.3-korg