AaronZhangL / unimrcp

Automatically exported from code.google.com/p/unimrcp
Apache License 2.0
0 stars 0 forks source link

Segfault with default config file #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install the server with the deps package
2. run the server with the default config
3. see the seg fault occur

the problem comes with the <sip-transport> data in the sip-uas tag in the xml 
config.  Putting one of both transport (udp or tcp) works, but not when both 
are specified "tcp,udp".

This segfault occurs in the method su_casematch called from 
tport_server_addrinfo in the file tport.c from sofia-sip

Original issue reported on code.google.com by lavoie.r...@gmail.com on 21 Jan 2011 at 3:54

GoogleCodeExporter commented 9 years ago
This problem occurs on an ubuntu server 10.10 installation with default 
installation packages.

Original comment by lavoie.r...@gmail.com on 21 Jan 2011 at 4:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
this is the backtrace when the segfault occurs in gdb.

(gdb) backtrace
#0  0x00007ffff7b1e9b5 in su_casematch () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#1  0x00007ffff7b3f923 in tport_server_addrinfo () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#2  0x00007ffff7b3f22a in tport_bind_server () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#3  0x00007ffff7b3e9b6 in tport_tbind () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#4  0x00007ffff7a91399 in nta_agent_add_tport () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#5  0x00007ffff7ab603f in nua_stack_init_transport () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#6  0x00007ffff7ad0316 in nua_stack_init () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#7  0x00007ffff7b28ce3 in su_pthread_port_clone_main () from 
/usr/local/unimrcp/lib/libunimrcpserver.so.0
#8  0x00007ffff77aa971 in start_thread () from /lib/libpthread.so.0
#9  0x00007ffff750692d in clone () from /lib/libc.so.6
#10 0x0000000000000000 in ?? ()

Original comment by lavoie.r...@gmail.com on 21 Jan 2011 at 4:38

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Here's the server output

