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

Crash when microphone is selected #104

Open
hellmind opened this issue Jun 22, 2021 · 6 comments
Open

Crash when microphone is selected #104

hellmind opened this issue Jun 22, 2021 · 6 comments

Comments

@hellmind
Copy link

linhpsdr latest build crash if I enable my microphone,
fish: Job 1, 'linhpsdr' terminated by signal SIGSEGV (Address boundary error)

Maybe;
[690253:690253:0622/171735.325212:ERROR:gl_utils.cc(314)] [.RendererMainThread-0x3638f1822500] GL_INVALID_FRAMEBUFFER_OPERATION: Draw framebuffer is incomplete

`jun 22 17:38:49 arch systemd-coredump[2668084]: [🡕] Process 2648955 (linhpsdr) of user 1000 dumped core.

                                            Stack trace of thread 2648991:
                                            #0  0x00007f7287448d25 pa_hashmap_get (libpulsecommon-14.2.so + 0x27d25)
                                            #1  0x00007f7288a8b73d n/a (libpulse.so.0 + 0x2e73d)
                                            #2  0x00007f7287462c31 pa_pdispatch_run (libpulsecommon-14.2.so + 0x41c31)
                                            #3  0x00007f7288a6fad1 n/a (libpulse.so.0 + 0x12ad1)
                                            #4  0x00007f72874660df n/a (libpulsecommon-14.2.so + 0x450df)
                                            #5  0x00007f7287467bbf n/a (libpulsecommon-14.2.so + 0x46bbf)
                                            #6  0x00007f7288a83c23 pa_mainloop_dispatch (libpulse.so.0 + 0x26c23)
                                            #7  0x00007f7288a84291 pa_mainloop_iterate (libpulse.so.0 + 0x27291)
                                            #8  0x00007f7288a84331 pa_mainloop_run (libpulse.so.0 + 0x27331)
                                            #9  0x00007f7288a947fe n/a (libpulse.so.0 + 0x377fe)
                                            #10 0x00007f72874775cc n/a (libpulsecommon-14.2.so + 0x565cc)
                                            #11 0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #12 0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648974:
                                            #0  0x00007f7289bed8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
                                            #1  0x00007f7289be9ae8 __new_sem_wait_slow64.constprop.0 (libpthread.so.0 + 0x11ae8)
                                            #2  0x00007f7289ac2ae0 wdspmain (libwdsp.so + 0x3cae0)
                                            #3  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #4  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648973:
                                            #0  0x00007f7288046b2f __poll (libc.so.6 + 0xf3b2f)
                                            #1  0x00007f7288a90654 n/a (libpulse.so.0 + 0x33654)
                                            #2  0x00007f7288a799a9 pa_mainloop_poll (libpulse.so.0 + 0x1c9a9)
                                            #3  0x00007f7288a84281 pa_mainloop_iterate (libpulse.so.0 + 0x27281)
                                            #4  0x00007f7288a84331 pa_mainloop_run (libpulse.so.0 + 0x27331)
                                            #5  0x00007f7288a947fe n/a (libpulse.so.0 + 0x377fe)
                                            #6  0x00007f72874775cc n/a (libpulsecommon-14.2.so + 0x565cc)
                                            #7  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #8  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648957:
                                            #0  0x00007f7288046b2f __poll (libc.so.6 + 0xf3b2f)
                                            #1  0x00007f7288c4ab29 n/a (libglib-2.0.so.0 + 0xa7b29)
                                            #2  0x00007f7288bf6693 g_main_loop_run (libglib-2.0.so.0 + 0x53693)
                                            #3  0x00007f7288e338c8 n/a (libgio-2.0.so.0 + 0x1018c8)
                                            #4  0x00007f7288c252c1 n/a (libglib-2.0.so.0 + 0x822c1)
                                            #5  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #6  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648955:
                                            #0  0x00007f72880b678e __memmove_avx_unaligned_erms (libc.so.6 + 0x16378e)
                                            #1  0x0000557dc733a636 update_waterfall (linhpsdr + 0x30636)
                                            #2  0x0000557dc73265c3 update_timer_cb (linhpsdr + 0x1c5c3)
                                            #3  0x00007f7288bf76b4 n/a (libglib-2.0.so.0 + 0x546b4)
                                            #4  0x00007f7288bf7015 g_main_context_dispatch (libglib-2.0.so.0 + 0x54015)
                                            #5  0x00007f7288c4ab99 n/a (libglib-2.0.so.0 + 0xa7b99)
                                            #6  0x00007f7288bf4871 g_main_context_iteration (libglib-2.0.so.0 + 0x51871)
                                            #7  0x00007f7288dfe8b6 g_application_run (libgio-2.0.so.0 + 0xcc8b6)
                                            #8  0x0000557dc731b3f6 main (linhpsdr + 0x113f6)
                                            #9  0x00007f7287f7ab25 __libc_start_main (libc.so.6 + 0x27b25)
                                            #10 0x0000557dc731b46e _start (linhpsdr + 0x1146e)

                                            Stack trace of thread 2648994:
                                            #0  0x00007f7289bed8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
                                            #1  0x00007f7289be7270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270)
                                            #2  0x00007f7288a91739 pa_threaded_mainloop_wait (libpulse.so.0 + 0x34739)
                                            #3  0x00007f7288ab4a51 pa_simple_read (libpulse-simple.so.0 + 0x2a51)
                                            #4  0x0000557dc731d182 mic_read_thread (linhpsdr + 0x13182)
                                            #5  0x00007f7288c252c1 n/a (libglib-2.0.so.0 + 0x822c1)
                                            #6  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #7  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648992:
                                            #0  0x00007f7289bed8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
                                            #1  0x00007f7289be9ae8 __new_sem_wait_slow64.constprop.0 (libpthread.so.0 + 0x11ae8)
                                            #2  0x00007f7289ac2ae0 wdspmain (libwdsp.so + 0x3cae0)
                                            #3  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #4  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648993:
                                            #0  0x00007f7288046b2f __poll (libc.so.6 + 0xf3b2f)
                                            #1  0x00007f7288a90654 n/a (libpulse.so.0 + 0x33654)
                                            #2  0x00007f7288a799a9 pa_mainloop_poll (libpulse.so.0 + 0x1c9a9)
                                            #3  0x00007f7288a84281 pa_mainloop_iterate (libpulse.so.0 + 0x27281)
                                            #4  0x00007f7288a84331 pa_mainloop_run (libpulse.so.0 + 0x27331)
                                            #5  0x00007f7288a947fe n/a (libpulse.so.0 + 0x377fe)
                                            #6  0x00007f72874775cc n/a (libpulsecommon-14.2.so + 0x565cc)
                                            #7  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #8  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648996:
                                            #0  0x00007f7288019a95 clock_nanosleep@@GLIBC_2.17 (libc.so.6 + 0xc6a95)
                                            #1  0x00007f728801ec77 __nanosleep (libc.so.6 + 0xcbc77)
                                            #2  0x00007f7288049a99 usleep (libc.so.6 + 0xf6a99)
                                            #3  0x0000557dc733f47a protocol2_timer_thread (linhpsdr + 0x3547a)
                                            #4  0x00007f7288c252c1 n/a (libglib-2.0.so.0 + 0x822c1)
                                            #5  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #6  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648995:
                                            #0  0x00007f7289beaaf2 recvfrom (libpthread.so.0 + 0x12af2)
                                            #1  0x0000557dc733efde protocol2_thread (linhpsdr + 0x34fde)
                                            #2  0x00007f7288c252c1 n/a (libglib-2.0.so.0 + 0x822c1)
                                            #3  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #4  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2649014:
                                            #0  0x00007f7288019a95 clock_nanosleep@@GLIBC_2.17 (libc.so.6 + 0xc6a95)
                                            #1  0x00007f728801ec77 __nanosleep (libc.so.6 + 0xcbc77)
                                            #2  0x00007f7288049a99 usleep (libc.so.6 + 0xf6a99)
                                            #3  0x00007f7289a9c99e sendbuf (libwdsp.so + 0x1699e)
                                            #4  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #5  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2648956:
                                            #0  0x00007f7288046b2f __poll (libc.so.6 + 0xf3b2f)
                                            #1  0x00007f7288c4ab29 n/a (libglib-2.0.so.0 + 0xa7b29)
                                            #2  0x00007f7288bf4871 g_main_context_iteration (libglib-2.0.so.0 + 0x51871)
                                            #3  0x00007f7288bf48c2 n/a (libglib-2.0.so.0 + 0x518c2)
                                            #4  0x00007f7288c252c1 n/a (libglib-2.0.so.0 + 0x822c1)
                                            #5  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #6  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)

                                            Stack trace of thread 2667961:
                                            #0  0x00007f7288019a95 clock_nanosleep@@GLIBC_2.17 (libc.so.6 + 0xc6a95)
                                            #1  0x00007f728801ec77 __nanosleep (libc.so.6 + 0xcbc77)
                                            #2  0x00007f7288049a99 usleep (libc.so.6 + 0xf6a99)
                                            #3  0x00007f7289a9c99e sendbuf (libwdsp.so + 0x1699e)
                                            #4  0x00007f7289be1259 start_thread (libpthread.so.0 + 0x9259)
                                            #5  0x00007f72880515e3 __clone (libc.so.6 + 0xfe5e3)`
@hellmind
Copy link
Author

This happen if no pulseaudio card profile is selected.

@hellmind
Copy link
Author

Also im having crash if I use pulseaudio, , it seems mic cant be used with pulse.
I can select it but afte some tx It crash

SOUNDIO works "fine", but on rx i notice some weird noises

@daneenjah
Copy link

I'm having the same issue as well, ended up selling my ANON 7000 because of it.

@hellmind
Copy link
Author

hellmind commented Jul 22, 2021 via email

@andreasdotorg
Copy link
Contributor

I have found the reason for this crash. When the mic is enabled, both data coming from the ANAN built-in mic port and from pulseaudio are processed. This of course is not only wrong, it also leads to a race condition, since processing protocol 2 data and processing audio data happens in the same thread. Thus, when process_mic_data is being run simultaneously in both threads, it can happen that one thread fills the buffer up, and before it can reset the buffer, the other thread adds to it overwriting the data.

I'll propose a fix.

@andreasdotorg
Copy link
Contributor

BTW, to find the problem, I used clang as a compiler, and -fsanitize=address as build option. This pointed me to process_mic_data as the function overflowing its buffer. The rest was deduction.

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

3 participants