Multithreaded socket writer

This is what I have: a multithreaded C++ app on solaris/sparc with multiple threads writing to a single socket descriptor: write(global_fd, data, len).
On the other side of the connection I receive the stream. Writer threads have no mutex when they write(). It seems to be working fine, but I want to make sure that it's ok to do, and no data messup going to happen. Thx, Go-Sha

On the 'C++' side the write() call is atomic, so at first glance that's OK as long as messages are written in a single write(). However a 'C' write isn't guaranteed to write everything presented to it, so that condition can't be guaranteed.
On the Java side: (i) the writes aren't atomic in the first place; (ii) OutputStream.write() loops until all data is written; (iii) the native code performs copying between the Java byte[] array and a local native char[] array, in quantums that you can't control. So you have to arrange synchronization yourself.
So interleaving is possible at both ends.

Similar Messages

  • Design question for database connection in multithreaded socket-server

    Dear community,
    I am programming a multithreaded socket server. The server creates a new thread for each connection.
    The threads and several objects witch are instanced by each thread have to access database-connectivity. Therefore I implemented factory class which administer database connection in a pool. At this point I have a design question.
    How should I access the connections from the threads? There are two options:
    a) Should I implement in my server class a new method like "getDatabaseConnection" which calls the factory class and returns a pooled connection to the database? In this case each object has to know the server-object and have to call this method in order to get a database connection. That could become very complex as I have to safe a instance of the server object in each object ...
    b) Should I develop a static method in my factory class so that each thread could get a database connection by calling the static method of the factory?
    Thank you very much for your answer!
    Kind regards,
    Dak
    Message was edited by:
    dakger

    So your suggestion is to use a static method from a
    central class. But those static-methods are not realy
    object oriented, are they?There's only one static method, and that's getInstance
    If I use singleton pattern, I only create one
    instance of the database pooling class in order to
    cionfigure it (driver, access data to database and so
    on). The threads use than a static method of this
    class to get database connection?They use a static method to get the pool instance, getConnection is not static.
    Kaj

  • Seeburger sFTP receiver adapter error: Socket Write Error, EOF Received

    Hello experts,
    We have a sFTP to sFTP scenario for which we are getting below error every time the scenario is executed.
    Error Messages are as follows:
    Put File: Could not connect to remote host, Reason: Unexpected termination; software caused connection abort; socket write error[unknown cause].
    Sometimes below error occurs :
    Put File: Could not connect to remote host, Reason: EOF received from remote side [unknown cause].
    Every time after restart of sFTP adapter on XI box, failed messages are sent successfully to receiver sFTP server.
    There is no error for sender sFTP channel. This error occurs only for the receiver sFTP channel.
    On receiver sFTP side, we are using Public key-private key authentication.
    Can anyone please let me know what could be the cause of connection failure. ?
    Thanks a lot in advance!
    (I searched many threads on SDN but could not find anything relevant to this particular situation, so posting a separate question.)
    Minal

    Thanks Naveen for the reply..
    I missed to mention that we are working on XI3.0 with SP19 and seeburger sFTP is 1.7.4
    Looks like key exchange is working properly as after every restart of adapter all failed messages are processed successfully..
    It is observed that if there is an idle time of 8-10 hours between last data transfer and current data transfer then this error occurs.
    We have increased connection timeout and transmission timeout parameters also for sFTP properties in visual admin.
    Thanks,
    Minal
    Edited by: Minal Vaidya on Oct 5, 2011 8:46 AM

  • Urgent helep: socket write error

              Hi All,
              My application is continuously writing the following error message to the domain
              log of WLS eventhough app is running ok
              javax.servlet.ServletException: Connection aborted by peer: socket write error
                   <<no stack trace available>>
              My major concern is that,it will fill up the heap soon.
              Did anybody run into similar issue?
              Thanks in advance.
              RC
              

    Please do not cross-port.
              RC wrote:
              > Hi All,
              > My application is continuously writing the following error message to the domain
              > log of WLS eventhough app is running ok
              >
              > javax.servlet.ServletException: Connection aborted by peer: socket write error
              > <<no stack trace available>>
              >
              > My major concern is that,it will fill up the heap soon.
              > Did anybody run into similar issue?
              > Thanks in advance.
              >
              > RC
              Rajesh Mirchandani
              Developer Relations Engineer
              BEA Support
              

  • JCOM throwing SocketException: Connection reset by peer: socket write error

    I have an ejb which is calling a simple ActiveX component using JCOM.
    Ocassionally the ejb loses the ability to connect to the ActiveX component. Any attempt to call a method results in a java.net.SocketException: Connection reset by peer: socket write error.
    However the ActiveX component continues to run correctly. I can still connect to it using a vb test client. This is using com to connect, not DCOM as used by JCOM(JIntegra).
    The application server and the ActiveX component are running on the same server.
    Any suggestions as to why the JIntegra DCOM request could be failing?
    Thanks,
    Greg.

    I have an ejb which is calling a simple ActiveX component using JCOM.
    Ocassionally the ejb loses the ability to connect to the ActiveX component. Any attempt to call a method results in a java.net.SocketException: Connection reset by peer: socket write error.
    However the ActiveX component continues to run correctly. I can still connect to it using a vb test client. This is using com to connect, not DCOM as used by JCOM(JIntegra).
    The application server and the ActiveX component are running on the same server.
    Any suggestions as to why the JIntegra DCOM request could be failing?
    Thanks,
    Greg.

  • Simple Webserver SocketException: socket write error

    I'm stuck and need some help solving this problem.
    When I try to get the 404 message with the webserver, I get this in the output console:
    "HttpRequest - java.net.SocketException: Connection reset by peer: socket write error"
    I have found the part that makes the problem, but I can't find a solution.
    I hope someone can help me with this!
                try
                    outputStream.writeBytes(entityBody);
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public final class WebServer
        public static void main(String[] args) throws Exception
            //Port number
            int port = 8080;
            // Establish the listen socket.
            ServerSocket webSocket = new ServerSocket(port);
            // Process HTTP service requests in an infinite loop.
            while(true)
                // Listen for a TCP connection request
                Socket tcpSocket = webSocket.accept();
                HttpRequest httpRequest = new HttpRequest(tcpSocket);
                Thread thread = new Thread(httpRequest);
                thread.start();
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class HttpRequest implements Runnable
        final static String CRLF = "\r\n";
        private Socket socket;
        private String path = "public_html/";
        public HttpRequest(Socket socket)
            this.socket = socket;
        public void run()
            try
                processReguest();
            catch(Exception ex)
                System.err.println(ex);
        private void processReguest() throws Exception
            // Get a reference to the socket's input and output streams.
            InputStreamReader inputReader = new InputStreamReader(socket.getInputStream());
            DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream());
            BufferedReader buffReader = new BufferedReader(inputReader);
            String requestLine = buffReader.readLine();
            System.out.println();
            System.out.println(requestLine);
            String headerLine = null;
            while((headerLine = buffReader.readLine()).length() != 0)
                System.out.println(headerLine);
            // Extract the filename from the request line
            StringTokenizer tokens = new StringTokenizer(requestLine);
            tokens.nextToken();
            String fileName = tokens.nextToken();
            //Prepend a "." so that the file request is within the current directory
            fileName = path + "." + fileName;
            //Open the request file
            FileInputStream fileInputStream = null;
            boolean fileExists = true;
            try
                fileInputStream = new FileInputStream(fileName);
            catch(FileNotFoundException ex)
                fileExists = false;
            //Construct the response message.
            String statusLine = null;
            String connection = null;
            String contentLength = null;
            String contentTypeLine = null;
            String entityBody = null;
            String contentType = contentType(fileName);
            if(!requestLine.startsWith("GET") && !requestLine.startsWith("HEAD"))
                statusLine = "HTTP/1.0 405 Method Not Allowed" + CRLF;
                contentLength = "Content-Length: 0" + CRLF;
                connection = "Connection: close" + CRLF;
                contentTypeLine = "Content-type: " + "text/html" + CRLF;
                entityBody = "<HTML><HEAD><TITLE>405 - Method Not Allowed</TITLE></HEAD><BODY>405 - Method Not Allowed</BODY></HTML>";
                fileInputStream = null;
                fileExists = false;
            else if(fileExists && !contentType.equals("application/octet-stream"))
                statusLine = "HTTP/1.0 200 OK" + CRLF;
                contentTypeLine = "Content-type: " + contentType(fileName) + CRLF;
                connection = "Connection: close" + CRLF;
                contentLength = "Content-Length: " + Integer.toString(fileInputStream.available()) + CRLF;
            else if(fileExists && contentType.equals("application/octet-stream"))
                statusLine = "HTTP/1.0 415 Unsupported Media Type" + CRLF;
                contentLength = "Content-Length: 0" + CRLF;
                connection = "Connection: close" + CRLF;
                contentTypeLine = "Content-type: " + "text/html" + CRLF;
                entityBody = "<HTML><HEAD><TITLE>415 - Unsupported Media Type</TITLE></HEAD><BODY>415 - Unsupported Media Type</BODY></HTML>";
                fileInputStream = null;
                fileExists = false;
            else
                statusLine = "HTTP/1.0 404 Bad Request" + CRLF;
                contentLength = "Content-Length: 0" + CRLF;
                connection = "Connection: close" + CRLF;
                contentTypeLine = "Content-type: " + "text/html" + CRLF;
                entityBody = "<HTML><HEAD><TITLE>404 - Not Found</TITLE></HEAD><BODY>404 - Not Found</BODY></HTML>";
            // Send the status line
            outputStream.writeBytes(statusLine);
            // Send the connection status
            outputStream.writeBytes(connection);
            // Send the Content-Length
            outputStream.writeBytes(contentLength);
            // Send the content type line
            outputStream.writeBytes(contentTypeLine);
            //Send a blank line to indicate the end of the header lines.
            outputStream.writeBytes(CRLF);
            // Send the enity body
            if(fileExists)
                //Den här funkar??
                sendBytes(fileInputStream, outputStream);
                fileInputStream.close();
            else
                try
                    outputStream.writeBytes(entityBody);
                catch(SocketException ex)
                    System.out.println(ex);
            socket.close();
            inputReader.close();
            outputStream.close();
            buffReader.close();
        private void sendBytes(FileInputStream fileInputStream, DataOutputStream outputStream) throws IOException
            //Construct a 1k buffer to hold bytes on their way to the socket
            byte[] buffer = new byte[1024];
            int bytes = 0;
            // Copy request file inte socket's output stream
            while((bytes = fileInputStream.read(buffer)) != -1)
                outputStream.write(buffer,0, bytes);
        private String contentType(String fileName)
            if(fileName.endsWith(".htm") || fileName.endsWith(".html"))
                return "text/html";
            else if(fileName.endsWith(".jpg") || fileName.endsWith(".jpeg"))
                return "image/jpeg";
            else if(fileName.endsWith(".gif"))
                return "image/gif";
            else if(fileName.endsWith(".png"))
                return "image/png";
            else if(fileName.endsWith(".txt"))
                return "text/plain";
            return "application/octet-stream";
    }

    You've told the client that the content length is zero bytes so I presume it closes the connection as soon as it finishes receiving headers. It depends what client you're using of course but that seems reasonable behaviour...

  • Two Socket errors: Socket write and Socket reset

    does anyone know the reasons and remedies for the error
    java.net.SocketException: Software caused connection abort: socket write error
    and
    java.net.SocketException: Connection reset by peer: socket write error
    please reply if someone knows
    thanks

    These are basically the same error triggered in different places.
    This occurs when the other end of the connection closes while the client is still writing to it.

  • Socket write error

    Java.net.SocketException; connection reset by peer. socket write error
    Java.SQLException; cannot open anymore tables.
    I am getting this error when i'm using Tomcat 3.3 server. I am using servlet classes and access database.This error comes in 1-2 days and then it shows an sql exception that it cannot open any more tables. I am using an access database thru an ODBC datasource.
    The problem is solved when tomcat is restarted.
    If anybody knows the solution pl.let me know, anita

    Thanks 4 ur response. I am connecting to the database through JDBC which in turn uses an ODBC data source. The connection has been declared as global and is thus supposed to exist till the servlet is not destroyed.
    We r using an access D/B which is inturn accessed through ODBC.
    So it is not restarted or disturbed.
    Pl. help

  • Persistent socket connection - socket write error

    I'm connecting to a server using sockets. My application acts like a client, sending requests, and also like a server, listenning for notifications. I was using a client socket for the first task (send a message when required) and a server socket for the second (permanently listen for incoming messages). This needs to be some kind of persistent connection.
    It happens now I'm required to send and receive using the same port. The only way I found to do this is to have a single socket (client) bound to a certain port. It connects to the server and one thread keeps listenning for incoming messages (by reading the input stream) while another process is launched whenever I need to send a message (by writing to the socket's output stream). The socket is created only once (when the application starts) and its output/input streams reused whenever needed.
    This works well for a while. However, when I try to send a message after some idle time (lets say 20 minutes) strange things happen. The first attempt to send a message returns success (although nothing is actually received by the server). The second attempt returns java.net.SocketException: Software caused connection abort: socket write error. I don't understand this behaviour. Can there be a timeout? I only write to the socket after testing if it's connected.. So why is this failing? Also, any other ideas on how to send and receive using the same port? A different and better approach maybe..
    Thanks in advance

    Socket.isConnected just tells you whether you have personally called Socket.connect() or new Socket(host, port,...). It doesn't tell you anything about the state of the connection.
    You should certainly issue periodic application 'pings' at suitable intervals, and many application protocols do this. For example, Java RMI reuses connections that are less than 15 seconds old but only if they pass a ping test.
    In general however you can't insist on a persistent connection over TCP/IP, especially if you have this kind of hardware in the circuit. What you can do is recognize when the connection has been lost and form a new one. The network is going to fail somewhere some time and your program has to be robust against that.

  • Random "socket write error"

    Hello,
    We are running CF 9.01 standard on IIS 6 (Windows server 2003) on mutiple servers.
    I've noticing a few instances of these errors on every server, almost on a daily bases:
    10/28 13:32:26 error Error while reading header HTTPREFERER
    java.net.SocketException: Software caused connection abort: socket write error
          at java.net.SocketOutputStream.socketWrite0(Native Method)
          at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    NOTE: the header name can be anything, but the stack always starts like this.
    A few times, yesterday for example, a server can suddenly show tons of these errors and then it becomes unresponsive, with queued CFM requests. Only a restart of the service frees this condition.
    Our CFM pages perform a lot of CFHTTP calls, 99% of the time to localhost; in any case the local network is very solid. At the same time CFM is having these issues other pages, for example .NET pages, work perfectly.
    any insight? this problem is affecting our production website. thanks!

    I think, this is nothing to do with Oracle or Ur applications.
    It is totally N/W issue. Contact the N/W support.

  • Oracle Application Server crashes due to Socket Write Error

    I am using Oracle Application Server 9.0.3. Simple JSP application is running on it. We are using the application server connection pooling functionality. Following errors are occuring on it frequently and it causes the application server crash.
    First application response gets slow and eventually application server gets lock and it wont respond and we have to restart the application server. Our application is in production mode and we need to solve this issue immediately.
    ----------------Error1---------------------
    com.evermind.server.http.HttpIOException: Connection aborted by peer: socket write error
         at com.evermind.server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:249)
         at com.evermind.server.http.EvermindJSPWriter.writeOut(EvermindJSPWriter.java:424)
         at com.evermind.server.http.EvermindJSPWriter.jspflush(EvermindJSPWriter.java:341)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:490)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:415)
         at schedule.schedulehome._jspService(_schedulehome.java:542)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:560)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:479)
    ------------Error2---------------------
    com.evermind.server.http.HttpIOException: Connection aborted by peer: socket write error
         at com.evermind.server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:249)
         at com.evermind.server.http.EvermindJSPWriter.writeOut(EvermindJSPWriter.java:424)
         at com.evermind.server.http.EvermindJSPWriter.jspflush(EvermindJSPWriter.java:341)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:490)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:415)
         at schedule.schedulehome._jspService(_schedulehome.java:557)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:560)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:479)

    I am using Oracle Application Server 9.0.3. Simple JSP application is running on it. We are using the application server connection pooling functionality. Following errors are occuring on it frequently and it causes the application server crash.
    First application response gets slow and eventually application server gets lock and it wont respond and we have to restart the application server. Our application is in production mode and we need to solve this issue immediately.
    ----------------Error1---------------------
    com.evermind.server.http.HttpIOException: Connection aborted by peer: socket write error
         at com.evermind.server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:249)
         at com.evermind.server.http.EvermindJSPWriter.writeOut(EvermindJSPWriter.java:424)
         at com.evermind.server.http.EvermindJSPWriter.jspflush(EvermindJSPWriter.java:341)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:490)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:415)
         at schedule.schedulehome._jspService(_schedulehome.java:542)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:560)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:479)
    ------------Error2---------------------
    com.evermind.server.http.HttpIOException: Connection aborted by peer: socket write error
         at com.evermind.server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:249)
         at com.evermind.server.http.EvermindJSPWriter.writeOut(EvermindJSPWriter.java:424)
         at com.evermind.server.http.EvermindJSPWriter.jspflush(EvermindJSPWriter.java:341)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:490)
         at com.evermind.server.http.EvermindJSPWriter.write(EvermindJSPWriter.java:415)
         at schedule.schedulehome._jspService(_schedulehome.java:557)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:560)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:479)

  • In AIR 3.x, a socket write()+flush() on a client will hang app if peer adverts TCP ZERO WINDOW

    In AIR 3.x, a socket write() + flush() on a client will hang (and freeze the entire app) if the socket peer advertises a ZERO TCP Window, i.e. no space available in peer receiver's socket buffer.
    AIR on Windows insists that the developer flush() the socket in order to write (any data at all).  When the peer (receiver) advertises a 0 byte tcp window, the client flush() call can sometimes take 10 seconds (i.e. 10000 milliseconds), whereas normally it should take 10 to 50 milliseconds.
    Additionally, AIR stayed in hung position.  Since the socket had TCP KEEPALIVE option enabled (at the server), the socket stayed open.  I let it stay hung overnight.  The next day when I rebooted the server, the socket got closed and finally the AIR program "RETURNED FROM the sock.flush()" call.  A timestamp before and after the call to flush() showed that the flush() call was in hung state for 56472475 milliseconds, i.e. 15.7 hours!  After it returned from the flush() call the AIR app was responsive and seemed to work properly.  Thus proving that it was indeed stuck (or blocked) on the flush() call for 15 hours trying to drain the data to a socket with zero tcp window condition.
    A tcp zero window condition on 1 socket hanging an entire app sounds concerning.
    Solution Suggestions:
    (1) What is needed is for the OutputProgress event to include a field for 'bytes that can be written safely without blocking on the socket', i.e. 'space available in underlying platform socket buffer' which would account for the socket send buffer size.
    (2) An alternative solution would be for AIR to provide a write-timeout setsockopt (or a writeTimeout() method on the socket), and return flush with an error (or EWOULDBLOCK), and call the OUTPUTPROG event only when there is enough space available.
    If there are any other workarounds, please let me know.
    Thank you.

    Question:  Does Adobe AIR expose the getsockopt() and setsockopt() calls on a socket?  It would be useful to apps to tune the io buffer sizes.
    Additional Details:
    RTT = 100+ milliseconds
    TCP Window Scaling enabled
    Secure Socket
    Hard to reproduce with plain TCP socket, but occurs without fail with SecureSocket.  Not knowing the underlying code base, am wondering if it is because the SSL encryption overhead (bytes) throws off the buffer available size compution in secure_sock.flush() .
    Thanks.

  • Rmi - connection aborted:socket write error

    Weblogic 5.1 is running on my localhost and a remote object successfully registered on the weblogic. There is an applet trying to establish a connection and after the client is registered in the client list I get the following exception
    Thu Jan 25 11:29:06 PST 2001:<E> <ServletContext-General> Servlet failed with Ex
    ception
    java.net.SocketException: Connection aborted by peer: socket write error
    at java.net.SocketOutputStream.socketWrite(Native Method)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
    at weblogic.servlet.internal.ChunkUtils.writeChunks(ChunkUtils.java:88)
    at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutput
    StreamImpl.java:121)
    at weblogic.servlet.internal.ServletOutputStreamImpl.writeStream(Servlet
    OutputStreamImpl.java:444)
    at weblogic.servlet.ClasspathServlet.sendResource(ClasspathServlet.java:
    114)
    at weblogic.servlet.ClasspathServlet.doGet(ClasspathServlet.java:87)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:105)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:742)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:686)
    at weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
    ContextManager.java:247)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
    a:361)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    And the java console shows this message:
    java.lang.NoClassDefFoundError
    at weblogic/rmi/extensions/BasicRequest.init (BasicRequest.java)
    at weblogic/rmi/extensions/BasicRequest.<init> (BasicRequest.java:18)
    at weblogic/rmi/extensions/AbstractRemoteObjectReference.getRequest (AbstractRemoteObjectReference.java:71)
    at weblogic/jndi/internal/RemoteContextFactoryImpl_WLStub.getContext (RemoteContextFactoryImpl_WLStub.java:77)
    at weblogic/jndi/WLInitialContextFactoryDelegate.newRemoteContext (WLInitialContextFactoryDelegate.java:316)
    at weblogic/jndi/WLInitialContextFactoryDelegate.newContext (WLInitialContextFactoryDelegate.java:242)
    at weblogic/jndi/WLInitialContextFactoryDelegate.getInitialContext (WLInitialContextFactoryDelegate.java:205)
    at weblogic/jndi/Environment.getContext (Environment.java:122)
    at weblogic/jndi/Environment.getInitialContext (Environment.java:105)
    at weblogic/rmi/Naming.getContext (Naming.java:225)
    at weblogic/rmi/Naming.lookup (Naming.java:67)
    at AppletTest.init (AppletTest.java:30)
    at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java)
    at com/ms/applet/AppletPanel.securedCall (AppletPanel.java)
    at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
    at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
    at com/ms/applet/AppletPanel.run (AppletPanel.java)
    at java/lang/Thread.run (Thread.java
    Can someone help solve this problem.
    Thansk in advance,
    Nirmal R.

    The point where the failure occurs in in the initialization of the transaction framework, so I would guess that you do not have the plug-in for the applet.
    Nirmal R wrote:
    Weblogic 5.1 is running on my localhost and a remote object successfully registered on the weblogic. There is an applet trying to establish a connection and after the client is registered in the client list I get the following exception
    Thu Jan 25 11:29:06 PST 2001:<E> <ServletContext-General> Servlet failed with Ex
    ception
    java.net.SocketException: Connection aborted by peer: socket write error
    at java.net.SocketOutputStream.socketWrite(Native Method)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
    at weblogic.servlet.internal.ChunkUtils.writeChunks(ChunkUtils.java:88)
    at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutput
    StreamImpl.java:121)
    at weblogic.servlet.internal.ServletOutputStreamImpl.writeStream(Servlet
    OutputStreamImpl.java:444)
    at weblogic.servlet.ClasspathServlet.sendResource(ClasspathServlet.java:
    114)
    at weblogic.servlet.ClasspathServlet.doGet(ClasspathServlet.java:87)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:105)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:742)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:686)
    at weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
    ContextManager.java:247)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
    a:361)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    And the java console shows this message:
    java.lang.NoClassDefFoundError
    at weblogic/rmi/extensions/BasicRequest.init (BasicRequest.java)
    at weblogic/rmi/extensions/BasicRequest.<init> (BasicRequest.java:18)
    at weblogic/rmi/extensions/AbstractRemoteObjectReference.getRequest (AbstractRemoteObjectReference.java:71)
    at weblogic/jndi/internal/RemoteContextFactoryImpl_WLStub.getContext (RemoteContextFactoryImpl_WLStub.java:77)
    at weblogic/jndi/WLInitialContextFactoryDelegate.newRemoteContext (WLInitialContextFactoryDelegate.java:316)
    at weblogic/jndi/WLInitialContextFactoryDelegate.newContext (WLInitialContextFactoryDelegate.java:242)
    at weblogic/jndi/WLInitialContextFactoryDelegate.getInitialContext (WLInitialContextFactoryDelegate.java:205)
    at weblogic/jndi/Environment.getContext (Environment.java:122)
    at weblogic/jndi/Environment.getInitialContext (Environment.java:105)
    at weblogic/rmi/Naming.getContext (Naming.java:225)
    at weblogic/rmi/Naming.lookup (Naming.java:67)
    at AppletTest.init (AppletTest.java:30)
    at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java)
    at com/ms/applet/AppletPanel.securedCall (AppletPanel.java)
    at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
    at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
    at com/ms/applet/AppletPanel.run (AppletPanel.java)
    at java/lang/Thread.run (Thread.java
    Can someone help solve this problem.
    Thansk in advance,
    Nirmal R.

  • "endpoint" encountered a socket write error.

    Blazesds: 3.0.0.544
    Flex:flex sdk 3
    Sever-side: 1. managing the accepted MessageClient.
    2. broadcasting the received message to every client.
    3. all the communication via streaming channel.
    After several about 20 clients connected to the server, a warning message popped out.
    'Endpoint with id'my-streaming-amf' is closing the streaming connection to FlexClient with id'xxxx' because endpoint encountered a socket write error, possibly due to an unreponsive FlexClient.
    Actually, nobody closed the client.
    My question is when the session was destroyed.
    a. no session timeout, caused the channel was lasted for about 2 seconds before it was interrupted.
    b. all the test was done in the inner network(LAN).
    c. this issue can be reproduced all the time.

    This is the warning that is at a point being given:
    Endpoint with id 'xxx-streaming-amf' is closing the streaming connection to FlexClient with id '3CFBFCA1-DC1D-FEDF-A70D-A08A520892CF' because endpoint encountered a socket write error, possibly due to an unresponsive FlexClient.
    Tried debugging things, but it seems as certain clients fail to completely subscribe to messages from the server and the Login remote call also seems to never even get to the server. Because of this, the loading dialog that is displayed during the authentication process, never gets removed ( since no reseponse from the server ever comes back ). This is really frustrating and there is no information anywhere that could shed some light on this problem.

  • Socket write error(code=10053)

    Ive seen many many messages on the newsgroup board about this error. I havnt seen any solutions. It randomly happenes a random amount of time. Can you tell me the problem and a way to fix it?
              

    Hi,
    Might be related to the following post Re: Exception "Socket write error" with large BLOB Which release of JDBC drivers are you using? Try using the latest JDBc jars ( ojdbc14.jar).
    Kuassi

Maybe you are looking for