webapps crashing - oxide being compiled with wrong libs?

Bug #1658617 reported by Alberto Mardegan
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu App Platform
New
Undecided
Unassigned
libhybris
New
Undecided
Unassigned

Bug Description

I published "google-webapp" in the "beta" channel. The "google-webapp.gmail" and "google-webapp.googleplus" commands crash right after logging into Google (logs attached).

Santosh believes that it's because oxide is buing built with the wrong build flags:

    09:53 < santoshmahto> mardy : all works, I saw the oxide crash in G+, surprisingly crash is happenig because it try to load hybris libs for camera access
    09:54 < santoshmahto> mardy, So I doubt, you have wrong version of oxide
    09:56 < santoshmahto> mardy : The codepath in oxide is under flag ENABLE_HYBRIS_CAMREA/ENABLE_HYBRIS , which should be disabled in Desktop build

Revision history for this message
Alberto Mardegan (mardy) wrote :
Revision history for this message
Santosh (santoshbit2007) wrote :

The callstack with few symbols is as :

ead
[0123/131602:FATAL:oxide_browser_process_main.cc(474)] Check failed: state_ == STATE_NOT_STARTED || state_ == STATE_SHUTDOWN. BrowserProcessMain::Shutdown() should be called before process exit
#0 0x7fcd60d899be <unknown>
#1 0x7fcd60da363e <unknown>
#2 0x7fcd622ad979 <unknown>
#3 0x7fcd82500ff8 <unknown>
#4 0x7fcd82501045 exit
#5 0x7fcd5d1055fc <unknown>
#6 0x7fcd5d10588f android_dlopen
#7 0x7fcd5de497a5 hybris_camera_initialize
#8 0x7fcd622ee1ff <unknown>
#9 0x7fcd622a292c <unknown>
#10 0x7fcd60d8b421 <unknown>
#11 0x7fcd60dac0a9 <unknown>
#12 0x7fcd60dad54d <unknown>
#13 0x7fcd60dada08 <unknown>
#14 0x7fcd60dae649 <unknown>
#15 0x7fcd60dc79fa <unknown>
#16 0x7fcd60de2906 <unknown>
#17 0x7fcd60ddebf2 <unknown>
#18 0x7fcd822b16ba start_thread
#19 0x7fcd825cd82d clone

It is clear that hybris function hybris_camera_initialize is called in desktop version.
hybris libs are only available in android based mobile platform.

Oxide builds with flags ENABLE_HYBRIS/ENABLE_HYBRIS_CAMERA only in case of mobile ,
FOr desktop ENABLE_HYBRIS/ENABLE_HYBRIS_CAMERA should should be used while building oxide.
https://wiki.ubuntu.com/Oxide/BuildInstructions

In nutshell, I suspect those two options are enabled while building oxide for desktop which is wrong.

Revision history for this message
Santosh (santoshbit2007) wrote :

Correction :

For desktop ENABLE_HYBRIS/ENABLE_HYBRIS_CAMERA should not be used while building oxide.

Revision history for this message
Alberto Mardegan (mardy) wrote :

Adding oxide: the ubuntu-app-platform snap is simply using the packages from the stable-phone-overlay PPA, so I doubt that the bug is there.

Looking at oxide source code, I see in oxide/build/cmake/Options.cmake the following lines:

    set(_IS_LINUX false)
    if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
      set(_IS_LINUX true)
    endif()
    cmake_dependent_option(ENABLE_HYBRIS "Enable code that uses libhybris"
                           ON "_IS_LINUX" OFF)
    unset(_IS_LINUX)

Please correct me if I'm wrong, but it seems to me that libhybris is being enabled on Linux by default.

Furthermore, the debian/rules file contains:

    COMMON_OPTIONS := -DENABLE_TESTS=1 -DENABLE_HYBRIS_CAMERA=1 -DBOOTSTRAP_GN=1

which is being set on all architectures.

Revision history for this message
Santosh (santoshbit2007) wrote :

cmake options are correct, if _IS_LINUX is true then set ENABLE_HYBRIS to OFF
Also ENABLE_HYBRIS_CAMERA is set to OFF, These are defaults value.

Also there is no runtime check as such for camera hybris function access.

So I feel wrong option is provided while building, I don't know how it was going earlier
Could you check debian/rules in older package

Revision history for this message
Alberto Mardegan (mardy) wrote :