root@voip:/usr/local/unimrcp/bin# ./unimrcpserver
2011-01-20 23:48:36:435980 [NOTICE] UniMRCP Server [1.0.0]
2011-01-20 23:48:36:436068 [INFO]   APR [1.4.2]
2011-01-20 23:48:36:436083 [NOTICE] Create MRCP Server
2011-01-20 23:48:36:436136 [NOTICE] Open Config File [../conf/unimrcpserver.xml]
2011-01-20 23:48:36:436421 [INFO]   Set Property ip:10.3.3.30
2011-01-20 23:48:36:436440 [INFO]   Register Codec [PCMU]
2011-01-20 23:48:36:436446 [INFO]   Register Codec [PCMA]
2011-01-20 23:48:36:436451 [INFO]   Register Codec [L16]
2011-01-20 23:48:36:436469 [NOTICE] Register Resource [speechsynth]
2011-01-20 23:48:36:436479 [NOTICE] Register Resource [speechrecog]
2011-01-20 23:48:36:436485 [NOTICE] Register Resource [recorder]
2011-01-20 23:48:36:436490 [INFO]   Register Resource Factory
2011-01-20 23:48:36:436510 [NOTICE] Create SofiaSIP Agent [SIP-Agent-1] 
[1.12.10devel] sip:10.3.3.30:8060;transport=udp,tcp
2011-01-20 23:48:36:436516 [INFO]   Register Signaling Agent [SIP-Agent-1]
2011-01-20 23:48:36:436816 [NOTICE] Create UniRTSP Agent [RTSP-Agent-1] 
10.3.3.30:1554 [100]
2011-01-20 23:48:36:436829 [INFO]   Register Signaling Agent [RTSP-Agent-1]
2011-01-20 23:48:36:436841 [NOTICE] Create MRCPv2 Agent [MRCPv2-Agent-1] 
10.3.3.30:1544 [100]
2011-01-20 23:48:36:436934 [INFO]   Register Connection Agent [MRCPv2-Agent-1]
2011-01-20 23:48:36:436950 [NOTICE] Create Media Engine [Media-Engine-1]
2011-01-20 23:48:36:436965 [INFO]   Register Media Engine [Media-Engine-1]
2011-01-20 23:48:36:436974 [NOTICE] Create RTP Termination Factory 
10.3.3.30:[5000,6000]
2011-01-20 23:48:36:436979 [INFO]   Register RTP Termination Factory 
[RTP-Factory-1]
2011-01-20 23:48:36:436988 [INFO]   Load Plugin [PocketSphinx-1] 
[../plugin/mrcppocketsphinx.so]
2011-01-20 23:48:36:437903 [INFO]   Create PocketSphinx Engine
2011-01-20 23:48:36:437917 [INFO]   Register MRCP Engine [PocketSphinx-1]
2011-01-20 23:48:36:437925 [INFO]   Load Plugin [Demo-Synth-1] 
[../plugin/demosynth.so]
2011-01-20 23:48:36:438030 [INFO]   Register MRCP Engine [Demo-Synth-1]
2011-01-20 23:48:36:438043 [INFO]   Load Plugin [Demo-Recog-1] 
[../plugin/demorecog.so]
2011-01-20 23:48:36:438154 [INFO]   Register MRCP Engine [Demo-Recog-1]
2011-01-20 23:48:36:438166 [INFO]   Load Plugin [Recorder-1] 
[../plugin/mrcprecorder.so]
2011-01-20 23:48:36:438266 [INFO]   Register MRCP Engine [Recorder-1]
2011-01-20 23:48:36:438289 [INFO]   Register RTP Settings [RTP-Settings-1]
2011-01-20 23:48:36:438300 [NOTICE] Create MRCPv2 Profile [uni2]
2011-01-20 23:48:36:438310 [INFO]   Assign MRCP Engine [speechsynth] 
[Demo-Synth-1]
2011-01-20 23:48:36:438315 [INFO]   Assign MRCP Engine [speechrecog] 
[Demo-Recog-1]
2011-01-20 23:48:36:438319 [INFO]   Assign MRCP Engine [recorder] [Recorder-1]
2011-01-20 23:48:36:438323 [INFO]   Register Profile [uni2]
2011-01-20 23:48:36:438329 [NOTICE] Create MRCPv1 Profile [uni1]
2011-01-20 23:48:36:438333 [INFO]   Assign MRCP Engine [speechsynth] 
[Demo-Synth-1]
2011-01-20 23:48:36:438337 [INFO]   Assign MRCP Engine [speechrecog] 
[Demo-Recog-1]
2011-01-20 23:48:36:438341 [INFO]   Assign MRCP Engine [recorder] [Recorder-1]
2011-01-20 23:48:36:438346 [INFO]   Register Profile [uni1]
2011-01-20 23:48:36:438352 [INFO]   Start Task [MRCP Server]
>2011-01-20 23:48:36:438447 [INFO]   Open Engine [Demo-Recog-1]
2011-01-20 23:48:36:438464 [INFO]   Start Task [Demo Recog Engine]
2011-01-20 23:48:36:438547 [INFO]   Open Engine [Recorder-1]
2011-01-20 23:48:36:438558 [INFO]   Open Engine [Demo-Synth-1]
2011-01-20 23:48:36:438563 [INFO]   Start Task [Demo Synth Engine]
2011-01-20 23:48:36:438619 [INFO]   Open Engine [PocketSphinx-1]
2011-01-20 23:48:36:438710 [INFO]   Start Task [SIP-Agent-1]
2011-01-20 23:48:36:438779 [INFO]   Start Task [RTSP-Agent-1]
2011-01-20 23:48:36:438849 [INFO]   Start Task [MRCPv2-Agent-1]
2011-01-20 23:48:36:438997 [INFO]   Start Task [Media-Engine-1]
Segmentation fault

Original comment by lavoie.r...@gmail.com on 21 Jan 2011 at 4:49

GoogleCodeExporter commented 9 years ago
Check and correct your warnings before continue :-)

this is my unimrcpserver output so you can compare yours and mine:

