title: HttpPost: InputDispatcher: "Channel is unrecoverably broken and will be disposed!" on Nexus 7
body: <p>On Nexus 7 (4.3), and not on my older device, LG Optimus 3d (Android 2.2), 
  when I do HttpPost, I get this</p>
  
  <p>E/InputDispatcher﹕ channel '4273f7b0 ... MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!</p>
  
  <p>People have mentioned a possible memory leak. See **. However, this problem happens right away on startup when I try the HttpPost. Is it still likely a memory leak?</p>
  
  <p>Here is how I'm doing the HttpPost:</p>
  
  <pre><code>public void server_addUserGetId()
  {
      String url = GS.baseUrl() + "/users";
      HttpPost theHttpPost = new HttpPost(url);
  
      List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
      nameValuePairs.add(new BasicNameValuePair("dId", s_UserInfo.getInstance().m_device_id ));
      try {
          theHttpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
      } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
      }
      HttpPostAsync theHttpPostAsync = new HttpPostAsync(new OnPostExecuteHandler() {
          @Override
          public void handlePostExecute(Object oHttpResponse) {
              HttpResponse theHttpResponse = (HttpResponse) oHttpResponse;
              JSONObject jo = GS.getJSONObject(theHttpResponse.getEntity());
              try {
                  s_UserInfo.getInstance().m_user_id = jo.getString("_id");
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
      });
      theHttpPostAsync.execute(theHttpPost);
      return;
  }
  </code></pre>
  
  <p>Here is my HttpPostAsync task:</p>
  
  <pre><code>public class HttpPostAsync extends AsyncTask&lt;HttpPost, Integer, HttpResponse&gt;
  {
      private HttpPost m_HttpPost;
      private HttpResponse m_HttpResponse;
  
      private OnPostExecuteHandler m_OnPostExecuteHandler;
      public HttpPostAsync(OnPostExecuteHandler listener)
      {
          m_OnPostExecuteHandler = listener;
      }
  
      protected HttpResponse doInBackground(HttpPost ... args)
      {
          m_HttpPost = args[0];
          if(GS.dl&gt;5) Log.d("GRA: HttpPostAsync", "doInBackground: Thread.currentThread().getId()=" + Thread.currentThread().getId());
          m_HttpResponse = visit(m_HttpPost);
          return m_HttpResponse;
      }
  
      protected void onProgressUpdate(Integer... progress) {
      }
  
      protected void onPostExecute(Long result) {
          if(GS.dl&gt;5) Log.d("GRA: HttpPostAsync", "onPostExecute: Thread.currentThread().getId()=" + Thread.currentThread().getId());
          if(GS.dl&gt;5) Log.d("GRA: HttpPostAsync", "onPostExecute: result=" + result);
          //if(GS.dl&gt;5) Log.d("GRA: HttpPostAsync", "onPostExecute: m_HttpEntity="+m_HttpEntity);
          m_OnPostExecuteHandler.handlePostExecute(m_HttpResponse);
      }
  
      public HttpResponse visit(HttpPost theHttpPost)
      {
          HttpResponse response = null;
          try {
              // Create a new HttpClient and Post Header
              HttpClient httpclient = new DefaultHttpClient();
              // Execute HTTP Post Request
              response = httpclient.execute(theHttpPost);
          } catch (IOException e) {
              e.printStackTrace();
              Log.d("HttpPostAsync.java", "IOException e=" + e);
              // TODO Auto-generated catch block
          }
          return response;
      }
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>I read on an SO answer* it might have to do with the ArrayList initialization, so I've also tried initializing like this, with 1, in the ArrayList, but the problem persists:</p>
  
  <pre><code>List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1);
  </code></pre>
  
  <p>*: SO answer that didn't totally relate/help:
  <a href="https://stackoverflow.com/questions/12509930/app-has-stopped-working-android">App has stopped working Android</a></p>
  
  <p>** memory leak related? <a href="http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html" rel="nofollow noreferrer">http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html</a></p>