pjturn client - crashed the turn server latest version in centos 6.4, is this normal?

302 views
Skip to first unread message

Sprogrammer

unread,
Nov 27, 2013, 3:58:26 PM11/27/13
to turn-server-project...@googlegroups.com
I was testing Turn server with Pjturn while testing the latest turn server it was crashed. as you can see the logs were not showing in Turn server but Pjturn client was trying to send over and over but failing. After turn server restart it said:

[root@server2 default]# service turnserver status
turnserver dead but pid file exists
[root@server2 default]# service turnserver restart
Stopping turnserver:                                       [FAILED]
Starting turnserver:                                       [  OK  ]
[root@server2 default]# service turnserver status
turnserver (pid  22208) is running...
[root@server2 default]# tail -f /var/log/messages
Nov 28 00:15:38 localhost turnserver: 0: IPv4. UDP listener opened on: 192.168.1.12:3479
Nov 28 00:15:38 localhost turnserver: 0: IPv6. UDP listener opened on: ::1:3478
Nov 28 00:15:38 localhost turnserver: 0: IPv6. UDP listener opened on: ::1:3479
Nov 28 00:15:38 localhost turnserver: 0: IPv4. TCP listener opened on : 127.0.0.1:3478
Nov 28 00:15:38 localhost turnserver: 0: IPv4. TCP listener opened on : 127.0.0.1:3479
Nov 28 00:15:38 localhost turnserver: 0: IPv4. TCP listener opened on : 192.168.1.12:3478
Nov 28 00:15:38 localhost turnserver: 0: IPv4. TCP listener opened on : 192.168.1.12:3479
Nov 28 00:15:38 localhost turnserver: 0: IPv6. TCP listener opened on : ::1:3478
Nov 28 00:15:38 localhost turnserver: 0: IPv6. TCP listener opened on : ::1:3479
Nov 28 00:15:38 localhost turnserver: 0: IO method (auth thread): epoll


------------- pj client and turn server hand shake packets log --------
Nov 28 00:16:03 localhost turnserver: 24: handle_udp_packet: New UDP endpoint: local addr 192.168.1.12:3478, remote addr 192.168.1.15:47911
Nov 28 00:16:03 localhost turnserver: 24: handle_turn_command: user <>: request BINDING processed, error 0
Nov 28 00:16:03 localhost turnserver: 24: handle_udp_packet: New UDP endpoint: local addr 192.168.1.12:3478, remote addr 192.168.1.15:60586
Nov 28 00:16:03 localhost turnserver: 24: handle_turn_command: user <>: request BINDING processed, error 0
Nov 28 00:17:03 localhost turnserver: 84: TURN full connection closed, user <>
Nov 28 00:17:03 localhost turnserver: 84: TURN full connection closed, user <>

why its saying error????





Oleg Moskalenko

unread,
Nov 27, 2013, 4:05:37 PM11/27/13
to turn-server-project...@googlegroups.com
The crash is not normal, of course.

It is saying "error 0" that means "no error".

I only see BINDING requests, that means that you are using only STUN, right ?

Do you have the wireshark traces of the communications between your client and the server ?

What exactly you are doing ? Can you send me the exact description how I reproduce it ?

Oleg

Sprogrammer

unread,
Nov 27, 2013, 4:19:03 PM11/27/13
to turn-server-project...@googlegroups.com
OK

Hard to reproduce it was sudden issue. What i am doing is following:

1) i have CentOS 6.4 64-bit server Dell R310 hardware where i am running FreeSwitch sip from git latest code and using Turn server latest one, i let everything as it is default (without extra modifications on those)

$ service freeswitch start
$ service turnserver start
$ tail
-f /var/log/messages


2) then in my laptop ubuntu 12.10 64-bit i was using pjnath , with pjnath i did one SIP client which keep connecting to the FreeSwitch with following code:

import sys
import pjsua as pj
LOG_LEVEL
=3
current_call
= None


def log_cb(level, str, len):
   
print str,
   
class MyAccountCallback(pj.AccountCallback):
   
def __init__(self, account=None):
        pj
.AccountCallback.__init__(self, account)
   
def on_incoming_call(self, call):
       
global current_call
       
if current_call:
            call
.answer(486, "Busy")
           
return            
       
print "Incoming call from ", call.info().remote_uri
       
print "Press 'a' to answer"
        current_call
= call
        call_cb
= MyCallCallback(current_call)
        current_call
.set_callback(call_cb)
        current_call
.answer(180)      
class MyCallCallback(pj.CallCallback):
   
def __init__(self, call=None):
        pj
.CallCallback.__init__(self, call)
   
