Main camera does not start

REPRODUCIBILITY (% or how often): 90%
BUILD ID: 3.3.0.16 (Rokua)
HARDWARE (Jolla1, Tablet, XA2,…): XA2
UI LANGUAGE: Silica (or whatever the default UI Language is called nowadays)
REGRESSION: (compared to previous public release: Yes, No, ?): Yes

DESCRIPTION:

When pressing the camera icon in Whatsapp, it gives the message ‘Can’t start Camera, please restart your phone’. This happens when the browser is also open in the background and has 5 or more (inactive) tabs opened, or other apps are open.

Workaround #1: Close 1 tab in the browser, or close other apps running in background aside from browser. This works sometimes and resolves the issue. Camera will start in whatsapp again

Workaround #2: Close browser and any other apps

Workaround #3:

  1. Start native camera app. Native app will show black screen instead of turning on the camera and showing a live image in the ‘viewfinder’.

  2. Switch to front camera (it should show image from front camera).

  3. Wait to let it focus

  4. Switch to main (rear) camera. The camera will come on again. If it doesn’t come on, repeat steps a couple of times, or close some apps in the background and repeat the steps 1 - 4.

  5. Minimize camera app

  6. Click on Whatsapp cover to bring it to the front.

  7. Click on the camera icon in a whatsapp chat window. The main camera should start at this point and you can take a picture from the camera and send it.

  8. Close native camera app. If the browser was still open, at this point you’ll notice it crashed. Especially if the free space on your native device memory (non-SD card) is less than 2GB.

Other quirks: Flashlight stops working when the rear camera is not functioning. Workaround #3 can be used to get flashlight to work again.

PRECONDITIONS:

Other apps need to be open alongside whatsapp. Having the native browser open with 5 or more tabs alongside other apps should help reproduce the issue. The native memory having only 1.6GB of free space or anything around 2 GB or less will also help.

STEPS TO REPRODUCE:

  1. Open Whatsapp
  2. Go into Chat window
  3. Click on Camera icon

EXPECTED RESULT:

Camera will refuse to start and you’ll get a message from Whatsapp saying “Can’t start Camera, please restart your phone”.

Also the flashlight won’t work when using the the sailfish drop down menu.

Thoughts:
It may be a memory management or camera driver issue.

11 Likes

If it were me, I would uninstall jolla-camera, reboot and install jolla-camera and see what happens. This requires using terminal, if you are not familiar with command line but have terminal installed on your device, you can use;

devel-su pkcon remove jolla-camera

you may be asked about uninstalling camera settings, go ahead and do that, you will be offered to install those settings again when you reinstall the camera, with;

devel-su pkcon install jolla-camera

Before you uninstall the camera, if you have any patches for camera on your device, it may be best to unapply the patch first.

+1 on XA2

@edz it is not about reinstalling jolla cam application.
It also effects other camera like advanced-ca or android cam. And annoying as hell the flashlight.

I do hope @Jolla will solve this!
I also think of memory mismanagement!

I made me a workaround working almost always (sometimes only restarting lipstick solves).

devel-su -c kill -9 $(ps aux | grep .*android\.hardware.camera.* | tr -s ' ' |  cut -f2 -d' '); killall -r .*camera.*;

I use it with ShellEx and/or qCommand!

7 Likes

I’ve stumbled upon this too now for quite many occasions on XA2 Dual-Sim 3.3.0.16. Now since I’ve moved on to using Advanced Camera, I get this issue more often. Sometimes Advanced Camera just crashes when I try to open it whereas native Jolla camera shows nothing and I need to switch between front camera and back to get it working. Sometimes even restarting Android support and lipstick don’t do the trick.

Seems like when different processes try to access the camera hardware it gets locked even though the camera should be off. Thanks @peterleinchen for the command, have to try it sometime!

Can this command be used in the terminal?

BTW, could you walk through what the command is doing? Just curious as I’m not that familiar with the syntax. It looks like it’s killing the camera service (in android?) and restarting it.

Thanks!

And yes I hope Jolla fix it too @jovirkku

For me Advanded Camera logs this:

-> CUT
[D] restoreStorage:613 - Selecting ext4 -> /media/sdc
ard/ext4
[D] onCompleted:424 - Warning: specifying an object i
nstance for initialPage is sub-optimal - prefer to us
e a Component
[D] unknown:0 - QQuickGridLayoutBase::onItemVisibleCh
anged
[D] unknown:0 - QQuickGridLayoutBase::updateLayoutIte
ms
[D] unknown:0 - QQuickGridLayoutBase::invalidate()
[D] unknown:0 - QQuickLayout::invalidate(), polish()
[D] unknown:0 - QQuickGridLayoutBase::updateLayoutIte
ms LEAVING
[D] unknown:0 - QQuickGridLayoutBase::onItemVisibleCh
anged
[D] unknown:0 - QQuickGridLayoutBase::updateLayoutIte
ms
[D] unknown:0 - QQuickGridLayoutBase::invalidate()
[D] unknown:0 - QQuickGridLayoutBase::updateLayoutIte
ms LEAVING
[D] expression
 for onDepthChanged:583 - Calling camer
