Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random SIGSEGV at startup_thread()->SSL_do_handshake(); #16

Open
Sfinx opened this issue May 29, 2016 · 2 comments
Open

Random SIGSEGV at startup_thread()->SSL_do_handshake(); #16

Sfinx opened this issue May 29, 2016 · 2 comments

Comments

@Sfinx
Copy link

Sfinx commented May 29, 2016

Program terminated with signal SIGABRT, Aborted.
#0  0x00007f248d16e267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
55  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f247ffff700 (LWP 21446))]
(gdb) backtrace 
#0  0x00007f248d16e267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007f248d16feca in __GI_abort () at abort.c:89
#2  0x00007f248e19445f in OpenSSLDie () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#3  0x00007f248e5afac3 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#4  0x00007f248e591db9 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#5  0x00007f248e5abb4f in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#6  0x0000000000404b7d in startup_thread (user_data=0x1902630) at rtcdc.c:377
#7  0x00007f248e84f965 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007f248dcfa6aa in start_thread (arg=0x7f247ffff700) at pthread_create.c:333
#9  0x00007f248d23fe9d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

How to debug it further ? It is constanty reproducable - 1 SIGSEGV from 10 good connections. Any ideas ?

@Sfinx
Copy link
Author

Sfinx commented May 30, 2016

Looks like race. Solved by calling rtcdc_generate_local_candidate_sdp() and waiting for all candidates gathered. Only after this the rtcdc_generate_offer_sdp() can be called.

@Sfinx Sfinx closed this as completed May 30, 2016
@Sfinx
Copy link
Author

Sfinx commented May 30, 2016

Seems like SSL_do_handshake() is called in ice and startup threads simultaniously without the proper locking

--- a/src/rtcdc.c
+++ b/src/rtcdc.c
@@ -374,7 +372,9 @@ startup_thread(gpointer user_data)
     SSL_set_connect_state(dtls->ssl);
   else
     SSL_set_accept_state(dtls->ssl);
+  g_mutex_lock(&dtls->dtls_mutex);  
   SSL_do_handshake(dtls->ssl);
+  g_mutex_unlock(&dtls->dtls_mutex);

   while (!peer->exit_thread && !dtls->handshake_done)
     g_usleep(100);

@Sfinx Sfinx reopened this May 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant