Hi,
I have some trouble with Connect requests. Sometimes, but not always, I get a 447, connection timeout or failure, from the TURN server when trying to do a Connect request from one of the peers.
I'll try to describe the setup we do as clear as possible. A lot of the setup is basically just steps taken from the RFC so it should not be anything new or odd, but I want to make it clear what I'm doing and hopefully get an answer that can help me solve my problem.
The system consists of two types of Peers. Peers that are “contactable” (they do not initiate contact themselves) and Peers that are “contacters” (they initiate contact). I'll refer to the contactable Peers as Peer1 and the contacters as Peer2.
Peer1 always have an allocation, a control connection, to the TURN server, which has permission on it that only allows the TURN server to connect to it. The allocation and permission are refreshed regularly.
When Peer2 wants to contact Peer1, Peer2 sets up an allocation, a control connection, and sends a Connect request asking the TURN server to connect to Peer1's control connection. If the connect request is successful a new connection is set up from both Peer1 and Peer2 and a ConnectionBind is initiated from both Peers establishing a data connection between the two Peers over the TURN server.
Sometimes, as stated before I get a 447 error response on the Connect
request from Peer2, even though that I can see that Peer1 has an active
control connection to the TURN server.
To try to see what's happening in the TURN server the implementation was changed at file src/apps/relay/ns_ioalib_engine_impl.c, line 1302, just added a print that prints evutil_socket_error_to_string(evutil_socket_geterror(bufferevent_getfd(bev))), which gives Connection Refused.
These two flows describe what I see when it succeeds in creating a data connection and when it fails.
The connection flow (success):
--------------------
Peer1 -> Allocation -> TURN server
TURN server -> Allocation response: turnserver:peer1
-> Peer1
Peer1 -> CreatePermission (allowed: TURN server) ->
TURN server
Peer1 -> Refresh allocation -> TURN server
.
.
.
Peer2 -> Allocation -> TURN server
TURN server -> Allocation response: turnserver:peer2
-> Peer2
Peer2 -> Connect Request(turnserver:peer1) -> TURN
server
TURN server -> ConnectionAttempt(connectionid:1,
xor-peer-address:(turnserver:peer2)) -> Peer1
TURN server -> ConnectResponse(connectionid:1) ->
Peer2
Peer1 -> new connection -> TURN server
Peer1 -> Connection Bind(connectionid:1) -> TURN
server
Peer2 -> new connection -> TURN server
Peer2 -> Connection Bind(connectionid:1) -> TURN
server
The connection flow (fail):
--------------------
Peer1 -> Allocation -> TURN server
TURN server -> Allocation response: turnserver:peer1
-> Peer1
Peer1 -> CreatePermission (allowed: TURN server) ->
TURN server
Peer1 -> Refresh allocation -> TURN server
.
.
.
Peer2 -> Allocation -> TURN server
TURN server -> Allocation response: turnserver:peer2
-> Peer2
Peer2 -> Connect Request(turnserver:peer1) -> TURN
server
TURN server -> ConnectResponse(error:447) -> Peer2
--
You received this message because you are subscribed to the Google Groups "TURN Server (Open-Source project)" 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/d/optout.
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.
I'm running 3.2.4.4
- The connectionids in the successful flow must be different for different peers.Yes, I guess that could be more clear in the flow. I should've written something like connectionid:xx to be more clear about that it is "some" connectionid that is used.- Is the -x parameter used in the setup?No, it's not set as far as I know. What it is for?
- What is the network topology?Peer1 is behind a router. Router and Peer2 is connected directly to internet. TURN server runs on Amazon.- How frequent is the rate of the failures?Hard to tell, but it seemed that it occured "after a while" (maybe a day or two) of running the peers.We suspected that it might be related to max FD limit, so it was changed to 999999.We had quite a lot of connections to the server, which led us to suspect that it might be something port related.We tested to decrease the min/max port span to 11 ports, and then it was really easy to reproduce the 447 problem. We expected to get 508 at first but in our prints we got a mix of these:Error detected: errno == Connection reset by peerRemote address: 172.xx.yy.zzz:65003, Local address: 172.xx.yy.zzz:65010Error detected: errno == Connection reset by peerRemote address: 172.xx.yy.zzz:65003, Local address: 172.xx.yy.zzz:65005Error detected: errno == Connection refusedRemote address: 172.xx.yy.zzz:65000, Local address: 172.xx.yy.zzz:65005Error detected: errno == Connection refusedRemote address: 172.xx.yy.zzz:65006, Local address: 172.xx.yy.zzz:65010Error detected: errno == Connection refusedRemote address: 172.xx.yy.zzz:65002, Local address: 172.xx.yy.zzz:65008Error detected: errno == Connection refusedRemote address: 172.xx.yy.zzz:65006, Local address: 172.xx.yy.zzz:65009Error detected: errno == Connection refusedRemote address: 172.xx.yy.zzz:65002, Local address: 172.xx.yy.zzz:65004After one of the restarts we did get a 508 when peers tried to connect, and no prints. We reduced the number of peers and then the turn server accepted allocations again, but with the 447 problem when trying to do a connect request.
I noticed that sometimes allocations from my peers end up on the same port in the turn server. Is this expected behaviour?
--
You received this message because you are subscribed to the Google Groups "TURN Server (Open-Source project)" 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.
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.
I realize that I used the term Peer in the wrong context.What I've seen is that two different turn clients that create an allocation can get allocated to the same port on the turnserver. Is this expected behavior?
When a Peer wants to contact a turn client through the allocated port, how will the turn server know which turn client the peer wants to connect to?
I hope I'm describing the sitauation in a proper way (with the correct terms), otherwise I'll try to explain it better. In my case, some of my turn clients are peers as well, which might make it a little bit confusing and is probably the reason why I mix things up.I'm using Ubuntu 14.04 with Kernel 3.13, which I think should be ok.
On Mon, Oct 13, 2014 at 12:58 AM, Markus Wallén <markus....@gmail.com> wrote:I realize that I used the term Peer in the wrong context.What I've seen is that two different turn clients that create an allocation can get allocated to the same port on the turnserver. Is this expected behavior?No, that's not an expected behavior and I actually cannot imagine how that can be. Of course everything is possible, but that's highly improbable. Are you sure that you are interpreting the results of your observations correctly ?
When a Peer wants to contact a turn client through the allocated port, how will the turn server know which turn client the peer wants to connect to?Every allocation must have a unique port.
I hope I'm describing the sitauation in a proper way (with the correct terms), otherwise I'll try to explain it better. In my case, some of my turn clients are peers as well, which might make it a little bit confusing and is probably the reason why I mix things up.I'm using Ubuntu 14.04 with Kernel 3.13, which I think should be ok.That's great. But did you compile the server yourself, in the same environment ? The debian/ubuntu images in the download area on the download server are compiled with older kernel.
--
You received this message because you are subscribed to the Google Groups "TURN Server (Open-Source project)" 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.