Correction: https://github.com/kamailio/kamailio/issues/3125 5.6.0 I mentioned it here 


On Mon, Jun 6, 2022 at 11:40 AM Nigel Daniels <nigel.daniels@gmail.com> wrote:
5.6.0 I also mentioned it here  and my workaround in greater detail. 

-Thanks.

On Thu, Jun 2, 2022 at 7:44 AM Daniel-Constantin Mierla <miconda@gmail.com> wrote:

What version of Kamailio are you using (kamailio -v)?

Cheers,
Daniel

On 29.05.22 08:18, Nigel Daniels wrote:
The logs appear as follows:

Fatal Python error: failed releasing import lock after fork


 Current thread 0x 7(13) DEBUG: <core> [core/utils/sruid.c:121]: sruid_init(): root for sruid is [srid-62930e67-d-] (0 / 16)
kamailio             | 00007fe8fb8a4180 (most recent call first):
kamailio             | <no Python frame>
kamailio             |  7(13) DEBUG: <core> [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: tm [ctl handler]
kamailio             |  7(13) DEBUG: tm [callid.c:136]: child_init_callid(): callid: '06d932e436730fa0-13@10.10.0.4'
kamailio             |  7(13) DEBUG: <core> [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: tmx [ctl handler]
kamailio             |  7(13) DEBUG: tmx [tmx_mod.c:262]: child_init(): rank is (-2)
kamailio             |  7(13) DEBUG: <core> [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: sl [ctl handler]
kamailio             |  7(13) DEBUG: <core> [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: ctl [ctl handler]
kamailio             |  7(13) DEBUG: <core> [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: debugger [ctl handler]
kamailio             |  7(13) DEBUG: debugger [debugger_mod.c:224]: child_init(): rank is (-2)
kamailio             |  7(13) DEBUG: <core> [core/sr_module.c:875]: init_mod_child(): idx 7 rank -2: app_python3 [ctl handler]
kamailio             |  7(13) DEBUG: app_python3 [apy_kemi.c:234]: sr_apy_kemi_exec_func_ex(): execution of method: .info
kamailio             |  7(13) DEBUG: app_python3 [apy_kemi.c:266]: sr_apy_kemi_exec_func_ex(): param[1] for: info is str: ===== kamailio.child_init(-2)
kamailio             |
kamailio             |  7(13) INFO: <core> [core/kemi.c:106]: sr_kemi_core_info(): ===== kamailio.child_init(-2)
kamailio             |  7(13) DEBUG: ctl [ctl.c:329]: mod_child(): ctl: mod_child(0), fork_process=0, csl=0x556774893180
kamailio             |  7(13) DEBUG: ctl [ctl.c:336]: mod_child(): ctl: 0 io_listen_loop(1, 0x556774893180)
kamailio             |  7(13) INFO: ctl [io_listener.c:213]: io_listen_loop(): io_listen_loop:  using epoll_lt io watch method (config)
kamailio             |  7(13) DEBUG: ctl [io_listener.c:245]: io_listen_loop(): io_listen_loop: adding socket 8, type 2, transport 3 (/var/run/kamailio//kamailio_ctl)
kamailio             |  7(13) DEBUG: ctl [../../core/io_wait.h:374]: io_watch_add(): processing io_watch_add(0x7fe8f9aef380, 8, 2, 0x556774893180) - fd_no=0


Running python 3.8.10

using the suggested.
# ----------------- setting module-specific parameters ---------------

# ----- tm params -----
# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3)
# default retransmission timeout: 30sec
modparam("tm", "fr_timer", 30000)
# default invite retransmission timeout after 1xx: 120sec
modparam("tm", "fr_inv_timer", 120000)

# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)

####### Routing Logic ########

modparam("app_python3", "load", "/opt/kamailio/etc/kamailio.py")

cfgengine "python"a

import sys
import KSR as KSR


def dumpObj(obj):
    for attr in dir(obj):
        KSR.info("obj.%s = %s\n" % (attr, getattr(obj, attr)))


def mod_init():
    KSR.info("===== from Python mod init\n")
    dumpObj(KSR)
    return kamailio()


class kamailio:
    def __init__(self):
        KSR.info('===== kamailio.__init__\n')

    def child_init(self, rank):
        KSR.info('===== kamailio.child_init(%d)\n' % rank)
        return 0

    def ksr_request_route(self, msg):
        KSR.info("===== request - from kamailio python script\n")
        KSR.setdsturi("sip:alice@127.0.0.1:5080")
        KSR.tm.t_on_branch("ksr_branch_route_one")
        KSR.tm.t_on_reply("ksr_onreply_route_one")
        KSR.tm.t_on_failure("ksr_failure_route_one")
        KSR.sl.send_reply(100, "Trying")
        if KSR.tm.t_relay() < 0 :
            KSR.sl.send_reply(500, "Server error")
        return 1

    def ksr_reply_route(self, msg):
        KSR.info("===== response - from kamailio python script\n")
        return 1

    def ksr_onsend_route(self, msg):
        KSR.info("===== onsend route - from kamailio python script\n")
        return 1

    def ksr_branch_route_one(self, msg):
        KSR.info("===== branch route - from kamailio python script\n")
        return 1

    def ksr_onreply_route_one(self, msg):
        KSR.info("===== onreply route - from kamailio python script\n")
        return 1

    def ksr_failure_route_one(self, msg):
        KSR.info("===== failure route - from kamailio python script\n")
        return 1

Any help is appreciated, thanks.


--
- Nigel 

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online: June 20-23, 2022
  * https://www.asipto.com/sw/kamailio-advanced-training-online/


--
- Nigel 


--
- Nigel