def on_state(self):
       
global current_call
       
print "Call with", self.call.info().remote_uri,
       
print "is", self.call.info().state_text,
       
print "last code =", self.call.info().last_code,
       
print "(" + self.call.info().last_reason + ")"      
       
if self.call.info().state == pj.CallState.DISCONNECTED:
            current_call
= None
           
print 'Current call is', current_call
   
def on_media_state(self):
       
if self.call.info().media_state == pj.MediaState.ACTIVE:
            call_slot
= self.call.info().conf_slot
            pj
.Lib.instance().conf_connect(call_slot, 0)
            pj
.Lib.instance().conf_connect(0, call_slot)
           
print "Media is now active"
       
else:
           
print "Media is inactive"
def make_call(uri):
   
try:
       
print "Making call to", uri
       
return acc.make_call(uri, cb=MyCallCallback())
   
except pj.Error, e:
       
print "Exception: " + str(e)
       
return None      
       
lib
= pj.Lib()
try:
    lib
.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb))
    transport
= lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0))
   
print "\nListening on", transport.info().host,
   
print "port", transport.info().port, "\n"        
    lib
.start()
   
# when no sound card found
    lib
.set_null_snd_dev()
   
#snd_dev = lib.get_snd_dev()
   
#print snd_dev ## returns (-1,-2)
   
#lib.set_snd_dev(0,0)      
   
#acc = lib.create_account_for_transport(transport, cb=MyAccountCallback())
    acc
= lib.create_account(pj.AccountConfig("192.168.1.12", "1shamun", "admin2013"))
    cb
= MyAccountCallback(acc)
    acc
.set_callback(cb)
   
#cb.wait()
   
print "\n"
   
print "Registration complete, status=", acc.info().reg_status, \
         
"(" + acc.info().reg_reason + ")"    


   
if len(sys.argv) > 1:
        lck
= lib.auto_lock()
        current_call
= make_call(sys.argv[1])
       
print 'Current call is', current_call
       
del lck


    my_sip_uri
= "sip:" + transport.info().host + \
                 
":" + str(transport.info().port)
   
while True:
       
print "My SIP URI is", my_sip_uri
       
print "Menu:  m=make call, h=hangup call, a=answer call, q=quit"


        input
= sys.stdin.readline().rstrip("\r\n")
       
if input == "m":
           
if current_call:
               
print "Already have another call"
               
continue
           
print "Enter destination URI to call: ",
            input
= sys.stdin.readline().rstrip("\r\n")
           
if input == "":
               
continue
            lck
= lib.auto_lock()
            current_call
= make_call(input)
           
del lck


       
elif input == "h":
           
if not current_call:
               
print "There is no call"
               
continue
            current_call
.hangup()


       
elif input == "a":
           
if not current_call:
               
print "There is no call"
               
continue
            current_call
.answer(200)


       
elif input == "q":
           
break


    transport
= None
    acc
.delete()
    acc
= None
    lib
.destroy()
    lib
= None


except pj.Error, e:
   
print "Exception: " + str(e)
    lib
.destroy()
    lib
= None



3) at the same time i was trying to then test turn server and pjturn client as following:

./pjturn-client-x86_64-unknown-linux-gnu --tcp 192.168.1.12:3478



pjturn client was sending traffic to turn server at that time i think turn server was crashed


4) after restarting then its working again


but i cant find the details to reproduce it again. I will keep you posted if i can again recreate it.



Thank you
Regards





On Wednesday, November 27, 2013 10:05:37 PM UTC+1, Oleg Moskalenko wrote:
The crash is not normal, of course.

It is saying "error 0" that means "no error".

I only see BINDING requests, that means that you are using only STUN, right ?

Do you have the wireshark traces of the communications between your client and the server ?

What exactly you are doing ? Can you send me the exact description how I reproduce it ?

Oleg


Oleg Moskalenko

unread,
Nov 27, 2013, 4:29:19 PM11/27/13
to Sprogrammer, turn-server-project...@googlegroups.com
I ll try to play with pjnath client.

Thanks
Oleg

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "TURN Server project rfc5766-turn-server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turn-server-project-rfc57...@googlegroups.com.
To post to this group, send email to turn-server-project...@googlegroups.com.
Visit this group at http://groups.google.com/group/turn-server-project-rfc5766-turn-server.
For more options, visit https://groups.google.com/groups/opt_out.

Sprogrammer