2011-01-20 23:46:03:551941 [NOTICE] UniMRCP Server [1.0.0]
2011-01-20 23:46:03:552051 [INFO]   APR [1.4.2]
2011-01-20 23:46:03:552106 [NOTICE] Create MRCP Server
2011-01-20 23:46:03:552177 [NOTICE] Open Config File [../conf/unimrcpserver.xml]
2011-01-20 23:46:03:552477 [INFO]   Set Property ip:10...0
2011-01-20 23:46:03:552545 [INFO]   Register Codec [PCMU]
2011-01-20 23:46:03:552578 [INFO]   Register Codec [PCMA]
2011-01-20 23:46:03:552609 [INFO]   Register Codec [L16]
2011-01-20 23:46:03:552657 [NOTICE] Register Resource [speechsynth]
2011-01-20 23:46:03:552697 [NOTICE] Register Resource [speechrecog]
2011-01-20 23:46:03:552732 [NOTICE] Register Resource [recorder]
2011-01-20 23:46:03:552766 [INFO]   Register Resource Factory
2011-01-20 23:46:03:552816 [NOTICE] Create SofiaSIP Agent [SIP-Agent-1] 
[1.12.10devel] sip:10...0:8060;transport=udp,tcp
2011-01-20 23:46:03:552854 [INFO]   Register Signaling Agent [SIP-Agent-1]
2011-01-20 23:46:03:552990 [NOTICE] Create UniRTSP Agent [RTSP-Agent-1] 
10...0:1554 [100]
2011-01-20 23:46:03:553027 [INFO]   Register Signaling Agent [RTSP-Agent-1]
2011-01-20 23:46:03:553063 [NOTICE] Create MRCPv2 Agent [MRCPv2-Agent-1] 
10...0:1544 [100]
2011-01-20 23:46:03:553148 [INFO]   Register Connection Agent [MRCPv2-Agent-1]
2011-01-20 23:46:03:553191 [NOTICE] Create Media Engine [Media-Engine-1]
2011-01-20 23:46:03:553230 [INFO]   Register Media Engine [Media-Engine-1]
2011-01-20 23:46:03:553264 [NOTICE] Create RTP Termination Factory 
10...0:[5000,6000]
2011-01-20 23:46:03:553294 [INFO]   Register RTP Termination Factory 
[RTP-Factory-1]
2011-01-20 23:46:03:553329 [INFO]   Load Plugin [PocketSphinx-1] 
[../plugin/mrcppocketsphinx.so]
2011-01-20 23:46:03:553942 [INFO]   Create PocketSphinx Engine
2011-01-20 23:46:03:553983 [INFO]   Register MRCP Engine [PocketSphinx-1]
2011-01-20 23:46:03:554017 [INFO]   Load Plugin [Demo-Synth-1] 
[../plugin/demosynth.so]
2011-01-20 23:46:03:554123 [INFO]   Register MRCP Engine [Demo-Synth-1]
2011-01-20 23:46:03:554159 [INFO]   Load Plugin [Demo-Recog-1] 
[../plugin/demorecog.so]
2011-01-20 23:46:03:554259 [INFO]   Register MRCP Engine [Demo-Recog-1]
2011-01-20 23:46:03:554295 [INFO]   Load Plugin [Recorder-1] 
[../plugin/mrcprecorder.so]
2011-01-20 23:46:03:554379 [INFO]   Register MRCP Engine [Recorder-1]
2011-01-20 23:46:03:554431 [INFO]   Register RTP Settings [RTP-Settings-1]
2011-01-20 23:46:03:554469 [NOTICE] Create MRCPv2 Profile [uni2]
2011-01-20 23:46:03:554507 [INFO]   Assign MRCP Engine [speechsynth] 
[Demo-Synth-1]
2011-01-20 23:46:03:554542 [INFO]   Assign MRCP Engine [speechrecog] 
[Demo-Recog-1]
2011-01-20 23:46:03:554575 [INFO]   Assign MRCP Engine [recorder] [Recorder-1]
2011-01-20 23:46:03:554610 [INFO]   Register Profile [uni2]
2011-01-20 23:46:03:554641 [NOTICE] Create MRCPv1 Profile [uni1]
2011-01-20 23:46:03:554675 [INFO]   Assign MRCP Engine [speechsynth] 
[Demo-Synth-1]
2011-01-20 23:46:03:554708 [INFO]   Assign MRCP Engine [speechrecog] 
[Demo-Recog-1]
2011-01-20 23:46:03:554742 [INFO]   Assign MRCP Engine [recorder] [Recorder-1]
2011-01-20 23:46:03:554777 [INFO]   Register Profile [uni1]
2011-01-20 23:46:03:554808 [INFO]   Start Task [MRCP Server]
>2011-01-20 23:46:03:554923 [INFO]   Open Engine [Demo-Recog-1]
2011-01-20 23:46:03:554964 [INFO]   Start Task [Demo Recog Engine]
2011-01-20 23:46:03:555033 [INFO]   Open Engine [Recorder-1]
2011-01-20 23:46:03:555064 [INFO]   Open Engine [Demo-Synth-1]
2011-01-20 23:46:03:555098 [INFO]   Start Task [Demo Synth Engine]
2011-01-20 23:46:03:555161 [INFO]   Open Engine [PocketSphinx-1]
2011-01-20 23:46:03:555277 [INFO]   Start Task [SIP-Agent-1]
2011-01-20 23:46:03:562454 [INFO]   Start Task [RTSP-Agent-1]
2011-01-20 23:46:03:562522 [INFO]   Start Task [MRCPv2-Agent-1]
2011-01-20 23:46:03:562584 [INFO]   Start Task [Media-Engine-1]
2011-01-20 23:46:03:562749 [INFO]   Receive SIP Event [nua_r_set_params] Status 
200 OK
2011-01-20 23:46:03:562808 [NOTICE] MRCP Server Started

