Re: [sr-dev] [kamailio/kamailio] "shm_mem_size" does not work if it was set in config file (#950)

2017-03-30 Thread Daniel-Constantin Mierla
Closed #950.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/950#event-1022123454___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] "shm_mem_size" does not work if it was set in config file (#950)

2017-01-31 Thread Daniel-Constantin Mierla
I expected that, but the issue is that there will be problems if the size is 
not provided by -m and the shm_mem_size is set after a config directive that 
needs shared memory, because the size is 0 at that moment. Probably the init of 
the size should be done inside the function initializing the shared memory, if 
it is 0.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/950#issuecomment-276341039___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] "shm_mem_size" does not work if it was set in config file (#950)

2017-01-31 Thread Maxim Malygin
Your patch will override memory size set by "-m" option in case it is 64mb (-m 
64).
I created another patch for my environment by moving setting sm_mem_size to 
default size after yyparse().

--- kamailio-4.4.3.orig/main.c  2016-09-14 16:50:30.0 +0300
+++ kamailio-4.4.3/main.c   2017-01-26 18:30:55.0 +0300
@@ -2069,9 +2069,6 @@
abort();
}
}
-   if (shm_mem_size == 0) {
-   shm_mem_size = SHM_MEM_POOL_SIZE;
-   }

if (endianness_sanity_check() != 0){
fprintf(stderr, "BUG: endianness sanity tests failed\n");
@@ -2136,6 +2133,11 @@

goto error;
}
+
+   if (shm_mem_size == 0) {
+   shm_mem_size = SHM_MEM_POOL_SIZE;
+   }
+
if (cfg_warnings){
fprintf(stderr, "%d config warnings\n", cfg_warnings);
}

It also would be good to add documentation for shm_mem_size parameter in config 
file (I did not find it).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/950#issuecomment-276317456___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] "shm_mem_size" does not work if it was set in config file (#950)

2017-01-26 Thread Daniel-Constantin Mierla
Can you try with the patch referenced by the commit above? If all ok, then I 
will backport to 4.4 branch.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/950#issuecomment-275428399___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] "shm_mem_size" does not work if it was set in config file (#950)

2017-01-26 Thread Maxim Malygin
There are no error messages. The problem is in main.c. It sets shm_mem_size to 
default value before parsing config file. But cfg.y sets shm_mem_size only when 
it's zero. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/950#issuecomment-275422990___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] "shm_mem_size" does not work if it was set in config file (#950)

2017-01-26 Thread Daniel-Constantin Mierla
Can you check the syslog file and see if you get there some error message? The 
shared memory is initialized whenever is first time needed during the parsing 
of the configuration file, so it may be that the parameter was set too late.

The safest would be indeed setting it via -m command line parameter.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/950#issuecomment-275421275___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] "shm_mem_size" does not work if it was set in config file (#950)

2017-01-26 Thread Maxim Malygin
### Description

Config file has parameter "shm_mem_size" (or "shm" or "shm_mem") which allows 
to set shared memory size (in Mb) via configuration file. This parameter worked 
well in 3.1.5. Now it does not work (4.4.2). Shared memory size is always 64Mb 
(default value). The only way to set another size is to use "-m" command line 
option.

 Reproduction

 - Set shm_mem_size=512 in configuration file
 - Start kamailio and check size of shared memory using "kamcmd core.shmmem"
 - Expected result: total size of shared memory should be 512 Mb (in bytes)
 - Actual  result: 64Mb 

### Possible Solutions

A workaround is to use "-m" command line option to send shared memeory size.

### Additional Information

version: kamailio 4.4.3 (x86_64/linux) 5a2195
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, 
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, 
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, 
USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, 
MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 5a2195
compiled on 13:41:22 Sep 27 2016 with gcc 4.4.7

OS: CentOS 6.8 (kernel 2.6.32-642.4.2.el6.x86_64)


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/950___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev