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/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/18881 ) Change subject: libosmo-mgcp-client: fix memleak: clear pending queue ...................................................................... libosmo-mgcp-client: fix memleak: clear pending queue If the remote MGCP peer closes connection (or simply crashes), the existing 'mgcp_response_pending' entities will never be removed from the queue (mgcp->responses_pending). This problem was noticed while running several LCLS test cases from ttcn3-bsc-test. Every test case makes osmo-bsc leak two messages. I found those messages suspicious and assumed that they're related: DLMGCP ERROR mgcp_client.c:700 Failed to read: r=127.0.0.1:2427<->l=127.0.0.1:2727: 111='Connection refused' DLMGCP ERROR mgcp_client.c:700 Failed to read: r=127.0.0.1:2427<->l=127.0.0.1:2727: 111='Connection refused' Let's flush the pending response queue in such cases. Change-Id: Ia2e89f31685a0822e5cb147a06cc1fc68efc1ec4 Related: OS#4619 --- M src/libosmo-mgcp-client/mgcp_client.c 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/81/18881/1 diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c index e9b3ec0..3df32aa 100644 --- a/src/libosmo-mgcp-client/mgcp_client.c +++ b/src/libosmo-mgcp-client/mgcp_client.c @@ -683,6 +683,19 @@ return rc; } +static void mgcp_pending_flush(struct mgcp_client *mgcp) +{ + struct mgcp_response_pending *e; + + while (!llist_empty(&mgcp->responses_pending)) { + e = llist_entry(mgcp->responses_pending.next, + struct mgcp_response_pending, + entry); + llist_del(&e->entry); + talloc_free(e); + } +} + static int mgcp_do_read(struct osmo_fd *fd) { struct mgcp_client *mgcp = fd->data; @@ -700,6 +713,10 @@ LOGP(DLMGCP, LOGL_ERROR, "Failed to read: %s: %d='%s'\n", osmo_sock_get_name2(fd->fd), errno, strerror(errno)); + /* Handle loss of connection (clear the queues) */ + if (errno == ECONNREFUSED) + mgcp_pending_flush(mgcp); + msgb_free(msg); return -1; } else if (ret > 4096 - 128) { -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/18881 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ia2e89f31685a0822e5cb147a06cc1fc68efc1ec4 Gerrit-Change-Number: 18881 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200617/7630ae04/attachment.htm>