Change in osmo-msc[master]: osmo-msc: Improve shutdown due to signal and print talloc report on exit

2018-08-14 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/10445 )

Change subject: osmo-msc: Improve shutdown due to signal and print talloc 
report on exit
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/10445/1/src/osmo-msc/msc_main.c
File src/osmo-msc/msc_main.c:

https://gerrit.osmocom.org/#/c/10445/1/src/osmo-msc/msc_main.c@718
PS1, Line 718:  talloc_disable_null_tracking();
Also, we don't have NULL context tracking enabled, so
an additional patch is required now...



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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If6ea9171fd79f03251342f75987690b0d9dc3814
Gerrit-Change-Number: 10445
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Tue, 14 Aug 2018 11:46:23 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-msc[master]: osmo-msc: Improve shutdown due to signal and print talloc report on exit

2018-08-14 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/10445 )

Change subject: osmo-msc: Improve shutdown due to signal and print talloc 
report on exit
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/10445/1/src/osmo-msc/msc_main.c
File src/osmo-msc/msc_main.c:

https://gerrit.osmocom.org/#/c/10445/1/src/osmo-msc/msc_main.c@702
PS1, Line 702:  sleep(3);
BTW: not related to this change, but why do we need this call?

The main loop is not being executed during sleep, so I think
nothing actually happens... Correct me if I am wrong :)



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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If6ea9171fd79f03251342f75987690b0d9dc3814
Gerrit-Change-Number: 10445
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Tue, 14 Aug 2018 11:44:24 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-msc[master]: osmo-msc: Improve shutdown due to signal and print talloc report on exit

2018-08-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10445 )

Change subject: osmo-msc: Improve shutdown due to signal and print talloc 
report on exit
..

osmo-msc: Improve shutdown due to signal and print talloc report on exit

Same as we do in osmo-hlr.

Change-Id: If6ea9171fd79f03251342f75987690b0d9dc3814
---
M src/osmo-msc/msc_main.c
1 file changed, 26 insertions(+), 5 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index aa06fb9..b1bb52a 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -110,6 +110,8 @@

 static struct osmo_timer_list db_sync_timer;

+static int quit = 0;
+
 static void print_usage()
 {
printf("Usage: osmo-msc\n");
@@ -233,10 +235,8 @@
switch (signal) {
case SIGINT:
case SIGTERM:
-   msc_network_shutdown(msc_network);
-   osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
-   sleep(3);
-   exit(0);
+   LOGP(DMSC, LOGL_NOTICE, "Terminating due to signal %d\n", 
signal);
+   quit++;
break;
case SIGABRT:
osmo_generate_backtrace();
@@ -692,8 +692,29 @@
}
}

-   while (1) {
+   while (!quit) {
log_reset_context();
osmo_select_main(0);
}
+
+   msc_network_shutdown(msc_network);
+   osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
+   sleep(3);
+
+   log_fini();
+
+   /**
+* Report the heap state of root context, then free,
+* so both ASAN and Valgrind are happy...
+*/
+   talloc_report_full(tall_msc_ctx, stderr);
+   talloc_free(tall_msc_ctx);
+
+   /**
+* Report the heap state of NULL context, then free,
+* so both ASAN and Valgrind are happy...
+*/
+   talloc_report_full(NULL, stderr);
+   talloc_disable_null_tracking();
+   return 0;
 }

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If6ea9171fd79f03251342f75987690b0d9dc3814
Gerrit-Change-Number: 10445
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmo-msc[master]: osmo-msc: Improve shutdown due to signal and print talloc report on exit

2018-08-14 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10445 )

Change subject: osmo-msc: Improve shutdown due to signal and print talloc 
report on exit
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If6ea9171fd79f03251342f75987690b0d9dc3814
Gerrit-Change-Number: 10445
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 14 Aug 2018 06:53:48 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: osmo-msc: Improve shutdown due to signal and print talloc report on exit

2018-08-13 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/10445


Change subject: osmo-msc: Improve shutdown due to signal and print talloc 
report on exit
..

osmo-msc: Improve shutdown due to signal and print talloc report on exit

Same as we do in osmo-hlr.

Change-Id: If6ea9171fd79f03251342f75987690b0d9dc3814
---
M src/osmo-msc/msc_main.c
1 file changed, 26 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/45/10445/1

diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index aa06fb9..b1bb52a 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -110,6 +110,8 @@

 static struct osmo_timer_list db_sync_timer;

+static int quit = 0;
+
 static void print_usage()
 {
printf("Usage: osmo-msc\n");
@@ -233,10 +235,8 @@
switch (signal) {
case SIGINT:
case SIGTERM:
-   msc_network_shutdown(msc_network);
-   osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
-   sleep(3);
-   exit(0);
+   LOGP(DMSC, LOGL_NOTICE, "Terminating due to signal %d\n", 
signal);
+   quit++;
break;
case SIGABRT:
osmo_generate_backtrace();
@@ -692,8 +692,29 @@
}
}

-   while (1) {
+   while (!quit) {
log_reset_context();
osmo_select_main(0);
}
+
+   msc_network_shutdown(msc_network);
+   osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
+   sleep(3);
+
+   log_fini();
+
+   /**
+* Report the heap state of root context, then free,
+* so both ASAN and Valgrind are happy...
+*/
+   talloc_report_full(tall_msc_ctx, stderr);
+   talloc_free(tall_msc_ctx);
+
+   /**
+* Report the heap state of NULL context, then free,
+* so both ASAN and Valgrind are happy...
+*/
+   talloc_report_full(NULL, stderr);
+   talloc_disable_null_tracking();
+   return 0;
 }

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If6ea9171fd79f03251342f75987690b0d9dc3814
Gerrit-Change-Number: 10445
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol