title: AsyncTask's doInBackground() does not execute (despite fresh instantiations) for some tasks
body: <p>This error is common, but despite applying the most popular solutions for days, I keep getting stuck. I have several classes that extend AsyncTask.</p>
  
  <p>Strange thing is <strong>my <code>PostComment.java</code> does call doInBackground but <code>DownloadComments.java</code> does not</strong>, despite them being in the same function one right after another. The order in which I call their execute does not matter.</p>
  
  <p><em>Bios.java</em> calls DownloadComments and PostComment</p>
  
  <pre><code>@Override
  public void onClick(View v) {
      switch(v.getId()) {
          case(R.id.Post):
  
          // Start DownloadComments
          // Execute doInBackground NOT CALLED
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) {
              new DownloadComments().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "Clinton");
          } else {
              new DownloadComments().execute(candidate);
          }
  
          // Post Comment
          EditText commentHandler = (EditText) findViewById(R.id.comment);
          String commentString = commentHandler.getText().toString();
          // Execute doInBackground IS CALLED
          if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) {
              new PostComment().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, commentString, MainActivity.username, Integer.toString(MainActivity.PosterID));
          } else {
              new PostComment().execute(commentString, MainActivity.username, Integer.toString(MainActivity.PosterID));
          }
          break;
      default:
          break;
      }
  }
  </code></pre>
  
  <p>PostComment.java (<code>extends AsyncTask&lt;String, Void, Void&gt;</code>)</p>
  
  <pre><code>@Override
  protected Void doInBackground(String... arg0) {
      // Otherwise SocketException Connection reset by peer
      try {
          String comment = arg0[0];
          String username = arg0[1];
          String PosterName = arg0[2];
  
  
          // EDIT LINK
          String link = "http://particlecollider.net76.net/postComment.php";
  
  
          URL url = new URL(link);
          String data = URLEncoder.encode("comment", "UTF-8") + "="
                  + URLEncoder.encode(comment, "UTF-8")
                  + "&amp;"
                  + URLEncoder.encode("UN", "UTF-8") + "="
                  + URLEncoder.encode(username, "UTF-8");
          URLConnection conn = url.openConnection();
  
          System.setProperty("http.keepAlive", "false");
          // Kill keep-alive property
          conn.setRequestProperty("connection", "close");
  
  
          // Write
          conn.setDoOutput(true);
          OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
  
          wr.write(data);
          wr.flush();
  
          // Read
          BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  
          return null;
      } catch (Exception e) {
          e.printStackTrace();
      }
      return null;
  }
  </code></pre>
  
  <p>DownloadComments <code>extends AsyncTask&lt;String, Void, String&gt;</code> THIS METHOD IS NOT ENTERED AT ALL</p>
  
  <pre><code>@Override
  protected String doInBackground(String... passedIn) {
      try {
          String candidate = passedIn[0];
          String link = "http://particlecollider.net76.net/downloadComments.php?candidate="+candidate;
          int CommentsInLinearList;
  
      URL url = new URL(link);
      URLConnection conn = url.openConnection();
  
      System.setProperty("http.keepAlive", "false");
      // Kill keep-alive property
      conn.setRequestProperty("connection", "close");
  
      BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  
      StringBuilder sb = new StringBuilder();
      String line = null;
  
      // Read Server Response
      // Skip until it works
      while (!(line = reader.readLine()).contains("COMMENTLINEARLIST")) {
          // Finished
      }
      CommentsInLinearList = Integer.parseInt(reader.readLine());
      while (CommentsInLinearList &gt; 0) {
          line = reader.readLine();
          sb.append(line);
          CommentsInLinearList--;
      }
  
      JSONObject jObject = new JSONObject(sb.toString());
      JSONArray myJSONArray = jObject.getJSONArray("CommentLinearList");
      if(myJSONArray != null) {
          for(int i=0; i&lt;myJSONArray.length(); i++) {
              JSONObject targetComment = myJSONArray.getJSONObject(i);
              Comment PushComment = new Comment(candidate);
              PushComment._ID = Integer.parseInt(targetComment.getString("ID"));
              PushComment._Candidate = candidate;
              PushComment._PosterID = Integer.parseInt(targetComment.getString("PosterID"));
              PushComment._ReplyToId = Integer.parseInt(targetComment.getString("ReplyToID"));
              PushComment._Rating = Integer.parseInt(targetComment.getString("Rating"));
              PushComment._Comment = targetComment.getString("Comment");
              // PushComment into candidateCommentArrayList
              candidateCommentArrayList.add(PushComment);
          }
          // getMenuInflater().inflate(R.menu., candidateCommentArrayList);
      }
      return sb.toString();
  } catch (Exception e) {
      e.printStackTrace();
  }
  
  return null;
  }
  </code></pre>
  
  <p>When debugging, it does not even enter doInBackground for DownloadComments</p>
  
  <p><a href="https://i.stack.imgur.com/OmFlY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OmFlY.png" alt="enter image description here"></a></p>
  
  <p>Please help. Let me know if I can add more details</p>