Thanks to Santosh and ChrisCoulson's help, we've established that oxide is correct: ENABLE_HYBRIS_CAMERA is set, because the check on whether to use libhybris is done at run-time: oxide dlopens libcamera.so.1 and then invokes hybris_camera_initialize() on it, which should fail but not crash.
Therefore, this is likely an issue in libhybris or lower stack.

no longer affects: oxide-qt (Ubuntu)
affects: oxide → libhybris
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

I should point out, this runtime check does work fine on a standard desktop install.

Revision history for this message
Olivier Tilloy (osomon) wrote :

This also happens with the webbrowser-app snap (from edge channel), when creating a chat room in either https://appear.in or https://meet.jit.si, the application crashes with the following logs:

ERROR: Failed to load hybris linker for Android SDK version 19
QObject::~QObject: Timers cannot be stopped from another thread
Segmentation fault (core dumped)

Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

This happened on my world.taobao.com webapp. It crashed when trying to register/login

Revision history for this message
Alberto Mardegan (mardy) wrote :

So, I've tried implementing one suggestion from Simon (morphis); I'm attaching the modified file. Have a look at the CameraCompatAvailable() method in there, and please bear with me for not just posting a patch. :-)

When I run the webbrowser-app which I have installed as a deb package, it works (but OTOH, it worked even before, as Chris stated in the previous comment). When I run the google-webapp.gmail command (you get this snap from the "edge" channel), I get this:

================
[...]
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
Camera lib found
ERROR: Failed to load hybris linker for Android SDK version 19
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
[0327/165511.979089:FATAL:oxide_browser_process_main.cc(472)] Check failed: state_ == STATE_NOT_STARTED || state_ == STATE_SHUTDOWN. BrowserProcessMain::Shutdown() should be called before process exit
#0 0x7fe9e2bd641e <unknown>
#1 0x7fe9e2bf036e <unknown>
#2 0x7fe9e41da509 <unknown>
#3 0x7fea0b537ff8 <unknown>
#4 0x7fea0b538045 exit
#5 0x7fe9dfb925fc <unknown>
#6 0x7fe9dfb9288f android_dlopen
#7 0x7fe9e4218b4c <unknown>
#8 0x7fe9e41cf02c <unknown>
#9 0x7fe9e2bd7e99 <unknown>
#10 0x7fe9e2bf9b20 <unknown>
#11 0x7fe9e2bfb4bd <unknown>
#12 0x7fe9e2bfb978 <unknown>
#13 0x7fe9e2bfc7c9 <unknown>
#14 0x7fe9e2bf8c35 <unknown>
#15 0x7fe9e2c1762a <unknown>
#16 0x7fe9e2c32ab6 <unknown>
#17 0x7fe9e2c2ec82 <unknown>
#18 0x7fea0b2e56ba start_thread
#19 0x7fea0b60482d clone

Aborted (core dumped)
================

Please note the "Camera lib found" message, which is one of those I added. As you can see, the "compat lib not found" message is not present, meaning that the app crashes while invoking the hybris_dlopen() function.

Revision history for this message
Santosh (santoshbit2007) wrote :

I could see same crash with attach files in gmail while composing mail.

On debugging, it looks android sdk linker(jb.so/mm.so) is not loaded.
hybris src tries to load this from directory (http://bazaar.launchpad.net/~rsalveti/libhybris/trunk/view/head:/hybris/common/hooks.c#L2935 )
and it fails.

I could see jb.so available in ubuntu-app-platform
/snap/ubuntu-app-platform/34/usr/lib/x86_64-linux-gnu/libhybris/linker/jb.so

I tried to set this path by env variable:
 export HYBRIS_LINKER_DIR="/snap/ubuntu-app-platform/34/usr/lib/x86_64-linux-gnu/libhybris/linker"
and crash didn't happen.

Need to confirm with google-webapp.googleplus also but as of now it was not loading,
@mardy, if you can confirm the same.

Revision history for this message
Alberto Mardegan (mardy) wrote :

Thanks Santosh! I've added this environment variable to our webapp launcher (https://gitlab.com/mardy/snapcraft-webapp-helper/commit/7c22b221ca3e2385a6abb437fc0cc987000c20b6), rebuilt the google-webapp, and now it works.

So, no changes are needed in oxide. libhybris should still be fixed in order not to crash when jb.so is not found, but the issue is not so urgent for us anymore, given that we have a workaround.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.