Hi David, 

Are you sure you refresh systemctl daemon reload after edit? 

Centos 7.7 works with that (the capability setting is only needed if user Kamailio runs for example port below 1024 like 443). 

cat /etc/systemd/system/kamailio.service.d/override.conf                                         
# Generated by puppet                                [Service]
LimitNPROC=100000                                    LimitNOFILE=100000
AmbientCapabilities=CAP_NET_BIND_SERVICE

You can check that setting after 
systemctl daemon reload 
systemctl restart kamailio

In the proc filesystem for example one pid is 16420

cat /proc/16420/limits

Cheers 
Karsten 

David Villasmil <david.villasmil.work@gmail.com> schrieb am Fr., 29. Nov. 2019, 17:43:
woops!

But no, same thing.. 

Regards,

David Villasmil
phone: +34669448337


On Fri, Nov 29, 2019 at 3:45 PM Joel Serrano <joel@textplus.com> wrote:
Try without the two [Service] sections... not sure if that can be the problem. 

Move the LimitNOFILE=65536 to the existing section where the test of params are. 

Then daemon-reload and retry...

Maybe it works. 

On Fri, Nov 29, 2019 at 04:48 David Villasmil <david.villasmil.work@gmail.com> wrote:
Hello guys,

I tried that and it _seems_ to be working, BUT:

running `service kamailio start` just stays there and fails after about a minute:

Job for kamailio.service failed. See 'systemctl status kamailio.service' and 'journalctl -xn' for details.

running systemctl status kamailio.service replies with:

# systemctl status kamailio.service
● kamailio.service - Kamailio SIP Server
   Loaded: loaded (/etc/systemd/system/kamailio.service; enabled)
   Active: activating (start) since Fri 2019-11-29 07:17:19 EST; 24s ago
     Docs: man:kamailio(8)
           http://www.kamailio.org/
  Process: 24259 ExecStart=/usr/sbin/kamailio -m $SHM_SIZE -M $PKG_SIZE -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg (code=exited, status=0/SUCCESS)
  Process: 24255 ExecStartPre=/usr/sbin/kamailio -c (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/kamailio.service
           ├─24261 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24263 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24264 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24265 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24266 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24267 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24268 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24269 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24270 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24271 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24272 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24273 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24274 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24275 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24276 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24277 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24278 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24279 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24280 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24281 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24282 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24283 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24284 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24285 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24286 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24287 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24288 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24289 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24290 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24291 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24292 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24293 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24294 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24295 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24296 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24297 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24298 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24299 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24300 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24301 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24302 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24303 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24304 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24305 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           ├─24306 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
           └─24307 /usr/sbin/kamailio -m 1024 -M 256 -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg

Nov 29 07:17:43 sip /usr/sbin/kamailio[24306]: INFO: {1 CiUgnANofuHynAGcc5UfMA..} <script>: [RELAY] callid: CiUgnANofuHynAGcc5UfMA.. from=..... to=+.....
Nov 29 07:17:43 sip /usr/sbin/kamailio[24272]: ERROR: {1 cjwc3ajUEhE_QKuxT4FXOA..} <script>: route[WITHINGLG]: callid: cjwc3ajUEhE_QKuxT4FXOA.. Got a BYE message from .....
Nov 29 07:17:43 sip /usr/sbin/kamailio[24272]: INFO: {1 cjwc3ajUEhE_QKuxT4FXOA..} <script>: route[RELAY]: callid: cjwc3ajUEhE_QKuxT4FXOA.. Relaying
Nov 29 07:17:43 sip /usr/sbin/kamailio[24272]: INFO: {1 cjwc3ajUEhE_QKuxT4FXOA..} <script>: [RELAY] callid: cjwc3ajUEhE_QKuxT4FXOA.. from=..... to=..... is a GSM user (0)
Nov 29 07:17:44 sip /usr/sbin/kamailio[24300]: ERROR: <core> [core/tcp_read.c:302]: tcp_read_data(): error reading: Connection reset by peer (104) ([1.2.3.4]:11618 ->
Nov 29 07:17:44 sip /usr/sbin/kamailio[24300]: ERROR: <core> [core/tcp_read.c:304]: tcp_read_data(): -> [4.3.2.1]:5060)
Nov 29 07:17:44 sip /usr/sbin/kamailio[24300]: ERROR: <core> [core/tcp_read.c:1505]: tcp_read_req(): ERROR: tcp_read_req: error reading - c: 0x7f3c3fd9cb98 r: 0x7f3c3fd9cc18 (-1)
Nov 29 07:17:44 sip /usr/sbin/kamailio[24266]: NOTICE: {2 9FRQDB7DQM4GLP6UkgPcag..} acc [acc.c:281]: acc_log_request(): ACC: transaction answered: timestamp=1575029864;method=INVITE;from_tag=98337e3a;to_tag=as142a8bb8;call_id=9FRQDB...
Nov 29 07:17:44 sip /usr/sbin/kamailio[24303]: INFO: {1 9FRQDB7DQM4GLP6UkgPcag..} <script>: route[RELAY]: callid: 9FRQDB7DQM4GLP6UkgPcag.. Relaying
Nov 29 07:17:44 sip /usr/sbin/kamailio[24303]: INFO: {1 9FRQDB7DQM4GLP6UkgPcag..} <script>: [RELAY] callid: 9FRQDB7DQM4GLP6UkgPcag.. from=..... to=..... is a GSM user (0)


Is it possible systemd is taking those "ERROR"s as an indication the service is not starting properly? Even though it is?

my service unit file is like so:

~# cat /etc/systemd/system/multi-user.target.wants/kamailio.service
[Unit]
Description=Kamailio SIP Server
Documentation=man:kamailio(8) http://www.kamailio.org/
After=syslog.target network-online.target

[Service]
LimitNOFILE=65536

[Service]
Type=forking
User=kamailio
Environment=SHM_SIZE=1024
Environment=PKG_SIZE=256
ExecStartPre=/usr/sbin/kamailio -c
ExecStart=/usr/sbin/kamailio -m $SHM_SIZE -M $PKG_SIZE  -x fm -X fm -f /etc/kamailio/kamailio_gsm.cfg
ExecStopPost=/usr/bin/rm -f /run/kamailio/kamailio.pid
PIDFile=/run/kamailio/kamailio.pid
Restart=on-failure
RestartSec=30

[Install]
WantedBy=multi-user.target


Thanks everyone.

Regards,

David Villasmil
phone: +34669448337


On Fri, Nov 29, 2019 at 9:31 AM David Villasmil <david.villasmil.work@gmail.com> wrote:
Hello Daniel,

Thanks for replying.
I will try that.

Thanks!

David

On Fri, 29 Nov 2019 at 09:23, Daniel Tryba <d.tryba@pocos.nl> wrote:
On Thu, Nov 28, 2019 at 03:21:21PM +0000, David Villasmil wrote:
> Thanks Alex,
>
> Do you know how to set it? First time doing thousands of tcp registrations..
>

Depends on what init system you use. If you have to ask I pesume you are
using systemd (since they like to reinvent the wheel). The correct way
is to:
systemctl edit kamailio.service
and add:
[Service]
LimitNOFILE=65536

More quick and dirty:
edit /etc/systemd/system/kamailio.service.d/override.conf
and insert the same as above. And do a
systemctl daemon-reload

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Regards,

David Villasmil
phone: +34669448337
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users