title: Consumer closed input channel or an error occurred. events=0x8
body: <pre><code>D/AndroidRuntime(11752): 
  D/AndroidRuntime(11752): &gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START com.android.internal.os.RuntimeInit &lt;&lt;&lt;&lt;&lt;&lt;
  D/AndroidRuntime(11752): CheckJNI is ON
  D/dalvikvm(11752): creating instr width table
  E/jdwp    (11752): pipe failed
  W/ProcessState(11752): Opening '/dev/binder' failed: Too many open files
  D/AndroidRuntime(11752): Calling main entry com.android.commands.am.Am
  I/Mamarduke_Diag( 1726): Data is available now.
  I/Mamarduke_Diag( 1726): exec result --&gt;&gt;&gt; java.lang.NullPointerException
  I/DMIC    ( 1726):  ---&gt; java.lang.NullPointerException
  I/System.out( 1726): *****wifi state end=1
  D/dalvikvm( 1726): GC_EXPLICIT freed 31K, 41% free 7507K/12551K, external 1625K/2137K, paused 58ms
  D/dalvikvm( 1726): GC_EXPLICIT freed 0K, 41% free 7507K/12551K, external 1625K/2137K, paused 58ms
  I/System.out( 1726): ***run in test i=7,camera
  I/System.out( 1726): ***run in test i=8,cec
  I/System.out( 1726): ***run in test i=9,edid
  I/System.out( 1726): *****wifi state start=1
  I/Mamarduke_Diag( 1726): Data is available now.
  I/Mamarduke_Diag( 1726): exec result --&gt;&gt;&gt; 
  I/System.out( 1726): *****wifi state end=1
  D/dalvikvm( 1726): GC_EXPLICIT freed 36K, 41% free 7474K/12551K, external 1625K/2137K, paused 57ms
  D/dalvikvm( 1726): GC_EXPLICIT freed 0K, 41% free 7474K/12551K, external 1625K/2137K, paused 58ms
  I/System.out( 1726): ***run in test i=10,iris
  I/System.out( 1726): *****wifi state start=1
  I/ActivityManager( 1491): Starting: Intent { act=com.android.camera.irison flg=0x10000000 cmp=com.ianc.apd/.testcase.cameraex.ImageCamera } from pid 1726
  I/System.out( 1726): onCreate
  I/System.out( 1726): onResume
  I/System.out( 1726): test irist on
  I/System.out( 1726): excuteCmd/sys/bus/spi/devices/spi2.0/irisstate
  E/InputDispatcher( 1491): channel '40643898 com.ianc.apd/com.ianc.apd.testcase.cameraex.ImageCamera (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
  E/InputDispatcher( 1491): channel '40643898 com.ianc.apd/com.ianc.apd.testcase.cameraex.ImageCamera (server)' ~ Channel is unrecoverably broken and will be disposed!
  D/AndroidRuntime( 1726): Shutting down VM
  W/dalvikvm( 1726): threadid=1: thread exiting with uncaught exception (group=0x40015560)
  I/WindowManager( 1491): WINDOW DIED Window{40643898 com.ianc.apd/com.ianc.apd.testcase.cameraex.ImageCamera paused=false}
  E/AndroidRuntime( 1726): FATAL EXCEPTION: main
  E/AndroidRuntime( 1726): java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
  E/AndroidRuntime( 1726):    at android.view.InputChannel.nativeReadFromParcel(Native Method)
  E/AndroidRuntime( 1726):    at android.view.InputChannel.readFromParcel(InputChannel.java:138)
  E/AndroidRuntime( 1726):    at android.view.IWindowSession$Stub$Proxy.add(IWindowSession.java:409)
  E/AndroidRuntime( 1726):    at android.view.ViewRoot.setView(ViewRoot.java:498)
  E/AndroidRuntime( 1726):    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
  E/AndroidRuntime( 1726):    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
  E/AndroidRuntime( 1726):    at android.view.Window$LocalWindowManager.addView(Window.java:424)
  E/AndroidRuntime( 1726):    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2170)
  E/AndroidRuntime( 1726):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
  E/AndroidRuntime( 1726):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  E/AndroidRuntime( 1726):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  E/AndroidRuntime( 1726):    at android.os.Handler.dispatchMessage(Handler.java:99)
  E/AndroidRuntime( 1726):    at android.os.Looper.loop(Looper.java:130)
  E/AndroidRuntime( 1726):    at android.app.ActivityThread.main(ActivityThread.java:3683)
  E/AndroidRuntime( 1726):    at java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime( 1726):    at java.lang.reflect.Method.invoke(Method.java:507)
  E/AndroidRuntime( 1726):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  E/AndroidRuntime( 1726):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  E/AndroidRuntime( 1726):    at dalvik.system.NativeStart.main(Native Method)
  W/ActivityManager( 1491):   Force finishing activity com.ianc.apd/.testcase.cameraex.ImageCamera
  W/ActivityManager( 1491): Activity pause timeout for HistoryRecord{4069a248 com.ianc.apd/.testcase.cameraex.ImageCamera}
  </code></pre>
  <p>Why do <code>Consumer closed input channel or an error occurred. events=0x8</code> happen after many times running? That is too say, my program can run at first, but after many times, the exception happen.</p>
  <p>I read this: <a href="http://groups.google.com/group/android-developers/browse_thread/thread/33994faaed31c11d/621237c6358c87a0?hl=en&amp;lnk=gst&amp;q=Consumer%20closed%20input%20channel%20or%20an%20error%20occurred#621237c6358c87a0" rel="noreferrer">Input transport and input dispatcher error on 2.3</a>, but I have no idea how to solve it!! Who can help me?</p>
  <p>I run my program in real device. The android version is 2.3</p>
  <h2>Update 1:</h2>
  <p>I found the root cause of <code>Could not read input channel file descriptors from parcel.</code></p>
  <p>It is <code>E/jdwp    (11752): pipe failed</code>.</p>
  <p>Why do create pipe failed? Because the pipe is out of the max in the system. that is to say, we create a lot of pipe or file descriptors in the system. And then we found the reason and try to modify it: My friend change the code like that in his Activity: `Original source code:</p>
  <pre><code>private class MyHandler extends Handler {
      MyHandler(Looper looper) {
          super(looper);
      }
  
      @Override
      public void handleMessage(Message msg) {
          switch(msg.what) {
              case RELEASE_CAMERA:
                  synchronized (CameraHolder.this) {
                      // In 'CameraHolder.open', the 'RELEASE_CAMERA' message
                      // will be removed if it is found in the queue. However,
                      // there is a chance that this message has been handled
                      // before being removed. So, we need to add a check
                      // here:
                      if (CameraHolder.this.mUsers == 0) releaseCamera();
                  }
                  break;
          }
      }
  }
  ...
  HandlerThread ht = new HandlerThread(&quot;CameraHolder&quot;);
  ht.start();
  mHandler = new MyHandler(ht.getLooper());
  </code></pre>
  <p>change to</p>
  <pre><code>private class MyHandler extends Handler {
      MyHandler(Looper looper) {
          super(looper);
      }
  
      @Override
      public void handleMessage(Message msg) {
          switch(msg.what) {
              case RELEASE_CAMERA:
                  synchronized (CameraHolder.this) {
                      // In 'CameraHolder.open', the 'RELEASE_CAMERA' message
                      // will be removed if it is found in the queue. However,
                      // there is a chance that this message has been handled
                      // before being removed. So, we need to add a check
                      // here:
                      if (CameraHolder.this.mUsers == 0) releaseCamera();
                  }
                  break;
          }
      }
  }
      mHandler = new MyHandler();
  </code></pre>
  <p>Those file descriptors will reduce obviously. Why? how to explain this case? And I add <code>mHandler.removemessage</code> this function to onPause in my Activity. And Those file descriptors also reduce obviously.  why? who can explain this case for me? I am trying to understand this.</p>