BelledonneCommunications / linphone-desktop

Linphone is a free VoIP and video softphone based on the SIP protocol. Mirror of git://git.linphone.org/linphone-desktop.git
https://linphone.org/
GNU General Public License v3.0
412 stars 209 forks source link

[Bug]: v5.1.2 Fedora 38 segmentation fault after 7 seconds (OBS build service) #794

Open leukimi opened 1 year ago

leukimi commented 1 year ago

Context

OBS build service has moved to linphone-desktop v5.1.2. Adding code to compile with postquantum crypto engine and liboqs in the test repository below builds fine. Below is the link to the overview of all packages.

Monitor home:kimi:telephony-to-merge

At runtime both openSUSE Tumbleweed and Fedora 38 experience a segmentation fault after seven seconds.

gdb shows this information:

Thread 1 "linphone" received signal SIGSEGV, Segmentation fault.
0x00007ffff3c5e4d9 in lime::bctbx_ECDH<lime::C255>::get_selfPublic() () from /lib64/liblime.so.0

Something you may have seen before?

Archlinux and Debian 12 builds the same code without this segmentation fault.

General information

Expected behaviour

Adding multi-OS support to the openSUSE build service.

To Reproduce

  1. linphone -V
  2. Wait seven seconds.
julonexus commented 1 year ago

Not really. A full log may be needed

leukimi commented 1 year ago

Here you go.

Link to log file: log.txt

The repository has debug files for each package.

If you prefer, I may add you to the list of admins for the repository.

leukimi commented 1 year ago

As a side note, the old segmentation fault when clicking on Preferences, Video Preview, is still there as well.

This is the log from Archlinux when that happens.

log.txt

Debugging with gdb gives the following:

(gdb) run
...
...
...
Thread 14 "QSGRenderThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa77fe6c0 (LWP 9208)]
0x00007ffff4d44e67 in ms_filter_add_notify_callback ()
   from /usr/bin/../lib64/libmediastreamer.so.11
(gdb) bt
#0  0x00007ffff4d44e67 in ms_filter_add_notify_callback ()
    at /usr/bin/../lib64/libmediastreamer.so.11
#1  0x00007ffff4d9a253 in video_preview_start ()
    at /usr/bin/../lib64/libmediastreamer.so.11
#2  0x00007ffff54f2fc8 in toggle_video_preview(_LinphoneCore*, unsigned char) [clone .part.0] () at /usr/bin/../lib64/liblinphone.so.10
#3  0x00007ffff54fea63 in linphone_core_create_native_preview_window_id ()
    at /usr/bin/../lib64/liblinphone.so.10
#4  0x0000555555737180 in Camera::createRenderer() const (this=0x5555586fb1d0)
    at /usr/src/packages/BUILD/linphone-desktop/src/linphone-desktop-5.1.2/linphone-app/src/components/camera/Camera.cpp:185
#5  0x00007ffff7d5ed12 in QQuickFramebufferObject::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) () at /usr/bin/../lib64/libQt5Quick.so.5
#6  0x00007ffff7c5e0c8 in QQuickWindowPrivate::updateDirtyNode(QQuickItem*) ()
    at /usr/bin/../lib64/libQt5Quick.so.5
#7  0x00007ffff7c5e8b5 in QQuickWindowPrivate::updateDirtyNodes() ()
    at /usr/bin/../lib64/libQt5Quick.so.5
#8  0x00007ffff7c4efe9 in QQuickWindowPrivate::syncSceneGraph() ()
    at /usr/bin/../lib64/libQt5Quick.so.5
#9  0x00007ffff7bf8908 in  () at /usr/bin/../lib64/libQt5Quick.so.5
#10 0x00007ffff7bfcfd4 in  () at /usr/bin/../lib64/libQt5Quick.so.5
#11 0x00007ffff58f371a in  () at /usr/bin/../lib64/libQt5Core.so.5
#12 0x00007ffff47bd9eb in  () at /usr/bin/../lib64/libc.so.6
leukimi commented 12 months ago

@julonexus What do you think could be the root cause of the video preview crash? I checked Debian Sid v5.0.2 from their own repository packaged by Debian Voip team, and exactly the same video crash happens there too. This video preview crash also affects the video call functionality, so only voice works in practice version 5.0.2 until 5.1.2.

Now that openSUSE OBS build service builds all the major OS, would you at belledonne be interested to fork the build files that work and create your own official repository at OBS build service where you can build the software with OBS for all the operating systems?

julonexus commented 11 months ago

