godotengine / webrtc-native

The official GDNative WebRTC implementation for non-html exports.
MIT License
198 stars 27 forks source link

When runing function create_offer() of WebRTCPeerConnection from the editor 1-10000 times, there is approximately 1 and more constant error _create_offer: Failed to gather local ICE candidates #88

Closed XDRiVE888 closed 6 months ago

XDRiVE888 commented 1 year ago

Godot version

v3.5.3.stable.official [6c814135b]

Plugin version

all v1.0.0 - v1.0.5 (with libdatachannel)

System information

Windows 10, 64bit

Issue description

When runing function create_offer() of WebRTCPeerConnection from the editor 1-10000 times, there is approximately 1 and more variable randomness constant error _create_offer: Failed to gather local ICE candidates And as soon as an error occurs, all subsequent repetitions of the code also cause an error. I also want to note that this error appears only in versions v1.0.0 - v1.0.5 with libdatachannel and is not present in version 0.5 - WebRTC 4472.

Steps to reproduce

To catch this error, you need run the application from the Godot editor with this code:

func _ready():
    var errMax:int = 10
    for _i in 10000:
        var wc1:WebRTCPeerConnection = WebRTCPeerConnection.new()
        var err1
        err1 = wc1.initialize()
        if err1 == OK:
            var channel:WebRTCDataChannel = wc1.create_data_channel("play",{"id": 1, "negotiated": true})
            if channel != null:
                err1 = wc1.create_offer()
                if err1 != OK:
                    print_debug("Periodic Error!!!:_i:",_i)
                    errMax -= 1
                    if errMax <= 0:
                        break
        wc1 = null

Minimal reproduction project

No response

Faless commented 6 months ago

I'm unable to reproduce using the latest plugin version 1.0.4, and Godot 3.5.3/4.2.1 .

Can you confirm if this is still an issue?

XDRiVE888 commented 6 months ago

I'm unable to reproduce using the latest plugin version 1.0.4, and Godot 3.5.3/4.2.1 .

Can you confirm if this is still an issue?

I checked with version 1.0.4 on Godot 3.5.3 and indeed I did not find this bug. It looks like this issue can be closed.

XDRiVE888 commented 6 months ago

I unfortunately discovered that this error still pops up with variable randomness (from about 1 to 10,000 or more attempts) and to explicitly detect it I used this code:


func _ready():
    var errMax:int = 10
    for _i in 10000:
        var wc1:WebRTCPeerConnection = WebRTCPeerConnection.new()
        var err1
        err1 = wc1.initialize()
        if err1 == OK:
            var channel:WebRTCDataChannel = wc1.create_data_channel("play",{"id": 1, "negotiated": true})
            if channel != null:
                err1 = wc1.create_offer()
                if err1 != OK:
                    print_debug("Periodic Error!!!:_i:",_i)
                    errMax -= 1
                    if errMax <= 0:
                        break
        wc1 = null