[Samsung Galaxy Nexus] Regina Rainbow:
I was able to reproduce this, not with a 100% reproduction rate, though. Following the steps [MENTION=7643454]jango0[/MENTION] provided I can crash Snap, but afterwards camera is available again and camera apps like Snap, QR Readers etc. can connect to it. That's why I think, this is a different bug than the one that prevents apps from reconnecting to the camera. To me it seems like there could be a problem with mediaserver segfaulting, which prevents Snap from connecting to the camera in this special test case.

My logs show mediaserver segfaulting very regularly, even without any user or app interaction (attachment 1). With this test case it seems I can trigger a segfault (attachment 2).

From dmesg:

[ 176.024444] binder: release 563:587 transaction 55049 in, still active

[ 176.024536] rpmsg_omx rpmsg-omx1: Disconnecting from OMX service at 101

[ 176.024658] binder: send failed reply for transaction 55049 to 1943:1983

[ 176.061065] init: Service 'media' (pid 563) killed by signal 6

[ 176.061248] init: Service 'media' (pid 563) killing any children in process group

[ 176.062652] init: Starting service 'media'...

binder: send failed reply for transaction 73916 to 2333:2351

[ 257.751159] rpmsg_omx rpmsg-omx1: Disconnecting from OMX service at 101

[ 257.766540] init: Service 'media' (pid 2209) killed by signal 11

[ 257.766662] init: Service 'media' (pid 2209) killing any children in process group

[ 257.767730] init: Starting service 'media'...

[ 258.298248] rpmsg_omx rpmsg-omx1: local addr assigned: 0x401

[ 258.348266] rpmsg_omx rpmsg27: conn rsp: status 0 addr 101

Same events in logcat:

08-20 20:40:57.940 D/CAM_PhotoModule( 1943): remove idle handleer in onPause

08-20 20:40:57.940 V/CAM_PhotoModule( 1943): On pause.

08-20 20:40:57.943 V/CAM_UI ( 1943): surfaceDestroyed

08-20 20:40:57.943 D/Camera ( 1943): app passed NULL surface

08-20 20:40:57.944 I/chatty ( 563): uid=1013(media) /system/bin/mediaserver expire 4 lines

08-20 20:40:57.944 V/CAM_PhotoModule( 1943): stopPreview

08-20 20:40:58.051 I/chatty ( 563): uid=1013(media) /system/bin/mediaserver expire 11 lines

08-20 20:40:58.057 I/chatty ( 563): uid=1013(media) /system/bin/mediaserver expire 1 line

08-20 20:40:58.074 I/chatty ( 563): uid=1013(media) /system/bin/mediaserver expire 12 lines

08-20 20:40:58.151 F/libc ( 563): Fatal signal 6 (SIGABRT), code -6 in tid 2192 (DisplayThread)

08-20 20:40:58.152 I/DEBUG ( 165): property debug.db.uid not set; NOT waiting for gdb.

08-20 20:40:58.153 I/DEBUG ( 165): HINT: adb shell setprop debug.db.uid 100000

08-20 20:40:58.153 I/DEBUG ( 165): HINT: adb forward tcp:5039 tcp:5039

08-20 20:40:58.260 F/DEBUG ( 165): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

08-20 20:40:58.260 F/DEBUG ( 165): CM Version: '13.0-20160816-UNOFFICIAL-maguro'

08-20 20:40:58.260 F/DEBUG ( 165): Build fingerprint: 'google/yakju/maguro:4.3/JWR66Y/776638:user/release-keys'

08-20 20:40:58.260 F/DEBUG ( 165): Revision: '0'

08-20 20:40:58.260 F/DEBUG ( 165): ABI: 'arm'

08-20 20:40:58.261 F/DEBUG ( 165): pid: 563, tid: 2192, name: DisplayThread >>> /system/bin/mediaserver <<<

08-20 20:40:58.261 F/DEBUG ( 165): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

08-20 20:40:58.266 W/NativeCrashListener( 472): Couldn't find ProcessRecord for pid 563

08-20 20:40:58.289 V/NlpLocationBackendFuser( 980): location=Location[network 49,911877,10,871218 acc=17261 et=+2m55s112ms {Bundle[{noGPSLocation=Location[network 49,911877,10,871218 acc=17261 et=+2m55s112ms], AVERAGED_OF=1, SERVICE_BACKEND_PROVIDER=gsm, SERVICE_BACKEND_COMPONENT=org.fitchfamily.android.gsmlocation/.GsmService_}]}]

