[Freeswitch-dev] FS-6849: mod_python error everytime session is invoked for the first time right after a freeswitch start

Nuno Reis nreis at wavecom.pt
Thu Sep 25 07:54:03 MSD 2014


Using gdb I've figured out that in mod_python.c:281:
...
result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
Py_DECREF(function);
...

variable result is always null when a python script trying to use the
session run the first time right after freeswitch startup.
That will make it enter the else logic in line 291 in the same file ending
with a crash.
I'll still have to drill more to find out why this is happening now.
Anyone has a clue on what's going on?

BR,

--

*Nuno Miguel Reis* | *Unified Communication** Systems*
M. +351 913907481 | nreis at wavecom.pt
WAVECOM-Soluções Rádio, S.A.
Cacia Park | Rua do Progresso, Lote 15
3800-639 AVEIRO | Portugal
T. +351 309 700 225 | F. +351 234 919 191
*GPS
<http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88>
| www.wavecom.pt <http://www.wavecom.pt/>** <http://www.wavecom.pt/>*

[image: Description: Description: WavecomSignature]
<http://www.wavecom.pt/pt/wavecom/premios.php>

[image: Publicity] <http://www.wavecom.pt/pt/mail_eventos.php>



On Tue, Sep 23, 2014 at 3:53 AM, Nuno Reis <nreis at wavecom.pt> wrote:

> This is the output after calling the script right after start:
>
> 2014-09-23 03:49:45.801129 [NOTICE] mod_python.c:212 Invoking py module:
> teste
> 2014-09-23 03:49:45.801129 [NOTICE] switch_cpp.cpp:1328 Testing123...
> 2014-09-23 03:49:45.801129 [NOTICE] switch_cpp.cpp:1328 Dumping current
> CDR INFO
> 2014-09-23 03:49:45.801129 [ERR] mod_python.c:293 Error calling python
> script
> 2014-09-23 03:49:45.801129 [ERR] mod_python.c:164 Python Error by calling
> script "teste": <type 'exceptions.AttributeError'>
> Message: 'PySwigObject' object has no attribute 'getXMLCDR'
> Exception: None
>
> Traceback (most recent call last)
>         File: "/opt/freeswitch/scripts/teste.py", line 12, in handler
>
> All the following script calls work just fine.
>
> *Note:*  If you want to test the code snippet i've added before don't
> forget to add:
>
> import freeswitch
>
> Looking forward to hear from you.
>
> Best Regards,
>
> --
>
> *Nuno Miguel Reis* | *Unified Communication** Systems*
> M. +351 913907481 | nreis at wavecom.pt
> WAVECOM-Soluções Rádio, S.A.
> Cacia Park | Rua do Progresso, Lote 15
> 3800-639 AVEIRO | Portugal
> T. +351 309 700 225 | F. +351 234 919 191
> *GPS
> <http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88>
> | www.wavecom.pt <http://www.wavecom.pt/>** <http://www.wavecom.pt/>*
>
> [image: Description: Description: WavecomSignature]
> <http://www.wavecom.pt/pt/wavecom/premios.php>
>
> [image: Publicity] <http://www.wavecom.pt/pt/mail_eventos.php>
>
>
>
> On Tue, Sep 23, 2014 at 3:44 AM, Nuno Reis <nreis at wavecom.pt> wrote:
>
>> Hi guys.
>>
>> I've reported this before and i can tell that it is still happening in
>> the latest v1.4.
>>
>> How reproduce:
>>
>>
>>    1. just create a dialplan that calls a python script
>>    2. dial that dialplan entry
>>
>>
>> Example code (works with anything that invokes *session*):
>>
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>>
>> from __future__ import absolute_import
>> # http://docs.python.org/whatsnew/pep-328.html
>>
>> def handler(session, args):
>>         freeswitch.consoleLog("notice", "Testing123...")
>>         freeswitch.consoleLog("notice", "Dumping current CDR INFO")
>>         freeswitch.consoleLog("info", str(session.getXMLCDR()))
>>         freeswitch.consoleLog("notice", "The END!")
>>
>>
>> mod_pyhton crashes everytime the script is called right after a
>> freeswitch start (the very first time session is invoked inside a
>> mod_python python script).
>> After the first time (error), everything starts to work just fine.
>> This doesn't happen in e6b8b3e4f2deac73547bc9b9a2cb3e1d3147d101 from
>> v1.2.stable
>>
>> Should i open a jira on this?
>>
>> --
>>
>> *Nuno Miguel Reis* | *Unified Communication** Systems*
>> M. +351 913907481 | nreis at wavecom.pt
>> WAVECOM-Soluções Rádio, S.A.
>> Cacia Park | Rua do Progresso, Lote 15
>> 3800-639 AVEIRO | Portugal
>> T. +351 309 700 225 | F. +351 234 919 191
>> *GPS
>> <http://maps.google.com/maps/ms?msa=0&msid=202333747613191340808.0004b4b227a6144f0df88>
>> | www.wavecom.pt <http://www.wavecom.pt/>** <http://www.wavecom.pt/>*
>>
>> [image: Description: Description: WavecomSignature]
>> <http://www.wavecom.pt/pt/wavecom/premios.php>
>>
>> [image: Publicity] <http://www.wavecom.pt/pt/mail_eventos.php>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20140925/0dce26e1/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 16423 bytes
Desc: not available
Url : http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20140925/0dce26e1/attachment-0001.png 


Join us at ClueCon 2014 Aug 4-7, 2014
More information about the FreeSWITCH-dev mailing list