a.start() due to pageStack change
[D] unknown:0 - "" QQuickGridLayoutBase::rearrange()
QSizeF(140, 1060)
[D] onCameraStatusChanged:205 - Camera status: 2
[D] onCameraStatusChanged:205 - Camera status: 4
[D] onCameraStatusChanged:205 - Camera status: 6
[D] unknown:0 - No exposure modes found
[D] unknown:0 - No effect modes found
[D] unknown:0 - No ISO modes found
[D] unknown:0 - No white balance modes found
[D] unknown:0 - No flash modes found
Segmentation fault

It is corelated with free memory. The more apps running/longer uptime, more likely cam apps do not start (both crashes with Segmentaion fault)
P

3 Likes

Yes, definitely. That is what it is made for :slight_smile:

Exactly. It is killing the android cam service (which was needed to get it back on track!) and all cam processes like jolla-camera or harbour-advanced-camera.
Restarting will be done automatically if needed.

1 Like

I have filed a bug on this in our error database.
However, I cannot make this issue happen on my test device running the upcoming 3.4.0 release.

@Swayer: What do you get from these commands (when the problem is hitting)?

free -m
ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20
1 Like

@jovirkku
You cannot ‘make this happen’. It is occuring out of the blue after some usage.
And it is not that the current memory situation is the culprit. As this happens as well when there is no app open (or after closing all opened), so your command will tell you nothing.

Maybe it helps to have Android support enabled? And opening some applications, mail, settings, terminal, esp. browser (which makes my XA2 hot as hell AND consuming battery - correction: it may not be the browser’s fault as after restarting lipstick using the device with browser is okay, not getting hot).
And see also that OOM will kill also native applications!!! (another ‘memory’ bug on XA2, reported on TJC, without notice of @Jolla) .

Is your test device a XA2 (dual SIM)?

I got the impression that it’s always related to WhatApp. I assume that WhatsApp doesn’t properly release its resources. Yesterday I managed to recover by opening Jolla Camera App, switching to selfie camera and switching back to main camera. That seemed to reinitialise the resources.
Shutting down AlienDalvik didn’t help

1 Like

This also seems to be only applicable to Sony devices?, I re-read the original post and opened ALL applications on my Jolla1 (31 apps), I cannot make the phone trip, the flash works for video mode on the normal camera. I am able to take and add images to a chat in Whatsapp from the front or back camera. I have a dozen tabs open in sailfish-browser also.

Could this be something to do with the newer Android support?, seeing as Jolla1 is stuck on 4.4 ?

1 Like

Yeah. Same here. I don’t face this issue in my Aqua Fish.
In my Sony XA2 alone often I get cannot open camera error, flash light failing to get started.
So I configured to turn off and turn on AD around 12:00AM and as a result the number of times the issue happening has reduced.

I guess it’s a issue with the new 8.1 AD and it lacks few features(like sending/reading SMS) that was present in 4.4(it was robust too).

1 Like

@jovirkku

Please see attached output. First part is when not working, second part is after my workaround kill commands.
Do you see anything?

NOT working 
[nemo@ ~]free -m; ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head-n 20total        used        free      shared  buff/cache   availableMem:           2639        2160          51           2         427         377Swap:           511         420          9121903 10.0 /usr/bin/sailfish-browser6586 6.9 /usr/bin/lipstick7823 2.8 system_server27645 2.5 /usr/bin/jolla-camera6989 2.4 /usr/bin/voicecall-ui24173 2.2 com.whatsapp23707 2.0 /usr/bin/jolla-email8136 1.9 com.android.systemui9031 1.8 /usr/bin/fingerterm15578 1.6 com.tripadvisor.tripadvisor6962 1.6 /usr/bin/maliit-server21301 1.3 com.stickify.stickermaker27815 1.3 booster8228 1.2 com.android.phone21075 1.1 /usr/bin/harbour-advanced-camera8410 1.0 com.myriadgroup.home8757 1.0 com.google.android.gms26795 0.9 booster5129 0.9 /usr/bin/jolla-notes8423 0.9 com.myriadgroup.inputmethod.remote

