Close socket hangs in SunOS5.6

The close() function is hanging when I attempt to close a socket. I have a small multi-threaded program, which I will attach below, which replicates the problem. Basically, the program creates a thread which listens for a datagram from a socket using the recvfrom() function. When the main thread attempts to close the socket being listened to, the close() function never returns. My guess is the recvfrom() function is doing some kind of blocking and somehow needs to be told to quit waiting. However, I'm not sure how one does this. Any ideas are greatly appreciated.
Sun tech. support recommended installing some patches we are missing. While that may ultimately be the solution, I would like to avoid doing so because this would affect multiple products we are developing and many of our customers.
The related portion of the code is:
main()
/* create thread using pthread_create() */
while (1) {
fgets(c, sizeof(c), stdin);
if (c[0] == '\n')
break;
fprintf(stderr, "Closing socket\n");
close(sockfd);
exit(0);
void wait_awhile(void) {
char buff[MAXLINE];
int n;
fprintf(stderr, "\nIN THREAD: prior to socket call\n");
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
fprintf(stderr, "could not create socket\n");
exit(0);
/* Get the server's socket address */
bzero((struct sockaddr_in *)&servaddr, sizeof(servaddr));
clientaddr_len = sizeof(struct sockaddr_in);
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(3500);
servaddr.sin_addr.s_addr = inet_addr(ip_address);
/* Bind it to the port */
fprintf(stderr, "IN THREAD: Binding socket\n");
if (bind(sockfd, (SA *) &servaddr, sizeof(servaddr)) < 0)
close(sockfd);
fprintf(stderr, "could not bind socket\n");
exit(0);
while (1)
fprintf(stderr, "IN THREAD: Waiting for datagram\n");
if ( (n = recvfrom(sockfd, buff, MAXLINE, 0, (SA *)&clientaddr, &clientaddr_len)) < 0)
close(sockfd);
}

"Shirley" <[email protected]> wrote:
>
"Khalid" <[email protected]> wrote:
We seem to have close wait problem in extreme load where apache/weblogic
hold the
tread so the socket cannot be closed. Does anyone know how to fix this
problem.
It seems like after in runs out of thread the server crashes.
Have you fixed this problem you were facing ,because we are facing exactly
the
same problem.Did you find any solution .If so please do let us know
Cheers
Shirley RemediosWe had the same problem and reduced the number of sockets in this state by reducing
the time to wait before closing the sockets. On Solaris we set 'tcp_time_wait_interval'
to 30000 (30 seconds) on the web and app servers.

Similar Messages

  • Server socket Hangs

    Hi,I am using the server socket in Java to listen on a port on a computer..
    I am using the windows platform
    I use ms vj++6.0
    I am facing a peculiar problem.
    about once in 10 messages received by my server socket,
    The server socket hangs .
    Hangs means it stops responding to the incoming message & so my application
    is unable to take any action.
    I used a port scanner & found that my server port is in a "close_wait"
    state.
    Can someone tell me the reason for this.
    is it a problem with my server or can the client that sends the message be
    also responsible for this type of an error.
    Heres the code for my server
    public server()
    try
    server = new ServerSocket(2156);
    serverthread = new Thread(this);
    serverthread.start();
    catch(Exception e)
    System.out.println("Cannot Start Thread" + e);
    public synchronized void run()
    try
    while(true)
    String line;
    System.out.println("listening for the client");
    fromclient = server.accept();
    System.out.println("client has responded");
    InputStreamReader isr = new
    InputStreamReader(fromclient.getInputStream());
    BufferedReader instream = new BufferedReader(isr);
    PrintWriter ostream = new PrintWriter(new
    BufferedOutputStream(fromclient.getOutputStream()));
    System.out.println("talking to the client\n");
    ostream.println("Hye Client");
    ostream.println("Bye");
    ostream.flush();
    System.out.println("listening to the client \n");
    String temp;
    int count=0;
    String ip="";
    while((line=instream.readLine())!=null)
    System.out.println(line+"\n");
    if (line.equals("Bye"))
    break;
    if (line.equals(""))
    continue;
    else
    System.out.println(line+"\n"); /*Print the line that has come in the
    socket*/
    ostream.close();
    fromclient.close();
    catch(Exception e)
    System.out.println("Cannot listen to the client" + e);
    I hope somebody can help me out .
    Thanx in advance
    Regards
    Sanket Gupta

    You don't seem to properly close the server socket any where. Here why don't you look at this skeleton. This may help you.
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class server
         static boolean listen = true;
         public static void main(String args[])
              try
                   ServerSocket ss = new ServerSocket(2156);
                   do
                        new serverThread(ss.accept()).start();
                   while(listen);
                   ss.close();
              catch(IOException e)
                   System.err.println(e.getMessage());
         public static void shutdown()
              listen = false;
    class serverThread extends Thread
         private Socket client;
         private String input;
         private BufferedReader in;
         private PrintWriter out;
         public serverThread(Socket c)
              client = c;
         public void run()
            try
              in = new BufferedReader(new InputStreamReader(client.getInputStream()));
              out = new PrintWriter(client.getOutputStream(),true);
              input = in.readLine();
              if(input.equals("Hello"))
                   out.println("How are you doing?");
              else if(input.equals("shutdown!"))
                   server.shutdown();
              else
                   out.println("Bad Request!");
              in.close();
              out.close();
              client.close();
            catch(IOException e)
                 System.err.println(e.getMessage());
    }

  • Write to socket hange the process

    Hi, my program uses sockets. All is fine, but when the other side suddenly shut downs, my process
    stays hung into the write system call. According to pStack, my process is also stuck on the
    close system call (Since it noticed that the other side was shut down). What happeded ? did the process entered some deadlock because trying to close a socket that is trying to write to it??
    I can't even receive any terminating signals, when normally I receive them with no problem.
    Please help!!!

    This is what I get, what do you get:
    java -server Loopback1000000 messages in 3004 ms
    1000000 messages in 2752 ms
    1000000 messages in 2706 ms
    1000000 messages in 2728 ms
    import java.io.*;
    import java.net.*;
    public class Loopback
        static final int PORT = 6666;
        public static void main(String args[])
         throws Exception
         new Listener().start();
         Socket socket = new Socket("localhost", PORT);
         DataOutputStream out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()));
         int count = 0;
         long start_time = System.currentTimeMillis();
         while (true) {
             out.writeBytes("hello world");
             out.flush();
             if (++count % 1000000 == 0) {
              long now = System.currentTimeMillis();
              System.out.println("1000000 messages in " + (now - start_time) + " ms");
              start_time = now;
        static class Listener
         extends Thread
         ServerSocket server_socket;
         Listener()
             throws IOException
             server_socket = new ServerSocket(PORT);
         public void run()
             try {
              while (true) {
                  Socket socket = server_socket.accept();
                  InputStream in = socket.getInputStream();
                  byte buf[] = new byte[8192];
                  while (true) {
                   if (in.read(buf) == -1)
                       break;
                  in.close();
                  socket.close();
             } catch (IOException e) {
              System.out.println("error in listener: " + e);
    }

  • Sockets write/close operations hangs application

    Hi!
    I've got a trouble with my web-application. It'a s chat system, that uses Keep-Alive connections for messages output and that recieves messages through another socket.
    Everything is fine with receiving messages. But after message is received, I need to send it to all recepients. So, I use Socket.write() method. If writing is failed, or user is logged off, I use Socket.close().
    Problem is, that sometimes Socket.write() and Socket.close() are blocking their threads.
    How can I avoid such a blocking behaviour?
    If I'll rewrite everything to use not sockets, but socket channels, can it help to solve my problem?
    Thanks.

    If writes are blocking it can only mean that readers aren't reading. Fix that, and forget about the syncrhonization suggestion which is nonsense.
    You can also use NIO in non-blocking mode to avoid blocking in writes, and it does lead to more scalable applications, but be prepared for about a 10x increase in complexity.

  • FMS proxying HTTP does not close sockets correctly?

    Hi,
    So, after waiting for a while, we decided to upgrade our streamers to FMS 3.5.3 and set them up to proxy HTTP requests to a lighttpd server instead of the "built in" Apache. With the previous version 3.5 of FMS, we had problems of FMS hanging up after a while and stopping relaying requests, generally a few hours, even when it did not serve a lot of requests. With version 3.5.3, we had great hopes that this problem had disappeared as we had FMS running for more than a month on a test server. So we did the upgrade and we encounter another problem:
    After less that one day of activity, our servers crashed for an unknown reason, almost at the same time. Analysing the logs, I saw out of memory messages, but how could two linux servers stop working in the same 5 minutes interval. I supposed there was a power failure of some sort. And I kept analysing because the sysadmins in the server room swore that they saw out of memory kernel panic on the consoles. After a bit of investigation, I found the reasons: the TCP connexions between FMS and the lighttpd server are stacking up and fill the OS network memory! Now, I don't know who is the culprit:
    FMS code does not manage correctly HTTP proxy sessions?
    lighttpd does not handle correctly HTTP proxying from FMS and does not close correctly the sessions?
    Our Ubuntu linux network stack is not correctly configured to manage so many connexions?
    Here are the details, any assistance is welcome!
    The servers: linux Ubuntu 8.04 with 8 GB RAM.
    FMS 3.5.3 proxying to lighttpd 1.4.19 listening on port 81. FMS and lighttpd are set up on the same server.
    The streamer receives many (> 10/s) HTTP requests from iPhones which are proxied to lighttpd. iPhones request partial content and lighttpd is well suited for these type of requests.
    Locking at the state of the TCP stack:
    # netstat -st
    IcmpMsg:
        InType3: 6
        InType8: 5501
        OutType0: 5501
        OutType3: 6
    Tcp:
        101662 active connections openings
        1192680 passive connection openings
        33 failed connection attempts
        177391 connection resets received
        1653 connections established
        73559682 segments received
        70196072 segments send out
        165137 segments retransmited
        0 bad segments received.
        37219 resets sent
    UdpLite:
    TcpExt:
        22 resets received for embryonic SYN_RECV sockets
        141884 packets pruned from receive queue because of socket buffer overrun
        2052 packets pruned from receive queue
        40293 TCP sockets finished time wait in fast timer
        801 time wait sockets recycled by time stamp
        711318 delayed acks sent
        2401 delayed acks further delayed because of locked socket
        Quick ack mode was activated 535 times
        68554 packets directly queued to recvmsg prequeue.
        11705 bytes directly in process context from backlog
        341070 bytes directly received in process context from prequeue
        5114830 packet headers predicted
        22083 packets header predicted and directly queued to user
        32542120 acknowledgments not containing data payload received
        25289961 predicted acknowledgments
        9191 times recovered from packet loss due to fast retransmit
        6222 times recovered from packet loss by selective acknowledgements
        Detected reordering 7 times using FACK
        Detected reordering 1 times using SACK
        Detected reordering 7 times using reno fast retransmit
        Detected reordering 9 times using time stamp
        15 congestion windows fully recovered without slow start
        42 congestion windows partially recovered using Hoe heuristic
        17 congestion windows recovered without slow start by DSACK
        16517 congestion windows recovered without slow start after partial ack
        51 TCP data loss events
        3916 timeouts after reno fast retransmit
        3372 timeouts after SACK recovery
        10048 timeouts in loss state
        9157 fast retransmits
        6 forward retransmits
        28990 retransmits in slow start
        30176 other TCP timeouts
        7656 classic Reno fast retransmits failed
        95 SACK retransmits failed
        2738020 packets collapsed in receive queue due to low socket buffer
        52 DSACKs sent for old packets
        52 DSACKs received
        3 connections reset due to unexpected data
        74950 connections reset due to early user close
        2846 connections aborted due to timeout
        TCP ran low on memory 10 times
        TCPDSACKIgnoredOld: 41
    IpExt:
    The last red line can be visualised below; sometimes the server crashes in out of memory kernel panic...
    And if you compare with previous behavior, you can tell when we did the upgrade to FMS 3.5.3...
    A few words on our previous configuration with FMS 3.5. To be able to accept HTTP requests, we have a front load balancer which is able to route HTTP requests to lighttpd and RTMP requests to FMS. But with this configuration, we don't benefit from the ability of FMS to fallback to RTMPT for clients behind a proxy or proxy ol' HTTP requests... With the previous configuration, we never had so many connections active simultaneously: we change from 200 max to more than 7000 with FMS 3.5.3 in proxy!
    Some figures on what exactly happens:
    # netstat -tn | grep :81 | awk '{print $6}' | sort | uniq -c
         20 CLOSE_WAIT
       2245 ESTABLISHED
       1236 FIN_WAIT1
          5 TIME_WAIT
    # netstat -tn
    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0 275841 127.0.0.1:81            127.0.0.1:45088         FIN_WAIT1
    tcp   562347      0 127.0.0.1:55150         127.0.0.1:81            ESTABLISHED
    tcp        0 225152 127.0.0.1:81            127.0.0.1:34856         ESTABLISHED
    tcp        0 238081 127.0.0.1:81            127.0.0.1:54310         FIN_WAIT1
    tcp        0 114433 127.0.0.1:81            127.0.0.1:51810         FIN_WAIT1
    tcp   670800      0 127.0.0.1:40746         127.0.0.1:81            ESTABLISHED
    tcp   597444      0 127.0.0.1:40654         127.0.0.1:81            ESTABLISHED
    tcp   592810      0 127.0.0.1:40669         127.0.0.1:81            ESTABLISHED
    tcp        0 103168 127.0.0.1:81            127.0.0.1:54544         ESTABLISHED
    tcp        0 201344 127.0.0.1:81            127.0.0.1:40567         ESTABLISHED
    tcp        0      0 10.1.74.30:1935         10.1.74.2:60372         ESTABLISHED
    tcp   665360      0 127.0.0.1:45282         127.0.0.1:81            ESTABLISHED
    tcp        0 210432 127.0.0.1:81            127.0.0.1:40662         ESTABLISHED
    tcp        0 207361 127.0.0.1:81            127.0.0.1:44895         FIN_WAIT1
    tcp        0 109825 127.0.0.1:81            127.0.0.1:52144         FIN_WAIT1
    tcp        0 221825 127.0.0.1:81            127.0.0.1:54844         FIN_WAIT1
    tcp        0 103168 127.0.0.1:81            127.0.0.1:40791         ESTABLISHED
    tcp   782301      0 127.0.0.1:55074         127.0.0.1:81            ESTABLISHED
    tcp        0 219137 127.0.0.1:81            127.0.0.1:45040         FIN_WAIT1
    tcp        0 209921 127.0.0.1:81            127.0.0.1:44837         FIN_WAIT1
    tcp   574170      0 127.0.0.1:45275         127.0.0.1:81            ESTABLISHED
    tcp        0 252033 127.0.0.1:81            127.0.0.1:54907         FIN_WAIT1
    tcp        0 254977 127.0.0.1:81            127.0.0.1:54515         FIN_WAIT1
    tcp        0 142977 127.0.0.1:81            127.0.0.1:52129         FIN_WAIT1
    In case this is needed, FMS configuration is almost out of the box:
    _defaultRoot_/Adaptor.xml:
    <HTTPTunnel>
                    <Enable>true</Enable>
                    <NodeID></NodeID>
                    <IdlePostInterval>512</IdlePostInterval>
                    <IdleAckInterval>512</IdleAckInterval>
                    <IdleTimeout>60</IdleTimeout>
                    <MimeType>application/x-fcs</MimeType>
                    <WriteBufferSize>16</WriteBufferSize>
                    <SetCookie>true</SetCookie>
                    <Redirect enable="false" maxbuf="16384">
                            <Host port="80">:8080</Host>
                            <Host port="443">:8443</Host>
                    </Redirect>
                    <HttpProxy enable="true" maxbuf="16384">
                            <Host port="80">${HTTPPROXY.HOST}</Host>
                    </HttpProxy>
                    <NeedClose>true</NeedClose>
                    <MaxWriteDelay>20</MaxWriteDelay>
                    <MinWriteDelay>12</MinWriteDelay>
                    <MaxHeaderLineLength>1024</MaxHeaderLineLength>
    </HTTPTunnel>
    I've tried changing lighttpd configuration to handle KeepAlive session or not, it has no influence on the behaviour.
    If you spot a configuration mistake or have any idea, I'm ready to test it as soon as possible... Asa?
    Thanks

    Has this been fixed? What was done?
    We have been having the same issue. We worked on it with Adobe support and thought it might have been fixed with a "patched" version of FMS that was created to solve the problem. However, we still see the issue (recently we had a huge increase in load due to an annual event).
    Over time, when we run netstat, we see Apache connections (127.0.0.1:88134) stuck in a FIN_WAIT_1 state while the corresponding FMS processes (127.0.0.1:1025 to 5000) are in an ESTABLISHED state. It appears as though the connection is closed from the http proxy side while FMS doesn't acknowledge the close.
    We notice this behavior seems related to load. High load = connections getting hung more frequently. The only fix seems to be restarting the FMS service which restarts the embedded apache as well.
    I'm curious if you found a fix or even a workaround to help you cope with these connections. Even something to close them periodically would be a huge help. So far, we're resorting to an automatic restart of the server ever 2 days which is hardly a proper production solution.
    I would really appreciate any information you could provide with regards to your particular problem and whether or not it's been solved.
    An example (just a snippet) of the netstat monitor we have running each hour on the half-hour:
      Proto  Local Address          Foreign Address        State
      <snip FMS to Apache>
      TCP    127.0.0.1:2847         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2848         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2849         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2850         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2851         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2853         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2854         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2855         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2856         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2857         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2858         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2859         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2860         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2861         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2862         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2863         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2864         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2865         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2866         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2867         127.0.0.1:8134         ESTABLISHED
      TCP    127.0.0.1:2868         127.0.0.1:8134         ESTABLISHED
      </snip FMS to Apache>
      <snip Apache to FMS (corresponding entries)>
      TCP    127.0.0.1:8134         127.0.0.1:2847         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2848         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2849         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2850         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2851         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2853         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2854         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2855         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2856         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2857         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2858         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2859         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2860         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2861         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2862         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2863         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2864         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2865         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2866         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2867         FIN_WAIT_1
      TCP    127.0.0.1:8134         127.0.0.1:2868         FIN_WAIT_1
      </snip Apache to FMS>
    This particular log shows all ports between 1024 and 5000 in the same state as above. A restart resets all the connections and the process starts over. From my investigation, Apache seems to be acting properly. It tries to be a 'good citizen' and issue a graceful close that goes unacknowledged by FMS. Unfortunately, Apache doesn't go back to check a connection it considers closed, so they connection remains half-closed.
    Please, please let me know if you found anything out. Information on the web is scarce and I'm at my wit's end!

  • StreamReader from TCP Socket Hanging...I think

    Hello all, and thank you in advance for any and all help. Allow me to start out by apologizing as I have only been programming Java for about 3 days now, however I am a bit stuck and have spent about 5 hours trying to figure out what could be my problem here.
    I have written an app that connects to a usenet server and pulls that list of groups from the server, however it seems as if the BufferedReader doesn't have a large enough buffer to hold the response from ther server. I can save the output of the log from putty during the LIST command and I recieve 108897 lines of text (about 5 mb in total) however in my Java app it gets to line #108598 and hangs. I have tried messing with the buffer sizes of the StreamReader as well as the Socket, and if I try to set the buffer size of the BufferedReader {+bufferedreader(stream,int)}+ It won't compile.
    Well here is the code, and again, i apologize if this is sloppy/not correct coding practices. I am new at Java.
        private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                     
        try {
            String data = "";
            Socket skt = new Socket("127.0.0.1", 119);
            BufferedReader in = new BufferedReader(new InputStreamReader(skt.getInputStream()));
            while (!in.ready()){}
            data = in.readLine();
            //log.append(data.toString() + "\n");
            Scanner sc = new Scanner(data);
            int command = sc.nextInt();
            if (command == 200) {
                log.append("Connection established to" + sc.nextLine() + "\n");
                log.append("Sending Log-in Credentials \n");
                PrintWriter out = new PrintWriter(skt.getOutputStream(), true);
                out.println("AUTHINFO USER " + txtUser.getText());
                while (!in.ready()){}
                data = in.readLine();
                sc = new Scanner(data);
                command = sc.nextInt();
                if (command == 381) {
                    out.println("AUTHINFO PASS " + txtPass.getText());
                while (!in.ready()){}
                data = in.readLine();
                sc = new Scanner(data);
                command = sc.nextInt();
                if (command == 281) {
                    log.append("Successfully logged in \n");
                    log.append("Getting list of active groups \n");
                    out.println("list");
                    while (!in.ready()){}
                    data=in.readLine();
                    Writer output = null;
                    File outfile = new File("c:/data/groups.txt");
                    output = new BufferedWriter(new FileWriter(outfile));
                    output.write(data + "\n");
                    out.println("Date");
                    int i = 0;
                    while ( i != 108897) {
                        data = in.readLine();
                        output.write(data + "\n");
                        i += 1;
        catch (Exception ex) {
            System.out.print(ex.getMessage());

    while (!in.ready()){}Remove that. It's just burning CPU. The following readLine() will block until the line arrives.
    while (!in.ready()){}Ditto.
    while (!in.ready()){}Ditto.
    while (!in.ready()){}Ditto.
    while ( i != 108897) {
    data = in.readLine();At this point (and every other readLine()) you must check for data == null, which is EOS, and break, and close the stream, if you get it.

  • Crystal report close button hangs the application

    Dear All,
    I am working on 2005 B PL 46. we have developed an application to open a particular crystal report when a button is pressed in AR Invoice form. this works fine and the data is loaded properly. The problem is, when I close this report, this hangs the entire application and I have to kill the exe from the task manager then only I can go back to SAP. (one of the oldest problem we encountered with crystal report-SDK). this does not happen always. it does close the report 5 times out of 10 without hanging the application.one more thing is, if I debug the application with pressing F11, it never hangs the application and woks fine.
    The report is getting loaded in the Crystalreport Viewer control dragged on a windows form. any one has any idea? I have tried this on 2007 B version PL 08 and the same problem persists with lesser frequency.
    Thanks,
    Binita

    Yes Vasu. and on form close event of that windows's form, I am writing :
    System.Windows.Forms.Application.ExitThread()
    any idea?
    thanks,
    Binita

  • Socket  Hangs in KnockKnock

    Lots of research on forums, FAQs, tutorials and I'm still getting slammed by Java Socket applications. Ultimately I am trying to connect to a Skype instance to record but can't get the published examples to work. I'm running XP.
    I went back to the Java tutorials and tried EchoClient and KnockKnockServer. Each compiles but EchoClient (modified to use "localhost" and either port 7 or 4444) gives a "Connection refused: connect" error and KnockKnock hangs on the socket.accept statement. I have turned off my windows firewall, listed the programs as exceptions for the firewall. Doesn't seem to matter. I checked Norton Antivirus and can't find any settings that might be a problem.
    I downloaded thread dumps for the KnockKnock. The CompilerThread0 and SignalDispatcher were "waiting on condition", Finalizer is waiting on ReferenceQueue$Lock and ReferenceHandler is waiting on a Reference$Lock
    One other datapoint. In NetBeans I tried to "attach a debugger.." SocketAttach;localhost;4444 or 4447 or 4449. The Output- Debugger Console says: "Attaching to localhost: 4444. Connection refused."
    Writing threaded java using SQL queries was a lot easier than this. Is there something simple I'm doing wrong?
    Thanks

    EchoClient (modified to use "localhost" and either port 7 or 4444) gives a "Connection refused: connect" errorThat means nothing is listening at the host:port you specified. The host has to be the name of the host the server is running in and the port needs to be the port it is listening at.
    and KnockKnock hangs on the socket.accept statement.That means that nobody has tried to connect to the correct host:port.
    Moral: get the port correct in the server, and the host and port correct in the client.
    You probably think you've already done that, but I'm afraid the evidence is against you ...

  • Illustrator will not close, just hangs

    This has been going on for a while now. Using CS3 Illustrator and after working one several files and finally closing all the files to exit, Illustrator hangs, eventually showing a "No Response". Only way to close it now is to task manager to end process. Am using Vista Home Pro, Core2 Quad, 3gb memory. Thanks in advance.

    Dell precision workstation, 2Gb ram, Illustrator CS3.
    Illustrator hangs when I try to close the application. Illustrator hangs all applications frequently when running simultaneously with Illustrator (Photoshop especially). The computer will try to re-draw the screen and the menus will turn white, being unable to redraw. Clicking on any window may cause menus to vanish, deepening the hang, and the screen will freeze in a semi-drawn state. This may resolve itself in a minute or two, but it may also hang forever until I force quit.
    The hang is very likely to happen when using RAM to paste an element from one program into another, say from Illustrator to Photoshop.
    When it gets really bad, a restart may clean things up for a while, until I run Illustrator again, that is. Even after closing Illustrator, hanging problems will persist until I restart. It always starts with Illustrator, though. Illustrator seems to grab all the RAM and not let go, even after closing.
    This also happened with Illustrator CS, and pretty much ever since we switched from Win NT. I think it has to do with the way Adobe applications share the RAM in an XP environment. It seems to be, as Dan Olech says "deep within the program", and as a result, less fun to fix than making up new filters.
    Glad I'm not alone.

  • Firefox doesn't close but hangs in the background after closing it using up excessive memory up to 2gb.

    When Firefox 8 loses connection to certain websites and I have to close it from the lower taskbar, it hangs in the background on task manager using excessive memory even after it is closed. I have seen it use up to 2gb of memory while closed but still hanging in the background in task manager. My computer slows down and when I try to open another browser window the little loading icon goes around and around so I check to see what is making it so slow. It is always firefox 8 hanging in the background using memory. I have 8gb of ddr2 memory on this 64 bit computer it shouldn't be slowing down because of a browser bug but it does.

    From what I have been reading from other posts on this forum, the
    issue may be caused by the clear history settings.
    Press the '''<Alt>''' or '''<F10>''' key to bring up the tool bar.
    Followed by;
    Windows; '''Tools > Options'''
    Linux; '''Edit > Preferences'''
    Mac; ''application name'' '''> Preferences'''
    Then '''Privacy'''.
    The button next to '''History''', select '''Use Custom Settings'''.
    At the bottom of the page, turn on '''Clear History When Firefox Closes.'''
    At the far right, press the '''Settings''' button. Turn on ONLY '''Cache''' and
    '''Form And Search History''' leaving the others off.
    This is not a cure but will make it easier if Firefox locks up.
    '''https://support.mozilla.org/questions/997866?esab=a&s=&r=1&as=s''' {web link}

  • Sockets hang using PrintWriter and BufferedReader

    Solaris 2.7, and Java 1.2.2
    My thread is passed a new socket = s. I then assign:
    InputStreamReader isr = new InputStreamReader(s.getInputStream());
    BufferedReader br = new BufferedReader(isr);
    PrintWriter pw = new PrintWriter(s.getOutputStream());
    The client program then sends records. If each record has only a "\r" then
    the program fails. If the client sends a "\n" or "\r\n" then the program
    works fine.
    The documentation for BufferedReader states that it looks for a "\r" or a
    "\n" or a "\r\n".
    I don't get any indication that there is a problem other than the hang.
    Upon Connect...
    Server> send("0000\n")
    client> recv("0000\n")
    client> send("0001\r")
    Server> recv("0001")
    Server> send("0002\n")
    client> recv -- nothing...
    Server> recv paused...
    I have run truss on this process and it shows that nothing is sent on the last server send above. When the client gives up (e.g. timeout) the the send completes as truss sees it.
    Is this a bug in 1.2.2. or a documentation error?

    use flush()!!

  • How to close socket, if attempting to accpet clients?

    How do I close the socket if .accept is attempting to try to accept clients:
    //Wait for the acceptance from a client
    clientSocket = serverSocket.accept();
    //In the main thread: User wants to disconnect from chat room
    try{clientSocket.close();}catch(Exception e){ }
    //this is dis-allowed, and throws an exception, how can i get around this?

    After who (client or server) closes what socket? and tries to reconnect what?
    If you close the ServerSocket, future connects will fail.
    If you close the client (accepted) socket, the client will read an EOS condition.
    If you try to open a new ServerSocket on the same port without closing the old one, you will get a BindException.
    As I have no idea what you're actually doing I can't help any further. Post the (reduced to minimal) code and the stack trace, and show which line of code is incurring the exception.

  • Close socket on closing window in JSP.

    Hi,
    I want to send a command to the backend server from my webserver to close the socket connection when the user closes the window. can any one help how to determine when a window is closed in JSP.
    Thank you.

    I'm presuming you have a login, and on that successful login, you start this socket thing and put some reference in the session.
    So what you do, no matter what else, is have this reference object that holds the socket or whatever implement HttpSessionBindingListener. And for that interface, you implement the valueUnbound() method so that when the item is removed from the session, it'll close the socket and do whatever other clean up.
    This will always be invoked then when the session is invalidated, either by session timeout or by explicit log out (which should explicitly call session.invalidate()).
    Then, if you decide to try to overlay some extra thing on your web site to try to catch the user leaving the site or exiting the browser, if it works, great. If not, you're still covered.

  • Sockets hanging ?!?

    Hi.
    I am experiencing a strange problem.
    If I send a message to the following piece of code I get it only once unil I do not restart the sending program again. How can I keep receiving messages keeping this functionality?
    10x in advance
    try {                          
    InetAddress serverInet = InetAddress.getLocalHost();
    ServerSocket = new ServerSocket(hostPort,50,serverInet);
    } catch (IOException e) {
    System.err.println("Could not listen on port: "+hostPort);
    System.exit(1);
    Socket clientSocket = null;
    while (true) {
    try
         try {
         clientSocket = serverSocket.accept();
         } catch (IOException e) {
         System.err.println("Accept failed");
              System.exit(1);
    // code doing this
    open new Socket // tcp connection
    read/write from it
    close it
    } catch (Exception e) {
         e.printStackTrace();
    }

    You must spawn a new thread in order to accomplish concurrent processing of client sockets. This is if you're using a version of the platform pre-j2sdk1.4.0
    With this latest version, there is the notion the select() functionality. This promises improved performance over the thread-per-client model that has been required until now.
    Check out the latest JDK(1.4.0), specifically, the java.nio.* classes.
    Hope this helps,
    - Phil

  • Socket.shutdownOutput() closes socket inside JVM

    Dear friends,
    We have a java class which uses the Socket class. Our class does a Socket.shutdownOutput() to indicate that the sending of data is over and the reply may start. It works just fine outside Oracle, but when the class is loaded in the database the shutdownOutput() method apparently causes the socket to be closed. Below is a sample of the code and its output. The user has JAVAUSERPRIV and JAVASYSPRIV granted, and I even tried JAVA_ADMIN without success. The Oracle versions tested were 10.2.0.1 (Windows) and 10.2.0.2 (AIX). Does anybody know what can be happening ? Thanks in advance.
    Code:
    Socket sockICM = new Socket("192.168.1.133", 5010);
    byte byxml[] = hmapICM.toXMLString().getBytes();
    System.out.println("1");
    InputStream isXmlOut = sockICM.getInputStream();
    sockICM.getOutputStream().write(byxml);
    System.out.println("1.5");
    sockICM.shutdownOutput();
    System.out.println("socket.isOutputShutdown(): " + sockICM.isOutputShutdown());
    System.out.println("socket.isClosed(): " + sockICM.isClosed());
    System.out.println("2");
    byte b[] = new byte[1000];
    InputStream isXmlOut = sockICM.getInputStream();
    System.out.println("3");
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    System.out.println("4");
    try
    int q;
    while((q = isXmlOut.read(b)) != -1)
    bos.write(b, 0, q);
    System.out.println("leu: " + bos.toString());
    catch(Exception io){
    System.out.println("err=" + io.toString());
    Output:
    1
    1.5
    socket.isOutputShutdown(): true
    socket.isClosed(): false
    2
    3
    4
    err=java.net.SocketException: Socket is closed
    /****************************************************/

    Thank you for the answer, Kuassi, I am going to do that. One more piece of information is that my printStackTrace shows the following:
    java.net.SocketException: Socket is closed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at java.net.SocketInputStream.read(SocketInputStream.java:90)
    at kiman.socktest.test(socktest:76)
    Do you know what does the "Native Method" on second line mean ? I think my problem
    is related to that somehow.

Maybe you are looking for

  • Essbase SSO Token with OBIEE 11g

    Has anyone had success is setting up SSO token security in OBIEE 11g for Essbase. I have followed the steps in the documents of 11.1.1.x and still am not getting users to authenticate against the cube I am using. When I log in as one of those users,

  • Need to find BAPI_PROJECT_MAINTAIN in ES Service Registry

    I need to do some testing with BAPI_PROJECT_MAINTAIN. What's the equivalent Enterprise Services Workplace function WSDL? How do I find this for testing?

  • Event job with dbms_scheduler after dml on table

    is is possible to start an event job using dbms_schduler every time a record is inserted or updated in a table? After a dml statement that job has to start an external command (a shell script). In few words, a dml statment can be the event?

  • Hub 3 queries

    Although I am signed up for FON and accepted by FON my HUB3 still states "BT Fon not active on your BT Hub" ? While trying to correct the above and upgrade password my Broadband username changed  on my HUB3 and I can't change it/revert to the origina

  • XMLDataSet Filter

    This should be simple, but I just can't find the answer at the moment. I am trying to apply a filter to a spry table using a XMLDataSet by selecting a value in a Spry validation select. The XMLdata that drives the table is as follows var ds2 = new Sp