Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Java7 Socket Closed Exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java7 Socket Closed Exception



To get the obvious questions out of the way first...
Are you closing your sockets when you're done with them?  Waiting/Hoping for garbage collection to reclaim your sockets for you is a bad idea...  (Symptoms would look just like what you're experiencing...).

Moises

On Jun 1, 2013, at 3:19 AM, Ben Spink <email@hidden> wrote:

> Just noticed this start happening with a particular client.  Things are great for a while, then suddenly all the sockets from the JVM fail to connect to the server for no apparent reason.
>
> The server is still online, the server isn't recognizing any incoming connections to it (log doesn't show a connection received), and the client machine from Terminal can telnet to the server port and get a connection (and the server logs the connection).
>
> ----------------------------------------------------------------------------
> Thu May 30 18:28:46 PDT 2013:java.net.SocketException: Socket closed
> Thu May 30 18:28:46 PDT 2013:java.net.PlainSocketImpl.socketConnect:-2
> Thu May 30 18:28:46 PDT 2013:java.net.AbstractPlainSocketImpl.doConnect:339
> Thu May 30 18:28:46 PDT 2013:java.net.AbstractPlainSocketImpl.connectToAddress:200
> Thu May 30 18:28:46 PDT 2013:java.net.AbstractPlainSocketImpl.connect:182
> Thu May 30 18:28:46 PDT 2013:java.net.SocksSocketImpl.connect:391
> Thu May 30 18:28:46 PDT 2013:java.net.Socket.connect:579
> Thu May 30 18:28:46 PDT 2013:java.net.Socket.connect:528
> Thu May 30 18:28:46 PDT 2013:java.net.Socket.<init>:425
> Thu May 30 18:28:46 PDT 2013:java.net.Socket.<init>:208
> Thu May 30 18:28:46 PDT 2013:com.crushftp.client.Common.getSocket:1122
> ----------------------------------------------------------------------------
>
> Line 1122 that has the exception occur is this:
>
> return new Socket(u.getHost(), u.getPort());
>
> So this socket is brand new, hasn't been touched or closed by another thread, etc.  I don't see any possibility in how this scenario can occur...yet it seems to reliably start failing after a few hours of running.  JVM isn't throwing OOM errors, or any other errors that I can see.
>
>
> This java client app is being run as a signed app from web start.  It makes connections regularly.
>
> This isn't the only stack trace with this issue either.  Another thread that also makes a HttpUrlConnection to the server has the same exception occur.
>
> ----------------------------------------------------------------------------
> Fri May 31 15:13:12 PDT 2013:serverSettingsRetriever:java.net.SocketException: Socket closed
> Fri May 31 15:13:12 PDT 2013:java.net.PlainSocketImpl.socketConnect:-2
> Fri May 31 15:13:12 PDT 2013:java.net.AbstractPlainSocketImpl.doConnect:339
> Fri May 31 15:13:12 PDT 2013:java.net.AbstractPlainSocketImpl.connectToAddress:200
> Fri May 31 15:13:12 PDT 2013:java.net.AbstractPlainSocketImpl.connect:182
> Fri May 31 15:13:12 PDT 2013:java.net.SocksSocketImpl.connect:391
> Fri May 31 15:13:12 PDT 2013:java.net.Socket.connect:579
> Fri May 31 15:13:12 PDT 2013:sun.security.ssl.SSLSocketImpl.connect:618
> Fri May 31 15:13:12 PDT 2013:sun.security.ssl.BaseSSLSocketImpl.connect:160
> Fri May 31 15:13:12 PDT 2013:sun.net.NetworkClient.doConnect:180
> Fri May 31 15:13:12 PDT 2013:sun.net.www.http.HttpClient.openServer:378
> Fri May 31 15:13:12 PDT 2013:sun.net.www.http.HttpClient.openServer:473
> Fri May 31 15:13:12 PDT 2013:sun.net.www.protocol.https.HttpsClient.<init>:270
> Fri May 31 15:13:12 PDT 2013:sun.net.www.protocol.https.HttpsClient.New:327
> Fri May 31 15:13:12 PDT 2013:sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient:191
> Fri May 31 15:13:12 PDT 2013:sun.net.www.protocol.http.HttpURLConnection.plainConnect:931
> Fri May 31 15:13:12 PDT 2013:sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect:177
> Fri May 31 15:13:12 PDT 2013:sun.net.www.protocol.http.HttpURLConnection.getOutputStream:1090
> Fri May 31 15:13:12 PDT 2013:sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream:250
> Fri May 31 15:13:12 PDT 2013:com.crushftp.Daemon.getCrushSyncPrefs:361
> ----------------------------------------------------------------------------
>
>
> Where line 361 is:
>
> OutputStream out = uric.getOutputStream();
>
> I have only had this reported from a client using OS X.  Multiple machines report the same error.  Its as if the JVM stops allowing outbound connections as the server doesn't see the attempts to reach it, and the exception indicates the socket its creating is already closed...
>
> It took 2 hours, 45 minutes roughly for this to occur on the last test.
>
> Any help on what I can do?
>
> Thanks,
> Ben
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Java-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Java7 Socket Closed Exception (From: Ben Spink <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.