Working (after my 'workaround'j
[nemo@ ~]$ free -m; ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20total        used        freeshared  buff/cache   availableMem:           2639        2233          632         343         305Swap:           511         439          7221903 9.4 /usr/bin/sailfish-browser6586 6.8 /usr/bin/lipstick25329 2.4 /usr/bin/harbour-advanced-camera7823 2.2 system_server6989 2.1 /usr/bin/voicecall-ui8136 1.7 com.android.systemui9031 1.6 /usr/bin/fingerterm26795 1.5 /usr/bin/harbour-shellex23707 1.4 /usr/bin/jolla-email24173 1.4 com.whatsapp6962 1.4 /usr/bin/maliit-server8228 0.9 com.android.phone29257 0.8 booster5129 0.8 /usr/bin/jolla-notes8410 0.8 com.myriadgroup.home8436 0.8 android.process.media15929 0.7 de.dwd.warnapp6954 0.7 /usr/bin/meecastd8423 0.7 com.myriadgroup.inputmethod.remote8757 0.7 com.google.android.gms

Sorr for any missing new-line breaks. But that is another story / shortcoming of SFOS clipboard…

Another occurence of flash light not working just now.
@jovirkku
I did not run the terminal commands.
But I had only sf browser open and a terminal.
I closed the browser window and flash light was working again.

@jovirkku
Another occurence.

I had only terminal, email and browser open.

Flashlight and cam did not work.
I closed email (as having browser under suspicion) . AND flashlight/cam worked.
I re-opened email but everything kept working.

So I remembered that I had WhatsApp open this morning and opened that as well:
Bam, flashlight/cam not working.
I closed WhatsApp and it worked again (looking to me as some bad memory handling, see above already mentioned link. See logs:

free -m; ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head-n 20total        used        free      shared  buff/cache   availableMem:           2639        2284          46           9         308         246Swap:           511         468          4322928 10.2 /usr/bin/sailfish-browser6586 7.6 /usr/bin/lipstick7823 2.5 system_server25024 2.0 /usr/bin/jolla-camera3159 1.7 /usr/bin/jolla-email793 1.6 com.whatsapp9031 1.6 /usr/bin/fingerterm6989 1.4 /usr/bin/voicecall-ui6962 1.3 /usr/bin/maliit-server8136 0.9 com.android.systemui14025 0.7 booster6954 0.7 /usr/bin/meecastd13340 0.6 booster29108 0.4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service6956 0.4 /usr/bin/harbour-ringingrestorer7042 0.4 /usr/bin/messageserver57814 0.4 /usr/libexec/tracker-extract8228 0.4 com.android.phone7812 0.3 /usr/libexec/tracker-store8410 0.3 com.myriadgroup.home
free -m; ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head-n 20total        used        free      shared  buff/cache   availableMem:           2639        2307          67           1         264         231Swap:           511         508           322928 7.7 /usr/bin/sailfish-browser6586 7.0 /usr/bin/lipstick7823 2.2 system_server14903 2.0 com.whatsapp25024 2.0 /usr/bin/jolla-camera3159 1.7 /usr/bin/jolla-email9031 1.6 /usr/bin/fingerterm6989 1.3 /usr/bin/voicecall-ui6962 1.2 /usr/bin/maliit-server8136 1.1 com.android.systemui14025 0.7 booster6954 0.7 /usr/bin/meecastd13340 0.5 booster8228 0.5 com.android.phone29108 0.4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service6956 0.4 /usr/bin/harbour-ringingrestorer7042 0.4 /usr/bin/messageserver58410 0.4 com.myriadgroup.home8423 0.3 com.myriadgroup.inputmethod.remote8436 0.3 android.process.media

Another one, BAD:

free -m; ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head-n 20total        used        free      shared  buff/cache   availableMem:           2639        2204          94          25         340         311Swap:           511         498          1322928 10.7 /usr/bin/sailfish-browser6586 7.9 /usr/bin/lipstick6147 3.7 /usr/bin/jolla-email7823 2.8 system_server14903 2.6 com.whatsapp9031 1.6 /usr/bin/fingerterm6962 1.5 /usr/bin/maliit-server6989 1.5 /usr/bin/voicecall-ui8136 1.5 com.android.systemui13340 0.9 /usr/bin/jolla-notes8228 0.9 com.android.phone8410 0.8 com.myriadgroup.home8423 0.8 com.myriadgroup.inputmethod.remote17940 0.7 booster6954 0.7 /usr/bin/meecastd8436 0.7 android.process.media8757 0.7 com.google.android.gms15929 0.6 de.dwd.warnapp6956 0.6 /usr/bin/harbour-ringingrestorer8507 0.6 com.google.android.gms:locservice

After killing all cam processes still does not work(???):

free -m; ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20total        used        freeshared  buff/cache   availableMem:           2639        2289          4522         305         228Swap:           511         509           222928 14.7 /usr/bin/sailfish-browser6586 7.9 /usr/bin/lipstick6147 3.1 /usr/bin/jolla-email7823 2.6 system_server14903 2.3 com.whatsapp9031 1.7 /usr/bin/fingerterm17940 1.5 /usr/bin/harbour-shellex6962 1.5 /usr/bin/maliit-server8136 1.5 com.android.systemui6989 1.4 /usr/bin/voicecall-ui13340 0.8 /usr/bin/jolla-notes24798 0.8 booster8228 0.8 com.android.phone8410 0.8 com.myriadgroup.home6954 0.7 /usr/bin/meecastd8423 0.7 com.myriadgroup.inputmethod.remote8436 0.7 android.process.media15929 0.6 de.dwd.warnapp8757 0.6 com.google.android.gms25019 0.5 /usr/bin/jolla-settings-system-flashlight

And after running again
my kill cam command I do see some native applications killed (!), which MUST NOT happen, especially terminal!!!, and it is working…

free -m; ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20total        used        freeshared  buff/cache   availableMem:           2639        2235         1029         302         295Swap:           511         497          1422928 14.2 /usr/bin/sailfish-browser6586 7.9 /usr/bin/lipstick27226 2.8 /usr/bin/jolla-camera7823 2.2 system_server28458 1.8 /usr/bin/fingerterm24798 1.6 /usr/bin/harbour-shellex6962 1.5 /usr/bin/maliit-server26470 1.3 com.whatsapp27878 1.3 booster6989 1.3 /usr/bin/voicecall-ui27752 1.0 /vendor/bin/hw/android.hardware.camera.provider@2.4-service8136 1.0 com.android.systemui27601 0.9 booster6954 0.6 /usr/bin/meecastd27100 0.4 /usr/bin/jolla-settings-system-flashlight8228 0.4 com.android.phone8410 0.4 com.myriadgroup.home6956 0.3 /usr/bin/harbour-ringingrestorer7042 0.3 /usr/bin/messageserver58423 0.3 com.myriadgroup.inputmethod.remote

And another, look at RAM and swap used…This time I attach txt files …… oh no I cannot attach other than pics! :frowning:If you need more details let me know how to send you…
Oh, and you see: missing line breaks! I copied text from already written post from browser and pasted into browser!

1 Like

On my device this is related simply to activation / deactivation of android support. Can anybody try on theirs too?

  • Make sure the fllashlight (or camera on picture mode, not video) opens up at first try.
  • Close every app and start android support from settings. When it’s activated you can test again if the flashlight/camera works (but most times it does).
  • Close everything, and deactivate android support.
    There we go, flashlight does not work at first try or camera shows a dark screen (test with one of the two app at a time).This behavior can be reproduced 100% of the times on my XA2 on rokua.
2 Likes

I can more or less confirm this.

Whereas on my device (XA2 dual SIM, 3.2.1.20) it is a bit different. After deactivating android support cam/flashlight works. But after activating it cam/flashlight does not work.

With uptime of

uptime16:02:58 up 13 days, 14:27, 0 users, load average: 7.04, 7.00, 6.93

and mem situation of
working, Andy off

free -mtotal used free shared buff/cache availableMem: 2639 1902 174 1 563 638Swap: 511 333 178

not working, Andy on

free -mtotal used free shared buff/cache availableMem: 2639 1877 50 2 712 662Swap: 511 340 171

working, Andy on, after running my kill cam script

free -mtotal used free shared buff/cache availableMem: 2639 1879 300 2 459 660Swap: 511 359 152

1 Like

Thanks for testing… It would be interesting to know if everyone who has this problem is tinkering with android support or keeps it always on…

P.S. You gave me the idea to test it after a full reboot and still my camera does not start after deactivation of AS… weird indeed…

I’ve got the same problem, camera and flash/torchlight mostly not working on first try. Closing one or more apps often helps, but not always immediately. I have a XA2. I am not using Whatsapp but using Firefox, Telegram, Tutanota Mail (all Android) and Tidings which are running most of the time. I keep Android support always on except there is a problem. No “tinkering” with AD.
I did a quick test right now. Opening camera didn’t work, closed camera app, stopped AD, opened camera again and it worked. Started AD, camera didn’t work again. So it seems there may be a connection between blocked camera and running AD support at least for me.

2 Likes

Thank you. If this is confirmed by more people at least we have a 100% reproducible scenario, which might be useful to the devs.
I have been testing for a few days without ever activating AD support and never had the issue.
So far we have:

  • 100% reproducible either on activating or deactivating AD (both required to get 100%).
  • Occasional to frequent when keeping AD on
  • No issues without AD (apart from the first time after deactivating it).
    More tests needed, obviously…
2 Likes