Thanks for the logs. About preview, I have to warn you that you should not delete your old posts that was under investigations even if completed... restarting an investigation while we had some clues before is not really great. The crash could come from the device /dev/video0 or from the display filter (MSQOGL) that couldn't be instantiated. I just note that fatal logs are put at the wrong place (after crash ...)

I'll ask about the build service but I don't guarantee anything as the Appimage do enough the job for our team without having too much maintenance. Note that I'm currently the only one working on the Desktop application since 3 years and if you look to the activity on Github, you have a preview on how much work can be done on free times ;) Someone else should work on it next year but then, I'll be moving to the SDK team. At the moment, I'm afraid that the only way is to unlock resources times by requesting it on sales at https://www.linphone.org/contact

Regards

leukimi commented 11 months ago

@julonexus

Apologies for removing older posts that I thought would never be addressed in the future due to lack of time.

For comparison purpose I compiled linphone-desktop as a bundle like if it was cloned by git so that I could see how it is supposed to work, using the same OBS Build Service for as many OS as possible. On the test machine there is no camera, so one expects the image "no WebCam" to show up instead, which it does on the bundled version. Bundled version does not crash. All I had to do was to remove libxml.so and libxml.so.2 from the installation since it can cause crashes in other software on the system. Using system libxml works for all software.

On the compiled versions you find on Ubuntu universe-update, Debian Sid and regular OBS Build service Factory (each library is compiled separately) MSQOGL does not seem to initiate properly as you suggest.

For the linux community linphone-desktop found in the various repositories on the main distributions, it would of course be handy to have the video working. All of them experience same MSQOGL crash at video preview since version 5.0.2.

As a gift for you ... sorry for deleting old posts ... I also adapted an older patch to introduce separate gray icon for the system tray which works with v5.1.2 (you can lift it in immediately without issue if you want). It was requested in this post.

So you now have both the openSUSE "break up the packages" approach that Debian also uses with the MSQOGL crash as well as a bundled compilation such as you would find in AUR repository for Archlinux.

leukimi commented 11 months ago

I might have solved the MSQOGL crash. I might need your help to fix this in the source code so that things end up in the right place automatically. If files are installed correctly, the other distributions which package linphone will have non-crash-linphone as well since this thing affects all versions since 5.0.2 up to 5.1.2. I might be editing the post if I find more issues in other distributions connected to this.

You can test the software from software.opensuse.org to see if it works as expected on your machines as well.

mediastreamer2

The root cause seems to start with ENABLE_QT_GL=${ENABLE_VIDEO}, which is set differently in different parts of the project. It should probably be consistent everywhere. Cmake 3.28 seems to set this flag when it encounters it first time, which happens in linphone-desktop. Subsequent re-definitions in submodules, compiled separately, do not alter the state YES/NO of the option it seems. If ENABLE_QT_GL option or ENABLE_VIDEO option is set differently, and interacting in such a way that one option automatically sets the other option in some parts in the code, but not everywhere, you end up with totally different behavior during compilation. This is what happens when each package is compiled separately with different flags than the top CMakeLists.txt.

When compiling mediastreamer2 stand alone, the ENABLE_QT_GL option is [OFF] in CMakeFiles.txt. This option is set to the value of ENABLE_VIDEO [YES] option on the top level when you compile from git. Maybe it would be easier to use ENABLE_VIDEO [YES] flag and let that flag set all other flags needed further down in the libraries.

The install script does not install the file in this location expected by linphoneexecutable:

/usr/share/images/nowebcamCIF.jpg

libmsqogl.so plugin (looks like a library) ends up in:

/usr/lib64/mediastreamer/plugins/libmsqogl.so

or

/usr/lib/mediastreamer/plugins/libmsqogl.so

or

/usr/lib/x86_64-linux-gnu/mediastreamer/plugins/libmsqogl.so

linphoneexecutable can only find libmsqogl.so if it is located in exactly relative path:

../plugins/mediastreamer/libmsqogl.so

but it is being installed in another place and even though this installed place is explicitly pointed out in:

/etc/ld.so.conf.d/linphone.conf

the plugin is not found.

If libmsqogl.so is placed in other locations, libmsqogl.so is not found, such as these locations:

/usr/lib64/libmsqogl.so (preferred place?) /usr/lib64/mediastreamer/plugins/libmsqogl.so (install script place)

My question is where libmsqogl.so is supposed to be installed on a linux system and if it would be possible to find it in the place where it should exist.

/usr/plugins/mediastreamer/libmsqogl.so is maybe not the correct place?

I have created two sub-packages:

Other things encountered which are a bit unclear:

bzrtp

