[QUESTION] TURN candidates never work with ICE_TRANSPORT_RELAY setting #1917
Replies: 26 comments 3 replies
-
Hi @mehmetcy84, we have a Windows CI in our repository now. Please refer to the steps here so that you can build with PThreads without modifying anything related to libwebsockets. Can you please check if this issue persists after you use PThreads? |
Beta Was this translation helpful? Give feedback.
-
I am not sure if I am following correctly. I haven't disabled pthreads. Setting this value to 0 Would this change affect the usage of pthreads? Isn't this flag just for building some samples? |
Beta Was this translation helpful? Give feedback.
-
I see that in the workflow, build_windows_openssl.bat is used instead of build_windows.bat. And this file has additional configuration lines for pthread. Now my confusion about disabling pthread is resolved. I have reverted all my changes, so that my git head is at kvs master branch SHA-1: 0ae9ec6 again. I made sure the pthread folder is where it is expected, and ran build_windows_openssl.bat and the build succeeded without any errors. I ran the kvsWebrtcClientViewer.exe again, and receive audio frames. Then I set the policy to "RELAY ONLY", and the client again cannot make peer connection. So the issue persists. |
Beta Was this translation helpful? Give feedback.
-
Hi @mehmetcy84, I see the error |
Beta Was this translation helpful? Give feedback.
-
I am using the credentials and region information my company is currently using, I am not sure if they make use of any other regions but I will check. In its default configuration, useTURN is true in createSampleConfiguration, and ICE_TRANSPORT_POLICY_ALL is selected. We were expecting to see that relay candidates are selected as the last line of defense, as the worst case scenario happens and no host or srflx candidates work. But this does not happen. So seeing my coworker not being able to connect at all, and me connecting via srflx candidate all the time made me realise: TURN candidates never work for us. And that's why I wanted to test TURN candidates specifically and selected ICE_TRANSPORT_POLICY_RELAY, to be able to demonstrate that relay candidates do not work. So, what might be the reason we get STATUS_TURN_CONNECTION_ALLOCAITON_FAILED? |
Beta Was this translation helpful? Give feedback.
-
Just checked and verified that regions are not configurable for our project. So I would like to find out if there is a solution for making use of TURN without changing regions. |
Beta Was this translation helpful? Give feedback.
-
I have run the sample viewer client exe from our UK office via remote access, and TURN candidates which are of [us-east-#] region do work fine, and WebRTC connection now succeeds. But what would be the solution to enable access to our server with a fixed region, worldwide via TURN? |
Beta Was this translation helpful? Give feedback.
-
@mehmetcy84, can you please help me understand your setup?
I see that a new candidate is available later but I see that it results in a similar failure:
|
Beta Was this translation helpful? Give feedback.
-
Hello, thanks for the reply.
The WebRTC Test Page Master I am trying to make a WebRTC connection to is located in the UK and/or in Turkiye. Both cases fail.
The Viewer client is run in Turkiye. (Fails)
Both master and client are configured with region us-east-1 or us-east-2. (Our actual aim is to connect to some cameras which makes use of regions us-east-1 and us-east-2 along with eu-west-2. So we have to make sure we are able to connect to us-east-#)
Geographically, I am with my failing client located in Turkiye, and making use of access/secret key pair coupled with us-east-1&2 regions.
I will check this, but I thought TURN would be a solution for problematic network cases or firewalls. I will try disabling firewalls and try again. |
Beta Was this translation helpful? Give feedback.
-
Ok, so we have discussed the possible impact of my geographical location to describe the failure of TURN connection. Here is a contradictary observation to note:
I use the same Access/Secret Key and the same region:us-east-1
So does this not eliminate the possible effect of geographical location? |
Beta Was this translation helpful? Give feedback.
-
P.S. I have now my firewall disabled. |
Beta Was this translation helpful? Give feedback.
-
@niyatim23 Can you think of anyway to verify why WebRTC Test Page viewer might be able make the TURN connection with the same credentials/region info, but not the C SDK sample viewer? |
Beta Was this translation helpful? Give feedback.
-
Hi @mehmetcy84, Looking at the following excerpt from your logs, I see the first three
The Can you please try to set the DEFAULT_TURN_ALLOCATION_MAX_TRY_COUNT to a higher number here, say 10 for now in the below line in turnConnection.h and see if that succeeds past the allocation state?
Furthermore, I'd also like to investigate why it fails the first three times. That |
Beta Was this translation helpful? Give feedback.
-
Hi @stefankiesz, |
Beta Was this translation helpful? Give feedback.
-
H @stefankiesz, I will be able to return with these logs in a week. Is it ok if the the issue is kept open until I find the time to respond again with more detail, as I am not authorized to re-open a closed issue with a new comment, and I do not wish to lose this thread. |
Beta Was this translation helpful? Give feedback.
-
We will keep this issue open. |
Beta Was this translation helpful? Give feedback.
-
I found this issues too. |
Beta Was this translation helpful? Give feedback.
-
Thanks for keeping this issue open. Hi @stefankiesz, Btw, I have updated my branch to latest master 1.9.1 In the following tests, the only changes in the code are debug prints and forcing of RELAY_ONLY candidates.
Test case 1: #define DEFAULT_TURN_ALLOCATION_MAX_TRY_COUNT 3
b) At turnconnection.c file, in turnConnectionHandleStun function, hasAllocation is set to TRUE.
Nevertheless, turn state is declared as TURN_STATE_FAILED. Test case 2: The following change is applied: Following TURN state changes are observed in the logs: And the program exits. Both logs are attached. |
Beta Was this translation helpful? Give feedback.
-
Looking at the logs, it seems with the change, the relay candidates are created successfully, but connectivity checks are failing i.e, no candidate pairs are found within 10 seconds. An observation that is strange:
See how all the remote candidates have the same ID? This shouldnt be the case since we generate a random JSON string. Wondering if there is any code modification here because I see the same ID in both the logs files you attached too. A few questions:
|
Beta Was this translation helpful? Give feedback.
-
Apart from the common.c change:
and the newly added debug prints, there are no changes at all in the code. It is identical to 1.9.1. Answers:
|
Beta Was this translation helpful? Give feedback.
-
Hi @mehmetcy84, I tried
Do you have any updates on this issue? |
Beta Was this translation helpful? Give feedback.
-
Hi everyone I am also facing a similar issue,
I am able to view the stream on Webrtc test page
VIEWER LOGS and COMMAND
But the point is when i am running the viewer in Ubuntu I am successfully connected and it is able to fetch the frames. |
Beta Was this translation helpful? Give feedback.
-
I am using kvs Master 1.9.1
I test the kvsWebRTCClientViewer in Windows against Kinesis WebRTC Test Page: 1st test: client and browser running in Turkiye. Result FAIL. The region I have for my access/secret key pair credentials is us-east-2. |
Beta Was this translation helpful? Give feedback.
-
So after testing out i tried the release version release-1.10.0 with relay setting, it is not working, actually i was trying from two different laptops to connect and stream but received the same errors as mentioned above, using Policy_ALL was working fine only within the same laptop. |
Beta Was this translation helpful? Give feedback.
-
Hi @niyatim23 |
Beta Was this translation helpful? Give feedback.
-
Communication through TURN servers is working for me on commit b820e2e (January 20, 2023), but not on commit 4f1d3ad (May 8, 2024) or f107343 (March 20, 2024). In the latter two commits, from the logs, I saw |
Beta Was this translation helpful? Give feedback.
-
We are using this repo and want to ensure connection stability via usage of TURN candidates for worst case scenario. But TURN candidates never work. If ICE_TRANSPORT_RELAY is chosen in samples/Common.cpp instead of ICE_TRANSPORT_ALL, connection is never established.
We have been using Master 1.7.3. And in some of our networks, webtrc connections are achieved while in others it is not. In order to ensure maximum stability, we would like to make sure TURN candidates are used for the last line of defense. But even in our networks where STUN works, TURN candidates never work. We have observed this on Windows builds as well as cross compiled Android builds. Updated our repos to the latest master 1.9, but the problem persists.
In order to ensure we didn't introduce any artifacts, I have cloned the 1.9 master, only applied the following two changes to avoid build errors, other than that the following logs are captured on vanilla kvs sample (kvsWebRTCClientViewer.exe) built for Windows run against the KVS WebRTC Test Page.
Steps to reproduce:
-option(ENABLE_AWS_SDK_IN_TESTS "Enable support for compiling AWS SDKs for tests" ON)
+option(ENABLE_AWS_SDK_IN_TESTS "Enable support for compiling AWS SDKs for tests" OFF)
Expected Result: "Audio Frame received" prints displayed.
Actual Result: "Audio Frame received" prints displayed.
-configuration.iceTransportPolicy = ICE_TRANSPORT_POLICY_ALL;
+configuration.iceTransportPolicy = ICE_TRANSPORT_POLICY_RELAY;
Expected Result: "Audio Frame received" prints displayed.
Actual Result: Frames are not received, and the console is flooded with TURN error messages.
The following logs are captured for "VERBOSE" log setting.
Sensitive info censored. For clarity additional logs are manually added (ones which start with "mehmetcy") in turnConnectionTimerCallback function, where the errors are seen.
logs.txt
Beta Was this translation helpful? Give feedback.
All reactions