Closed mghadam closed 6 months ago
You should run with verbose logging to get log information from libnice.
TypeError: Cannot read property 'close' of null
This error occurs because the data channel is not opened.
I will add an if condition anyway.
Thank you, I now see two related errors Not issuing local candidate because of transport policy
and bind discovery timed out, aborting discovery item
.
The first error also exists when using working TCP transport instead of TLS. The latter bind discovery timed out
error only happens when using TLS and is apparently causing this problem. Any ideas where this error comes from?
Here are the related lines in verbose logging:
2023-07-16 17:46:30.180 VERB [378153] [rtc::impl::PeerConnection::validateRemoteDescription@805] Remote description looks valid
2023-07-16 17:46:30.180 INFO [378153] [rtc::impl::PeerConnection::changeSignalingState@1175] Changed signaling state to stable
2023-07-16 17:46:30.729 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : discovery tick #51 with list 0x55b9ec2050 (1)
2023-07-16 17:46:31.357 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : discovery tick #101 with list 0x55b9ec2050 (1)
2023-07-16 17:46:31.984 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : discovery tick #151 with list 0x55b9ec2050 (1)
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000 : Candidate gathering FINISHED, stopping discovery timer.
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000: gathered UDP local candidate : [10.0.1.6]:42435 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000: gathered UDP local candidate : [10.10.1.6]:13297 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.035 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000: gathered UDP local candidate : [192.168.8.2]:38672 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.036 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18000: gathered UDP local candidate : [192.168.1.15]:46541 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.036 INFO [378166] [rtc::impl::PeerConnection::changeGatheringState@1162] Changed gathering state to complete
2023-07-16 17:46:32.185 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0 : bind discovery timed out, aborting discovery item.
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0 : Candidate gathering FINISHED, stopping discovery timer.
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0: gathered UDP local candidate : [10.0.1.6]:39864 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0: gathered UDP local candidate : [10.10.1.6]:8344 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0: gathered UDP local candidate : [192.168.8.2]:54374 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.186 VERB [378166] [rtc::impl::IceTransport::LogCallback@847] nice: Agent 0x55b9f18bd0: gathered UDP local candidate : [192.168.1.15]:59482 for s1/c1. U/P '(null)'/'(null)'
2023-07-16 17:46:32.186 INFO [378166] [rtc::impl::PeerConnection::changeGatheringState@1162] Changed gathering state to complete
2023-07-16 17:46:40.031 VERB [378153] [rtc::impl::DataChannel::close@87] Closing DataChannel
2023-07-16 17:46:40.031 VERB [378153] [rtc::impl::DataChannel::close@87] Closing DataChannel
2023-07-16 17:46:40.032 VERB [378153] [rtc::impl::DataChannel::~DataChannel@81] Destroying DataChannel
2023-07-16 17:46:40.032 VERB [378153] [rtc::impl::DataChannel::close@87] Closing DataChannel
It looks like the error bind discovery timed out
means the request to the TURN server timed out in libnice. The phrasing is quite weird though, as the library should send an allocate request immediately, not a bind request.
If it works for TURN over TCP, then I think it might mean that the timeout is actually too short (the corresponding property is stun_reliable_timeout
, and the default seems to be 2s which looks long enough), or it might indicate a compatibility bug between libnice and the eturnal server. Could you try a different TURN server to be sure?
it indeed works with coturn for direct connections:
2023-07-19 18:12:56.712 INFO [254337] [rtc::impl::PeerConnection::changeState@1144] Changed state to connecting
2023-07-19 18:12:56.736 INFO [254350] [rtc::impl::PeerConnection::changeGatheringState@1162] Changed gathering state to complete
2023-07-19 18:12:57.293 DEBUG [254350] [rtc::impl::DtlsTransport::DtlsTransport@45] Initializing DTLS transport (GnuTLS)
2023-07-19 18:12:57.293 DEBUG [254350] [rtc::impl::DtlsTransport::start@104] Starting DTLS recv thread
2023-07-19 18:12:57.293 DEBUG [254350] [rtc::impl::DtlsTransport::DtlsTransport@45] Initializing DTLS transport (GnuTLS)
2023-07-19 18:12:57.293 DEBUG [254350] [rtc::impl::DtlsTransport::start@104] Starting DTLS recv thread
2023-07-19 18:12:57.546 INFO [254353] [rtc::impl::DtlsTransport::runRecvLoop@202] DTLS handshake finished
2023-07-19 18:12:57.546 DEBUG [254353] [rtc::impl::SctpTransport::SctpTransport@174] Initializing SCTP transport
2023-07-19 18:12:57.546 DEBUG [254353] [rtc::impl::SctpTransport::connect@355] SCTP connecting (local port=5000, remote port=5000)
2023-07-19 18:12:57.596 INFO [254352] [rtc::impl::DtlsTransport::runRecvLoop@202] DTLS handshake finished
2023-07-19 18:12:57.596 DEBUG [254352] [rtc::impl::SctpTransport::SctpTransport@174] Initializing SCTP transport
2023-07-19 18:12:57.597 DEBUG [254352] [rtc::impl::SctpTransport::connect@355] SCTP connecting (local port=5000, remote port=5000)
2023-07-19 18:12:57.597 DEBUG [254344] [rtc::impl::SctpTransport::processNotification@839] SCTP negotiated streams: incoming=1024, outgoing=1024
2023-07-19 18:12:57.597 DEBUG [254345] [rtc::impl::SctpTransport::processNotification@839] SCTP negotiated streams: incoming=1024, outgoing=1024
2023-07-19 18:12:57.597 INFO [254345] [rtc::impl::SctpTransport::processNotification@844] SCTP connected
2023-07-19 18:12:57.597 INFO [254345] [rtc::impl::PeerConnection::changeState@1144] Changed state to connected
However, if I use a nginx reverse proxy in front of coturn as explained here, it won't work. Trickle ICE shows a valid working TURNS coturn server in my nginx+coturn setup.
Another note here, coturn accepts UDP/TCP/TLS via its tls-listening-port
as explained in the config file. This is not the case with eturnal, it has a separate port for tls and does not accept any transport other than TLS over it.
However, if I use a nginx reverse proxy in front of coturn as explained here, it won't work. Trickle ICE shows a valid working TURNS coturn server in my nginx+coturn setup.
This sounds like a libnice bug then. What version of libnice do you use?
However, if I use a nginx reverse proxy in front of coturn as explained here, it won't work. Trickle ICE shows a valid working TURNS coturn server in my nginx+coturn setup.
This sounds like a libnice bug then. What version of libnice do you use?
It is v0.1.21 in debian bookworm repo.
I am closıng the issue if you don't mind.
Please feel free to open if you need to.
I am testing node-datachannel with libnice to use TURN over TLS
turns:username:password@turnserver.domain:TLSPort
The hello world script does not run, here is its logs:
The issue is the same when compiling node-datachannel with Openssl.
In the eturnal server log, I see that its SSL connection gets reset:
I am using the same turn server over tls using RTCPeerConnection in web browsers without any issues. This problem only exists on Turn+TLS. Turn+TCP works fine.
Any ideas how to debug this issue?