From b8b6fe4fcc9202b6811b90af8ac8f361dfff26bf Mon Sep 17 00:00:00 2001 From: fanyf Date: Thu, 17 Sep 2020 22:10:41 +0800 Subject: session: fix vpp exit abnormal due to application as a proxy server with ldp Type: fix The function of application_setup_proxy() be called when application run as a proxy server, "app_wrk->first_segment_manager" be realloced in this function, but variable of "sm" point original memory location. Signed-off-by: fanyf Change-Id: I753c9fb60d1c0794d5eede9f3fab48381a802e3c --- src/vnet/session/application.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 65d2f08ddca..a0ddaed90cf 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -874,7 +874,15 @@ vnet_application_attach (vnet_app_attach_args_t * a) fs = segment_manager_get_segment_w_lock (sm, 0); if (application_is_proxy (app)) - application_setup_proxy (app); + { + application_setup_proxy (app); + /* + * I suspect the segment manager pool gets reallocated (because a new listener + * is added, and each listener has a segment manager) so sm becomes a dangling + * reference. That's why we need to re-grab sm. + */ + sm = segment_manager_get (app_wrk->first_segment_manager); + } ASSERT (vec_len (fs->ssvm.name) <= 128); a->segment = &fs->ssvm; -- cgit 1.2.3-korg