08-20 20:40:58.297 F/DEBUG ( 165): r0 00000000 r1 00000890 r2 00000006 r3 4b1a4978

08-20 20:40:58.298 E/DEBUG ( 165): AM write failed: Broken pipe

08-20 20:40:58.298 F/DEBUG ( 165): r4 4b1a4980 r5 4b1a4930 r6 00000000 r7 0000010c

08-20 20:40:58.298 F/DEBUG ( 165): r8 4278418e r9 42795840 sl 42786a37 fp 42787e0d

08-20 20:40:58.298 F/DEBUG ( 165): ip 00000006 sp 4b1a4788 lr 4076e999 pc 40770d94 cpsr 400f0010

08-20 20:40:58.328 F/DEBUG ( 165):

08-20 20:40:58.328 F/DEBUG ( 165): backtrace:

08-20 20:40:58.328 F/DEBUG ( 165): #00 pc 00042d94 /system/lib/libc.so (tgkill+12)

08-20 20:40:58.328 F/DEBUG ( 165): #01 pc 00040995 /system/lib/libc.so (pthread_kill+32)

08-20 20:40:58.328 F/DEBUG ( 165): #02 pc 0001c74f /system/lib/libc.so (raise+10)

08-20 20:40:58.328 F/DEBUG ( 165): #03 pc 000198f1 /system/lib/libc.so (__libc_android_abort+34)

08-20 20:40:58.328 F/DEBUG ( 165): #04 pc 0001751c /system/lib/libc.so (abort+4)

08-20 20:40:58.328 F/DEBUG ( 165): #05 pc 0003043b /system/lib/hw/camera.tuna.so (_ZN2Ti6Camera19AppCallbackNotifier11errorNotifyEi+94)

08-20 20:40:58.328 F/DEBUG ( 165): #06 pc 00034d15 /system/lib/hw/camera.tuna.so (_ZN2Ti6Camera27ANativeWindowDisplayAdapter17handleFrameReturnEv+584)

08-20 20:40:58.328 F/DEBUG ( 165): #07 pc 00034edd /system/lib/hw/camera.tuna.so (_ZN2Ti6Camera27ANativeWindowDisplayAdapter13displayThreadEv+144)

08-20 20:40:58.328 F/DEBUG ( 165): #08 pc 00034f11 /system/lib/hw/camera.tuna.so

08-20 20:40:58.328 F/DEBUG ( 165): #09 pc 000101c5 /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+112)

08-20 20:40:58.328 F/DEBUG ( 165): #10 pc 00040297 /system/lib/libc.so (_ZL15__pthread_startPv+30)

08-20 20:40:58.328 F/DEBUG ( 165): #11 pc 00019f83 /system/lib/libc.so (__start_thread+6)

08-20 20:40:59.145 F/DEBUG ( 165):

08-20 20:40:59.145 F/DEBUG ( 165): Tombstone written to: /data/tombstones/tombstone_04

08-20 20:40:59.146 I/BootReceiver( 472): Copying /data/tombstones/tombstone_04 to DropBox (SYSTEM_TOMBSTONE)

08-20 20:40:59.163 I/ServiceManager( 159): service 'media.audio_flinger' died

08-20 20:40:59.164 W/AudioSystem( 472): AudioFlinger server died!

08-20 20:40:59.165 W/AudioSystem( 941): AudioPolicyService server died!

08-20 20:40:59.166 W/AudioSystem( 472): AudioPolicyService server died!

08-20 20:40:59.166 W/CameraBase( 1943): Camera service died!

08-20 20:40:59.166 W/SoundTrigger( 472): Sound trigger service died!

08-20 20:40:59.166 W/AudioSystem( 640): AudioPolicyService server died!

08-20 20:40:59.167 W/CameraBase( 1943): mediaserver's remote binder Camera object died

08-20 20:40:59.167 E/Camera ( 1943): Error 100

08-20 20:40:59.167 E/CameraErrorCallback( 1943): Got camera error callback. error=100

08-20 20:40:59.168 I/ServiceManager( 159): service 'media.player' died

08-20 20:40:59.169 I/ServiceManager( 159): service 'media.resource_manager' died

08-20 20:40:59.169 I/ServiceManager( 159): service 'media.camera' died

08-20 20:40:59.170 I/ServiceManager( 159): service 'media.audio_policy' died

08-20 20:40:59.170 I/ServiceManager( 159): service 'media.sound_trigger_hw' died

