Change in osmo-bsc[master]: dbug log: verbosely detach conn<->lchan

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Nov 9 22:55:10 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/11715


Change subject: dbug log: verbosely detach conn<->lchan
......................................................................

dbug log: verbosely detach conn<->lchan

When reading the log of OS#3686, I wished for explicit logging of when exactly
an lchan disassociates from a conn. Here is the debug logging I would have
liked to see.

I'm not sure whether we really need to merge this patch...

Change-Id: I97558b899e7f2578ba98287e7352dc072d02ce44
---
M src/osmo-bsc/bsc_subscr_conn_fsm.c
M src/osmo-bsc/lchan_fsm.c
2 files changed, 38 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/15/11715/1

diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index bca9e1f..4d6521f 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -651,14 +651,36 @@
 /* An lchan was deallocated. */
 void gscon_forget_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
 {
+	const char *detach_label = NULL;
+	if (!conn)
+		return;
 	if (!lchan)
 		return;
-	if (conn->assignment.new_lchan == lchan)
+
+	if (conn->assignment.new_lchan == lchan) {
 		conn->assignment.new_lchan = NULL;
-	if (conn->ho.new_lchan == lchan)
+		detach_label = "assignment.new_lchan";
+	}
+	if (conn->ho.new_lchan == lchan) {
 		conn->ho.new_lchan = NULL;
-	if (conn->lchan == lchan)
+		detach_label = "ho.new_lchan";
+	}
+	if (conn->lchan == lchan) {
 		conn->lchan = NULL;
+		detach_label = "primary lchan";
+	}
+
+	/* Log for both lchan FSM and conn FSM to ease reading the log in case of problems */
+	if (detach_label) {
+		if (conn->fi)
+			LOGPFSML(conn->fi, LOGL_DEBUG, "conn detaches lchan %s\n",
+				 lchan->fi? osmo_fsm_inst_name(lchan->fi) : gsm_lchan_name(lchan));
+
+		if (lchan->fi)
+			LOGPFSML(lchan->fi, LOGL_DEBUG, "conn %s detaches lchan (%s)\n",
+				 conn->fi? osmo_fsm_inst_name(conn->fi) : "(conn without FSM)",
+				 detach_label);
+	}
 
 	if (conn->fi->state != ST_CLEARING
 	    && !conn->lchan
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index d95620f..726a5bb 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -1356,8 +1356,21 @@
 /* The conn is deallocating, just forget all about it */
 void lchan_forget_conn(struct gsm_lchan *lchan)
 {
+	struct gsm_subscriber_connection *conn;
 	if (!lchan)
 		return;
+
+	conn = lchan->conn;
+	if (conn) {
+		/* Log for both lchan FSM and conn FSM to ease reading the log in case of problems */
+		if (lchan->fi)
+			LOGPFSML(lchan->fi, LOGL_DEBUG, "lchan detaches from conn %s\n",
+				 conn->fi? osmo_fsm_inst_name(conn->fi) : "(conn without FSM)");
+		if (conn->fi)
+			LOGPFSML(conn->fi, LOGL_DEBUG, "lchan %s detaches from conn\n",
+				 lchan->fi? osmo_fsm_inst_name(lchan->fi) : gsm_lchan_name(lchan));
+	}
+
 	lchan_forget_mgw_endpoint(lchan);
 	lchan->conn = NULL;
 }

-- 
To view, visit https://gerrit.osmocom.org/11715
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I97558b899e7f2578ba98287e7352dc072d02ce44
Gerrit-Change-Number: 11715
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181109/ad1df9ef/attachment.htm>


More information about the gerrit-log mailing list