Re: [OpenSIPS-Devel] [OpenSIPS-Users] python module - bug and questions

2017-04-28 Thread Mundkowsky, Robert
I don’t have time to setup your test jig right now. But attached are the snippets of code that fail. You will need to the following to use them: I am using Python 2.7.13 (via conda 4.2.13). You will need a MySQL database. sudo apt-get install -y libmysqlclient-dev sudo

Re: [OpenSIPS-Devel] [OpenSIPS-Users] python module - bug and questions

2017-04-26 Thread Mundkowsky, Robert
Thanks for responding. Thought you would just advise me to use specific compiler flags first. Do you want me to use your jig (testing setup) to make a crash? Or do you want me to add python code to your git repo so you can run it using your jig? What you are doing with code is pretty complex

Re: [OpenSIPS-Devel] [OpenSIPS-Users] python module - bug and questions

2017-04-26 Thread Mundkowsky, Robert
I am guessing this is not the case. My guess is mod_init is called once by main/master openSIPS process and child_init is called for each child openSIPS process. Hence you should modify your C code not to initialize the Python stuff in mod_init, but instead in child_init. And your Python code

Re: [OpenSIPS-Devel] [OpenSIPS-Users] python module - bug and questions

2017-04-25 Thread Maxim Sobolev
Robert, what you have described is how essentially python module works. We init the interpreter and then the opensips forks, and in each of its children the mod_init() python function exported by your code is called, which returns instance whose method can be invoked via script. So at the end of

Re: [OpenSIPS-Devel] [OpenSIPS-Users] python module - bug and questions

2017-04-25 Thread Mundkowsky, Robert
Overall, I think trying to use threads, even “Python threads” across multiple processes is a bad idea. Threads are usually meant to live inside one process. Robert Mundkowsky From: Mundkowsky, Robert Sent: Tuesday, April 25, 2017 1:26 PM To: 'Maxim Sobolev' Cc: OpenSIPS

Re: [OpenSIPS-Devel] [OpenSIPS-Users] python module - bug and questions

2017-04-24 Thread Maxim Sobolev
Robert sorry for the delay. What could be useful if you can produce chunk of python routing code (could be NOP on the functional side) that crashes repeatedly on our voiptest jig (https://github.com/sippy/voiptests). The travis is setup to build pull requests, so that you can inject your code and

Re: [OpenSIPS-Devel] [OpenSIPS-Users] python module - bug and questions

2017-04-21 Thread Mundkowsky, Robert
Python 2.7.13 on Ubuntu 16.04.2 LTS. How do you link using pthreads? Do you add flags to Makefile, or will setting “USE_PTHREAD_MUTEX” and “USE_POSIX_SEM” via menuconfig do it? Since openSIPS is not multithread, seems like it would be a lot cleaner to not use threads at all on C/C++. Then