Camera Crash on Galaxy Tab 10.1 (Android 4.0.4)
I'm currently developing an Android app using OpenCV 2.4.5 for motion detection. Everything worked fine on different devices, but recently I discovered a problem with the Samsung Galaxy Tab 10.1 (tested on model numbers GT-P7510 and GT-P7500, both Android 4.0.4): There's probably something like a file descriptor leak, the camera dies and the app crashes with a SIGSEGV. Sometimes this problem occurs after the app has been running for up to 15 hours, sometimes only after a few minutes.
I downloaded the OpenCV Face Detection demo (the version from Google Play) and could reproduce this error. After about 4 minutes the demo app crashed. Logcat showed the following:
07-17 11:31:59.750 E/MemoryHeapBase(20238): error creating ashmem region: Too many open files
07-17 11:31:59.850 E/MemoryHeapBase(20238): error creating ashmem region: Too many open files
07-17 11:31:59.950 E/MemoryHeapBase(20238): error creating ashmem region: Too many open files
07-17 11:31:59.990 V/AlarmManager( 191): waitForAlarm result :8
07-17 11:32:00.000 V/AlarmManager( 191): ClockReceiver onReceive() ACTION_TIME_TICK
07-17 11:32:00.010 D/KeyguardUpdateMonitor( 191): received broadcast android.intent.action.TIME_TICK
07-17 11:32:00.010 D/KeyguardUpdateMonitor( 191): handleTimeUpdate
07-17 11:32:00.010 D/STATUSBAR-Clock( 278): onReceive() - ACTION_TIME_TICK
07-17 11:32:00.010 D/STATUSBAR-Clock( 278): updateClock :11:32
07-17 11:32:00.030 E/MemoryHeapBase(20238): error creating ashmem region: Too many open files
07-17 11:32:00.040 D/STATUSBAR-Clock( 278): onReceive() - ACTION_TIME_TICK
07-17 11:32:00.040 D/STATUSBAR-Clock( 278): updateClock :11:32
07-17 11:32:00.050 W/AudioSystem(15425): AudioPolicyService server died!
07-17 11:32:00.050 W/Camera (11420): Camera server died!
07-17 11:32:00.050 W/Camera (11420): ICamera died
07-17 11:32:00.050 W/AudioSystem( 191): AudioPolicyService server died!
07-17 11:32:00.050 W/AudioSystem( 191): AudioFlinger server died!
07-17 11:32:00.050 I/ServiceManager( 98): service 'media.audio_policy' died
07-17 11:32:00.050 I/ServiceManager( 98): service 'media.audio_flinger' died
07-17 11:32:00.050 I/ServiceManager( 98): service 'media.player' died
07-17 11:32:00.050 I/ServiceManager( 98): service 'media.camera' died
07-17 11:32:00.050 F/libc (11420): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
07-17 11:32:00.050 I/JavaCameraView(11420): Preview Frame received. Need to create MAT and deliver it to clients
07-17 11:32:00.050 I/JavaCameraView(11420): Frame size is 460800
07-17 11:32:00.070 D/FaceDetection/DetectionBasedTracker(11420): Java_org_opencv_samples_facedetect_DetectionBasedTracker_nativeDetect enter
07-17 11:32:00.070 D/OBJECT_DETECTOR(11420): DetectionBasedTracker::process: time from the previous call is 85990.244000 ms
07-17 11:32:00.070 D/OBJECT_DETECTOR(11420): DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread: shouldCommunicateWithDetectingThread=1
07-17 11:32:00.070 D/OBJECT_DETECTOR(11420): DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread: lastBigDetectionDuration=85989.488000 ms
07-17 11:32:00.070 D/OBJECT_DETECTOR(11420): DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread: shouldSendNewDataToWorkThread was 1, now it is 1, since time_from_previous_launch_in_ms=85989.50, minDetectionPeriod=0
07-17 11 ...
I have exactly the same problem on GT-P7500 Android 4.0.3, although I am not using OpenCV, just regular camera API and onPreviewFrame callback. Did you manage to find any workaround?