title: Application crashes after I closed the socket waiting for reading in a thread
body: <p>I have a service running in background which contains several threads reading and writing over TCP sockets. My application crashes after I close the sockets and stop the service. There is a SocketException thrown and catched by my code before the crash happens. I have no idea why the SocketExeption causes my application crashing when its been catched already. But this issue only occurs in one of my phones running on android 4.2. No crash happens on android 5 or andoird 6 so far.</p>
  
  <p>Below is part of the code:</p>
  
  <pre><code>public void logout() throws IOException {
  this.userName = "";
  listenerService.p_status=false;
  listenerService.p_Thread.interrupt();
  listenerService.c_status=false;
  listenerService.c_Thread.interrupt();
  listenerService.closeSocket();
  unbindService(mConnection);
  listenerService.stopService();
  </code></pre>
  
  <p>}</p>
  
  <p>Here is the debug information:</p>
  
  <pre><code>04-05 17:36:49.635 28101-28691/com.androidapp.ptt I/System.out: SOCKET CLOSED!
  04-05 17:36:49.635 28101-28691/com.androidapp.ptt W/System.err: java.net.SocketException: Socket closed
  04-05 17:36:49.635 28101-28691/com.androidapp.ptt W/System.err:     at libcore.io.Posix.recvfromBytes(Native Method)
  04-05 17:36:49.635 28101-28691/com.androidapp.ptt W/System.err:     at libcore.io.Posix.recvfrom(Posix.java:142)
  04-05 17:36:49.640 28101-28699/com.androidapp.ptt I/System.out: 404:kukukukukukuku
  04-05 17:36:49.640 28101-28691/com.androidapp.ptt W/System.err:     at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
  04-05 17:36:49.640 28101-28691/com.androidapp.ptt W/System.err:     at libcore.io.IoBridge.recvfrom(IoBridge.java:499)
  04-05 17:36:49.640 28101-28691/com.androidapp.ptt W/System.err:     at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
  04-05 17:36:49.640 28101-28691/com.androidapp.ptt W/System.err:     at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
  04-05 17:36:49.645 28101-28691/com.androidapp.ptt W/System.err:     at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
  04-05 17:36:49.645 28101-28691/com.androidapp.ptt W/System.err:     at java.io.InputStream.read(InputStream.java:162)
  04-05 17:36:49.645 28101-28691/com.androidapp.ptt W/System.err:     at com.androidapp.ptt.ListenerService$2.run(ListenerService.java:439)
  04-05 17:36:49.645 28101-28691/com.androidapp.ptt W/System.err:     at java.lang.Thread.run(Thread.java:841)
  04-05 17:36:49.685 28101-28101/com.androidapp.ptt I/System.out: Service done!
  </code></pre>
  
  <p>Any help is much appreciated!</p>