08-20 20:40:59.170 I/ServiceManager( 159): service 'media.radio' died

08-20 20:40:59.170 E/AudioService( 472): Media server died.

08-20 20:40:59.190 D/LocationManager( 1943): stopReceivingLocationUpdates

08-20 20:40:59.190 V/CAM_PhotoModule( 1943): Close camera device.

08-20 20:40:59.252 V/CAM_VideoUI( 1943): Shutter Button disabled !!

08-20 20:40:59.252 D/CameraSettings( 1943): Using key for iso: iso

08-20 20:40:59.252 D/CameraSettings( 1943): Using key for iso-values: iso-values

08-20 20:40:59.258 D/CameraSettings( 1943): check storage menu false

08-20 20:40:59.263 I/ServiceManager( 1943): Waiting for service media.camera...

08-20 20:40:59.671 E/AudioService( 472): Media server died.

08-20 20:40:59.722 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 2087 lines

08-20 20:40:59.741 W/ActivityManager( 472): Activity pause timeout for ActivityRecord{73a0e9e u0 org.cyanogenmod.snap/com.android.camera.CameraLauncher t188 f}

08-20 20:41:00.173 E/AudioService( 472): Media server started.

08-20 20:41:00.174 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 43 lines

08-20 20:41:00.177 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 3 lines

08-20 20:41:00.189 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 4 lines

08-20 20:41:00.192 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 5 lines

08-20 20:41:00.196 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 1 line

08-20 20:41:00.199 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 75 lines

08-20 20:41:00.205 I/CameraManagerGlobal( 640): Connecting to camera service

08-20 20:41:00.207 E/CameraManagerGlobal( 640): Camera service is unavailable

08-20 20:41:00.210 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 43 lines

08-20 20:41:00.213 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 3 lines

08-20 20:41:00.215 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 99 lines

08-20 20:41:00.227 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 4 lines

08-20 20:41:00.229 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 5 lines

08-20 20:41:00.233 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 1 line

08-20 20:41:00.235 W/CameraService_proxy( 472): Could not notify mediaserver, camera service not available.

08-20 20:41:00.236 I/CameraService_proxy( 472): Could not notify camera service of user switch, retrying...

08-20 20:41:00.288 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 2 lines

08-20 20:41:00.292 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 2 lines

08-20 20:41:00.294 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 1 line

08-20 20:41:00.300 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 1 line

08-20 20:41:00.309 V/CAM_VideoUI( 1943): Shutter Button enabled !!

08-20 20:41:00.321 E/AndroidRuntime( 1943): FATAL EXCEPTION: Camera Handler Thread

08-20 20:41:00.321 E/AndroidRuntime( 1943): Process: org.cyanogenmod.snap, PID: 1943

08-20 20:41:00.330 I/chatty ( 2209): uid=1013(media) /system/bin/mediaserver expire 1 line

08-20 20:41:01.244 I/CameraManagerGlobal( 640): Connecting to camera service

08-20 20:41:07.362 I/Process ( 1943): Sending signal. PID: 1943 SIG: 9

You can watch this even via PS on the command line. Output before Snap/Camera starts:

root@maguro:/ # ps | grep media

media_rw 627 138 7544 2168 inotify_re 4022e6b4 S /system/bin/sdcard

u0_a9 642 171 678924 40332 sys_epoll_ 4035c6d8 S android.process.media

media 5959 1 55412 8780 binder_thr 406ba804 S /system/bin/mediaserver

Output after Snap/Camera crashed:

root@maguro:/ # ps | grep media

media_rw 627 138 7544 2168 inotify_re 4022e6b4 S /system/bin/sdcard

u0_a9 642 171 678924 40488 sys_epoll_ 4035c6d8 S android.process.media

media 6371 1 95460 13484 binder_thr 406fd804 S /system/bin/mediaserver

-> mediaserver/binder got a new PID due to crashing and restarting after/while camera app (Snap) has crashed

PS: Might these old jira bugs be of any interest?:

https://jira.cyanogenmod.org/browse/CYAN-3229

https://jira.cyanogenmod.org/browse/CYAN-3077

PPS: [MENTION=2633638]Ziyan[/MENTION]: Attached you'll find two stripped-down logcat files: the first shows mediaserver segfaulting again and again; the second shows the bug described above (snap crashing together with mediaserver). Might this be an "upstream bug" (=cyanogenmod) in mediaserver that should be reported on jira instead of xda-forum?

Edit: Added separate/better logs; typos