[SR-Users] Kamilio doesn't start up with pymongo in the Kemi Python script..

Muhammad Zaka muhammad.zaka at cloudcall.com
Tue Jun 20 16:32:49 CEST 2017


Hi all,

In kamailio 5.0.1 with kemi interface for python I am trying to use pymongo to import Mongo Client interface for python but the kamailio service fails to start up properly.

kamailio-kemi-python.py
import sys
import struct
import Router.Logger as Logger
import KSR as KSR
from pymongo import MongoClient


Case - I :  No forking and no children in kamailio.cfg
kamailio.cfg
fork=no
children=0

Kamailio service fails with the following error: -

Jun 20 15:12:32 sbc99-kam-dev kamailio: ERROR: app_python [python_support.c:142]: python_handle_exception(): mod_init: Unhandled exception in the Python code:#012Traceback (most recent call last):#012  File "/etc/kamailio/kamailio-kemi-python.py", line 19, in <module>#012    from pymongo import MongoClient#012  File "/usr/local/lib/python2.7/dist-packages/pymongo/__init__.py", line 87, in <module>#012    from pymongo.mongo_client import MongoClient#012  File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 52, in <module>#012    from pymongo.client_options import ClientOptions#012  File "/usr/local/lib/python2.7/dist-packages/pymongo/client_options.py", line 23, in <module>#012    from pymongo.pool import PoolOptions#012  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 121, in <module>#012    ('type', platform.system()),#012  File "/usr/lib/python2.7/platform.py", line 1333, in system#012    return uname()[0]#012  File "/usr/lib/python2.7/platform.py", line 1300, in uname#012    processor = _syscmd_uname('-p','')#012  File "/usr/lib/python2.7/platform.py", line 1035, in _syscmd_uname#012    rc = f.close()#012IOError: [Errno 10] No child processes

Case - II :  Forking in kamailio.cfg
fork=yes
children=32

With forking Kamailio service fails with the following error: -

Jun 20 15:19:07 sbc99-kam-dev kamailio: INFO: <core> [core/tcp_main.c:4665]: init_tcp(): using epoll_lt as the io watch method (auto detected)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: jsonrpcs [jsonrpcs_sock.c:197]: jsonrpc_dgram_mod_init(): the socket /var/run/kamailio/kamailio_rpc.sock already exists, trying to delete it...
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to import bind_ob - maybe module is not loaded
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: rr [rr_mod.c:175]: mod_init(): outbound module not available
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: pike [pike.c:99]: pike_init(): PIKE - initializing
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: pike [ip_tree.c:81]: init_lock_set(): probing 256 set size
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== from Python mod init
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.__init__
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: <core> [core/udp_server.c:153]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: <core> [core/udp_server.c:203]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(-127)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19708]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(1)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19709]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(2)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19710]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(3)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19711]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(4)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19712]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(5)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19713]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(6)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19714]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(7)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19715]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(8)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19716]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(9)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19717]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(10)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19718]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(-1)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19719]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(-1)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19720]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(-1)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19722]: INFO: jsonrpcs [jsonrpcs_sock.c:429]: jsonrpc_dgram_process(): a new child 0/19722
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(0)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19723]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(-2)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19723]: INFO: ctl [io_listener.c:214]: io_listen_loop(): io_listen_loop:  using epoll_lt io watch method (config)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19703]: INFO: <core> [main.c:759]: handle_sigs(): terminating due to SIGCHLD
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19709]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19722]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19708]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19723]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19716]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19717]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19715]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19719]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19714]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19720]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19713]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19721]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: INFO: <core> [core/kemi.c:86]: sr_kemi_core_info(): ===== kamailio.child_init(-4)
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19718]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 8
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 9
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 13
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 14
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 16
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 17
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 18
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 20
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 21
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 22
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19710]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19711]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19712]: INFO: <core> [main.c:814]: sig_usr(): signal 15 received
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 25
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 23
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 19
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 10
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 11
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 12
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]
Jun 20 15:19:07 sbc99-kam-dev /usr/sbin/kamailio[19724]: ERROR: <core> [core/io_wait.h:1040]: io_wait_loop_epoll(): epoll_wait(5, 0x7efdd80797c0, 0, 5000): Invalid argument [22]

Is there any pointers of what am I missing or is it kamailio bug?


Many Thanks

Regards

Muhammad Zaka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170620/3911bd3c/attachment.html>


More information about the sr-users mailing list