Original comment by robert.k...@oocorp.net on 21 Jan 2011 at 4:58

GoogleCodeExporter commented 9 years ago
As we talked, I attaching my installation procedure and a resume of my 
configuration.  I'm still have problems with Asterisk->UniMRCP->PocketSphinx 
communication but I haven't a segmentatio fault :-)

my installation is in a Centos 5.4 box so double check every step before 
applying it

I hope this helps !

Original comment by robert.k...@oocorp.net on 21 Jan 2011 at 5:14

Attachments:

GoogleCodeExporter commented 9 years ago
Honestly speaking, this looks like some sort of hidden bug in Sofia-SIP. I'm 
wondering if you can run the same with valgrind and provide output. Another 
thing you may try is to use the latest Sofia-SIP library instead of the one 
included in the UniMRCP dependency package to see if it makes any difference.

Original comment by achalo...@gmail.com on 3 Feb 2011 at 2:23

GoogleCodeExporter commented 9 years ago
I believe I have encountered the same problem recently. Below is the fix which 
will be available in the upcoming release of the dependencies (Sofia-SIP).

diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c
index 14570b7..14c6fd5 100644
--- a/libsofia-sip-ua/nta/nta.c
+++ b/libsofia-sip-ua/nta/nta.c
@@ -2144,6 +2144,7 @@ int nta_agent_add_tport(nta_agent_t *self,
   char const * const * tports = tports_sip;
   int error;
   ta_list ta;
+  char **tps[9];

   if (self == NULL) {
     su_seterrno(EINVAL);
@@ -2189,7 +2190,7 @@ int nta_agent_add_tport(nta_agent_t *self,
   if (url->url_params) {
     if (url_param(url->url_params, "transport", tp, sizeof(tp)) > 0) {
       if (strchr(tp, ',')) {
-       int i; char *t, *tps[9];
+       int i; char *t;

        /* Split tp into transports */
        for (i = 0, t = tp; t && i < 8; i++) {

If you look into the function nta_agent_add_tport(), it'll become clear that 
the variable tps[] MUST have been declared at least at the same level (scope) 
as the variable tport; otherwise, it could easily cause Sofia-SIP to crash.

Original comment by achalo...@gmail.com on 6 Mar 2013 at 7:53