[sr-dev] git:5.2:f14807f7: app_perl: log the number of reset cycles in debug message

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 7 10:48:36 CEST 2019


Module: kamailio
Branch: 5.2
Commit: f14807f722e85feb8c7d98b08454a432837fecf7
URL: https://github.com/kamailio/kamailio/commit/f14807f722e85feb8c7d98b08454a432837fecf7

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-10-07T10:39:42+02:00

app_perl: log the number of reset cycles in debug message

(cherry picked from commit 1fdabbf5ce5fd218a47b7d147ebec5c6c45c1cce)

---

Modified: src/modules/app_perl/app_perl_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f14807f722e85feb8c7d98b08454a432837fecf7.diff
Patch: https://github.com/kamailio/kamailio/commit/f14807f722e85feb8c7d98b08454a432837fecf7.patch

---

diff --git a/src/modules/app_perl/app_perl_mod.c b/src/modules/app_perl/app_perl_mod.c
index 181f70f859..785d4c39b0 100644
--- a/src/modules/app_perl/app_perl_mod.c
+++ b/src/modules/app_perl/app_perl_mod.c
@@ -201,7 +201,7 @@ PerlInterpreter *parser_init(void) {
 	perl_construct(new_perl);
 
 	argv[0] = ""; argc++; /* First param _needs_ to be empty */
-	
+
 	 /* Possible Include path extension by modparam */
 	if (modpath && (strlen(modpath) > 0)) {
 		modpathset_start = argc;
@@ -380,6 +380,7 @@ static void destroy(void)
 }
 
 
+static int app_perl_reset_n = 0;
 /**
  * count executions and rest interpreter
  *
@@ -400,8 +401,10 @@ int app_perl_reset_interpreter(void)
 	if(_ap_exec_cycles<=*_ap_reset_cycles)
 		return 0;
 
-	if(perl_destroy_func)
+	if(perl_destroy_func) {
 		call_argv(perl_destroy_func, G_DISCARD | G_NOARGS | G_EVAL, args);
+		LM_DBG("perl destroy function executed\n");
+	}
 
 	gettimeofday(&t1, NULL);
 	if (perl_reload()<0) {
@@ -411,10 +414,11 @@ int app_perl_reset_interpreter(void)
 	}
 	gettimeofday(&t2, NULL);
 
-	LM_INFO("perl interpreter has been reset [%d/%d] (%d.%06d => %d.%06d)\n",
+	app_perl_reset_n++;
+	LM_INFO("perl interpreter has been reset [%d/%d] (%d.%06d => %d.%06d) (n: %d)\n",
 				_ap_exec_cycles, *_ap_reset_cycles,
 				(int)t1.tv_sec, (int)t1.tv_usec,
-				(int)t2.tv_sec, (int)t2.tv_usec);
+				(int)t2.tv_sec, (int)t2.tv_usec, app_perl_reset_n);
 	_ap_exec_cycles = 0;
 
 	return 0;




More information about the sr-dev mailing list