Should bzrtp automatically be set to use postquantumcryptoengine ? OBS Build Service will probably put in both decaf(bctoolbox I guess is using it, maybe other places in the code use it as well) and postquantumcryptoengine soon.

libxml2

Maybe use system libxml2 library? Seems all systems have it. Using the bundled libxml.so.2 messes up the linux system so it has to be deleted and then it complains about libxml2 being so-version 20 instead of 2.

liboqs

Version 9 ?

decaf

Version 1.0.2 (python3) ?

leukimi commented 11 months ago

Packager(s) suggest the following modifications.

mediastreamer2

(See patches applied during build.)

Move libmsqogl.so (looks like a library) to where Cmake usually puts libraries on each OS/architecture and update all code that today looks for ../plugins/mediastreamer/libmsqogl.so . Patches are suggested in mediastreamer2, linphone, linphoneqt. For instance:

Create package mediastreamer2-plugins where such library plugins are put and create dependency in linphone-desktop.

Move installation of nowebcamCIF.jpg from mediastreamer2 to package liblinphone-data where ringtones and other media necessities already are located.

Change install path from /usr/share/images/nowebcamCIF.jpg to /usr/share/linphone/images/nowebcamCIF.jpg

Make a nicer nowebcamCIF.jpg that displays correctly without cropping no matter if libyuv displays landscape or portrait mode. Suggestion of a general avatar like nowebcamCIF.jpg is packaged in liblinphone-data.

(lib)linphone

(See patches applied during build.)

Move installation of nowebcamCIF.jpg from mediastreamer2 to package liblinphone-data where ringtones and other media necessities already are located.

Change install path from /usr/share/images/nowebcamCIF.jpg to /usr/share/linphone/images/nowebcamCIF.jpg

Make a nicer nowebcamCIF.jpg that displays correctly without cropping no matter if libyuv displays landscape or portrait mode. Suggestion of a general avatar like nowebcamCIF.jpg is packaged in liblinphone-data.

Patch code to look for %{_libdir}/libmsqogl.so and /usr/share/linphone/images/nowebcamCIF.jpg

linphone-desktop

(See patches applied during build.)

Patch code to look for %{_libdir}/libmsqogl.so and /usr/share/linphone/images/nowebcamCIF.jpg

linphone-desktop suggestions

linphone icon looks very differently on different OS. In Fedora 38/39 the icon is not visible and replaced by "linphone.linphone" blue square default library icon. On other OS it flickers between the embedded icon and the icon theme icon. It would be of advantage to let system theme icon be the icon that is displayed in system menus, dash bar, plank.

Manpage for linphone would be nice that contain relevant info, such as how to operate calls from command line.

Observations during install

Upon install on Debian/Ubuntu, URI/S-MIME is not re-configured so for instance xdg-open "sips:sipuser@sip.linphone.org" does not work properly until logout/login/reboot. On other OS it works immediately after install without logout/login/reboot.

leukimi commented 11 months ago

Packagers suggest enforced mandatory media encryption and default method Post Quantum ZRTP. Users are often unaware of the settings and do not know if their call is unencrypted or encrypted.

The linphone documentation says that it should be enough when one of the soft-phones has mandatory encryption Post Quantum ZRTP set to force all other soft-phones to use only encryption and Post Quantum ZRTP. Linphone documentation also mentions that the possible fall-back implementations to standard ZRTP/SRTP/DTLS/unencrypted is controlled by Asterisk server config plus the fall-back implementations of each soft-phone. The SDP offering suggest it is the receiving soft-phone which decides upon encryption method and codecs used.

Has linphone documented how the fall-back encryption and codec selection during SDP offering works in reality with different settings on each participating soft-phone?

Same questions for fall-back chat encryption, lime settings, attachments in chat encryption. Often encrypted chats with green shield does not get delivered. Post Quantum ZRTP does not yet seem to be available for chat encryption (maybe implementing it in the future?).

Disabled codecs

GSM, G722 and BV16 seems to be not enabled in liblinphone (= no orange "on" in linphone GUI ) although these codecs are enabled in CMakeLists.txt and present. Suggestion is to enable these codecs by default if the software has them compiled.

Real-time codec re-selection under different signal-to-noise ratios and varying wifi/bluetooth conditions

Has linphone documented how the audio-codecs and video-codecs are selected based on the signal to noise ratio, wifi intereference, bluetooth headset, USB headset, cable headset, bluetooth mic, usb mic, cable mic, built in speakers/mic, internet speed, internet connection quality, packet delay? Clearly some codecs perform better than others in certain environments, and linphone probably has some internal logic that continuously evaluates the need to switch codec during the (video)call.

How is codec selection done in a linphone SDP offer?