unread,
Nov 27, 2013, 4:39:39 PM11/27/13
to turn-server-project...@googlegroups.com, Sprogrammer
+=====================================================================+
|             CLIENT                 |             PEER-0             |
|                                    |                                |
| State     : Ready                  | Address: 192.168.1.15:46590    |
| Relay addr: 192.168.1.12:61471     |                                |
|                                    | 0  Send data to relay address  |
| a      Allocate relay              |                                |
| p,pp   Set permission for peer 0/1 +--------------------------------+
| s,ss   Send data to peer 0/1       |             PEER-1             |
| b,bb   BindChannel to peer 0/1     |                                |
| x      Delete allocation           | Address: 192.168.1.15:39407    |
+------------------------------------+                                |
| q  Quit                  d  Dump   | 1  Send data to relay adderss  |
+------------------------------------+--------------------------------+


1) ./pjturn-client-x86_64-unknown-linux-gnu -F --tcp 192.168.1.12:3478
- after connecting to turn server
- When i press a, p, pp, s, ss, b, bb, x, d
- i see in turn server different message then client 

i am actually trying to simulate TURN only (not stun) but the client logs saying STUN, but in SERVER we see turn/stun like mixture, confusing see below:

client says:

>>> 22:35:02.379 tcprel0x228f9f !.RX 56 bytes STUN message from 192.168.1.12:3478:
--- begin STUN message ---
STUN
ChannelBind success response
 
Hdr: length=36, magic=2112a442, tsx_id=000071883352255a0216231e
 
Attributes:
  SOFTWARE
: length=32, value="Citrix-3.0.1.3 'Practical Frost'"
--- end of STUN message ---


22:35:02.379 stun_session.c  .tdata 0x2292368 destroy request, force=0, tsx=0x2292520
22:35:02.379  utsx0x2292520  .STUN transaction 0x2292520 schedule destroy
22:35:02.683  utsx0x2292520  STUN client transaction 0x2292520 stopped, ref_cnt=6
22:35:02.683 stun_session.c  STUN transaction 0x2292520 destroyed


server says:

Nov 28 00:52:32 localhost turnserver: 2213: TURN full connection closed, user <>
Nov 28 00:52:32 localhost turnserver: 2213: TURN full connection closed, user <>
Nov 28 00:52:39 localhost turnserver: 2221: IPv4. tcp or tls connected to: 192.168.1.15:36121
Nov 28 00:52:39 localhost turnserver: 2221: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:52:39 localhost turnserver: 2221: IPv4. Local relay addr: 192.168.1.12:58605
Nov 28 00:52:39 localhost turnserver: 2221: new Allocation: id=0x753ad8ad, username=<>, lifetime=600
Nov 28 00:52:39 localhost turnserver: 2221: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:52:46 localhost turnserver: 2227: TURN full connection closed, user <>
Nov 28 00:52:46 localhost turnserver: 2227: TURN full connection closed, user <>
Nov 28 00:52:54 localhost turnserver: 2235: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:39 localhost turnserver: 2280: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:43 localhost turnserver: 2284: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:46 localhost turnserver: 2287: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:48 localhost turnserver: 2289: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:54 localhost turnserver: 2295: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:53:56 localhost turnserver: 2297: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:53:59 localhost turnserver: 2300: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:00 localhost turnserver: 2301: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:01 localhost turnserver: 2302: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:02 localhost turnserver: 2303: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:03 localhost turnserver: 2304: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:04 localhost turnserver: 2305: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:06 localhost turnserver: 2307: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:07 localhost turnserver: 2308: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:08 localhost turnserver: 2309: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:09 localhost turnserver: 2310: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:10 localhost turnserver: 2311: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:13 localhost turnserver: 2314: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:15 localhost turnserver: 2316: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:37 localhost turnserver: 2338: refreshed Allocation: id=0x753ad8ad, username=<>, lifetime=0
Nov 28 00:54:37 localhost turnserver: 2338: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:54:37 localhost turnserver: 2338: TURN full connection closed, user <>
Nov 28 00:54:45 localhost turnserver: 2346: IPv4. tcp or tls connected to: 192.168.1.15:60330
Nov 28 00:54:45 localhost turnserver: 2346: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:54:45 localhost turnserver: 2346: IPv4. Local relay addr: 192.168.1.12:64422
Nov 28 00:54:45 localhost turnserver: 2346: new Allocation: id=0x8d3ad8ad, username=<>, lifetime=600
Nov 28 00:54:45 localhost turnserver: 2346: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:54:56 localhost turnserver: 2357: refreshed Allocation: id=0x8d3ad8ad, username=<>, lifetime=0
Nov 28 00:54:56 localhost turnserver: 2357: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:54:56 localhost turnserver: 2357: TURN full connection closed, user <>
Nov 28 00:55:02 localhost turnserver: 2363: IPv4. tcp or tls connected to: 192.168.1.15:40504
Nov 28 00:55:02 localhost turnserver: 2363: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:55:02 localhost turnserver: 2363: IPv4. Local relay addr: 192.168.1.12:58132
Nov 28 00:55:02 localhost turnserver: 2363: new Allocation: id=0x8d37d90d, username=<>, lifetime=600
Nov 28 00:55:02 localhost turnserver: 2363: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:55:20 localhost turnserver: 2381: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:55:31 localhost turnserver: 2392: refreshed Allocation: id=0x8d37d90d, username=<>, lifetime=0
Nov 28 00:55:31 localhost turnserver: 2392: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:55:31 localhost turnserver: 2392: TURN full connection closed, user <>
Nov 28 00:56:11 localhost turnserver: 2432: handle_udp_packet: New UDP endpoint: local addr 192.168.1.12:3478, remote addr 192.168.1.15:46590
Nov 28 00:56:11 localhost turnserver: 2432: handle_turn_command: user <>: request BINDING processed, error 0
Nov 28 00:56:11 localhost turnserver: 2432: handle_udp_packet: New UDP endpoint: local addr 192.168.1.12:3478, remote addr 192.168.1.15:39407
Nov 28 00:56:11 localhost turnserver: 2432: handle_turn_command: user <>: request BINDING processed, error 0
Nov 28 00:56:37 localhost turnserver: 2458: IPv4. tcp or tls connected to: 192.168.1.15:52467
Nov 28 00:56:37 localhost turnserver: 2458: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:56:37 localhost turnserver: 2458: IPv4. Local relay addr: 192.168.1.12:61471
Nov 28 00:56:37 localhost turnserver: 2458: new Allocation: id=0x713ad8ad, username=<>, lifetime=600
Nov 28 00:56:37 localhost turnserver: 2458: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:56:50 localhost turnserver: 2472: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:57:00 localhost turnserver: 2481: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:57:04 localhost turnserver: 2485: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:57:11 localhost turnserver: 2492: TURN full connection closed, user <>
Nov 28 00:57:11 localhost turnserver: 2492: TURN full connection closed, user <>
Nov 28 00:58:38 localhost turnserver: 2579: refreshed Allocation: id=0x713ad8ad, username=<>, lifetime=0
Nov 28 00:58:38 localhost turnserver: 2579: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:58:38 localhost turnserver: 2579: TURN full connection closed, user <>




