Coder Social home page Coder Social logo

Unreliability of ZRTP about uvgrtp HOT 5 CLOSED

ultravideo avatar ultravideo commented on June 6, 2024
Unreliability of ZRTP

from uvgrtp.

Comments (5)

altonen avatar altonen commented on June 6, 2024

Hard to say what the issue is, especially since it happens only sometimes. Maybe Hello/HelloACK is not received at all but I don't know why that would happen either.

from uvgrtp.

jrsnen avatar jrsnen commented on June 6, 2024

I have also replicated this issue on Windows while improving the ZRTP multistream example.

[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 105
[RTPLIB][ERROR][::log_platform_error] ZRTP message length is not divisible by 32-bit word. Type: Hello   : The operation completed successfully.
 0

[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 22
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 28
[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 3
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 105
[RTPLIB][ERROR][::log_platform_error] ZRTP message length is not divisible by 32-bit word. Type: Hello   : The operation completed successfully.
 0

[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 22
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 28
[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 3
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][ERROR][::init_dhm] Session initialization failed, ZRTP cannot be used!
[RTPLIB][WARNING][::init] Failed to initialize ZRTP for media stream!
[RTPLIB][ERROR][::create_stream] Failed to initialize media stream 127.0.0.1:7778/8890
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][ERROR][::init_dhm] Session initialization failed, ZRTP cannot be used!
[RTPLIB][WARNING][::init] Failed to initialize ZRTP for media stream!
[RTPLIB][ERROR][::create_stream] Failed to initialize media stream 127.0.0.1:8888/7776
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 105
[RTPLIB][ERROR][::log_platform_error] ZRTP message length is not divisible by 32-bit word. Type: Hello   : The operation completed successfully.
 0

[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 22
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 28
[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 3
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 105
[RTPLIB][ERROR][::log_platform_error] ZRTP message length is not divisible by 32-bit word. Type: Hello   : The operation completed successfully.
 0

[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 22
[RTPLIB][DEBUG][::alloc_zrtp_frame] Allocate ZRTP frame, packet size 28
[RTPLIB][DEBUG][::set_zrtp_start_base] Constructed ZRTP header. Length: 3
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::recv_msg] Receiving a ZRTP message
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][ERROR][::init_dhm] Session initialization failed, ZRTP cannot be used!
[RTPLIB][WARNING][::init] Failed to initialize ZRTP for media stream!
[RTPLIB][ERROR][::create_stream] Failed to initialize media stream 127.0.0.1:7776/8888
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][DEBUG][::~zrtp_message] Freeing zrtp message...
[RTPLIB][ERROR][::init_dhm] Session initialization failed, ZRTP cannot be used!
[RTPLIB][WARNING][::init] Failed to initialize ZRTP for media stream!
[RTPLIB][ERROR][::create_stream] Failed to initialize media stream 127.0.0.1:8890/7778
[RTPLIB][DEBUG][::~receiver] destroy receiver
[RTPLIB][DEBUG][::~receiver] destroy receiver

from uvgrtp.

jrsnen avatar jrsnen commented on June 6, 2024

I also think I encountered this problem when doing my example improvements and testing the new examples.

from uvgrtp.

jrsnen avatar jrsnen commented on June 6, 2024

I managed to figure out the reason for this bug. uvgRTP currently has race-condition when it comes to multithreaded creation of multiple media_streams with ZRTP. Which media_stream performs the Diffie-Hellman is not deterministic and this can lead to mismatches between ends as they may select different media_streams for the task, which then is never completed. Concretely, the issue is which thread can first lock this mutex.

This bug does not show up when:

  • Only one media_stream is needed
  • All needed media_streams are created in the same thread

Tasks:

  • Fix ZRTP_Multistream example
  • Document the safe usage of zrtp
  • Maybe add an enum value to API that makes it possible to select the media_stream that performs DH. This enum should have the default value, which would correspond to current behavior.

from uvgrtp.

jrsnen avatar jrsnen commented on June 6, 2024

Fixed by 8b05132

I made it so that the Diffie-Hellman exchange is performed always unless the user specifies which stream does not perform DH.

ZRTP did fail once for me even after this fix, but I have been unable to replicate it. If the problem appears again, a new issue can be created. All in all, now multistream usage of ZRTP should be much more reliable.

from uvgrtp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.