thank you
Regards

Oleg Moskalenko

unread,
Nov 27, 2013, 4:44:06 PM11/27/13
to Sprogrammer, turn-server-project...@googlegroups.com
TURN is using STUN binary protocol. So, to some extend, those terms are interchangeable. STUN is using only BINDING request; TURN uses multiple requests. But they both use the same binary protocol.

In your logs I see that TURN is used.

I just noticed on PJNATH web page that they are not RFC5766 compliant - their implementation is based upon an older draft. That may be the source of the problem. But I still would like to drill down to the crash.

Oleg





Oleg Moskalenko

unread,
Nov 27, 2013, 6:06:44 PM11/27/13
to turn-server-project...@googlegroups.com, Sprogrammer
I tried to reproduce it with phnath 2.1.0 but I could not. Everything works fine between pjnath and the turnserver, and I know that the people are using pjnath with this turnserver and it works. But I am using Mac OS X right now. I'll try to reproduce it in CentOS6 later.

Regards,
Oleg
To unsubscribe from this group and stop receiving emails from it, send an email to turn-server-project-rfc5766-turn-server+unsubscribe@googlegroups.com.
To post to this group, send email to turn-server-project-rfc5766-turn-...@googlegroups.com.

Sprogrammer

unread,
Nov 27, 2013, 6:33:57 PM11/27/13
to turn-server-project...@googlegroups.com, Sprogrammer
YES - i have been also trying random way using pjsip and turn server latest version. But till now nothing abnormal occured yet. I will also post you if it occures again.

Thank you
Regards

Ovian Sen

unread,
Oct 21, 2015, 11:43:46 AM10/21/15
to TURN Server (Open-Source project), sha...@companysocia.com


Hi,

I am trying to connect pjturn_client with turn-server (Coturn). When i try with 2 public IPs (one for turnserver and and other for pjturn_cline) it works fine but set 2 peers with one IPs 7 2 different ports (expected). I would line to have the peers from two different IPs. Could you help me in setting up two different peer IP addresses instead of local IP address for those peers?

Thanks
Sen
...
Reply all
Reply to author
Forward
0 new messages