| |
| |
| |
|
Page: 1 2 3 4 5
Comments:
<0> are you closing each connection ? <1> server has been running fine for years ... <1> i think the problem started when we upgraded to java 1.5 <0> I mean are you closing the connection each time a connection is over ? <0> in your source.. what does your exception part say ? <1> and yes we are closing sockets ...even set linger time to 0 to see if it solves the issue <0> you have any exceptions ? <1> yes <0> put it <0> here. <2> is recursion and "ok" way to do file searchs on a given directory ? <0> vsDude: could be. <1> }catch (SocketTimeoutException sto){ <1> retry++; // this is to count how long client has been idle <1> } finally { <1> removeClient();
<1> } <2> are there other ways ? i cant seem to find any <0> if an exception is thrown,, why not close the connection ? <1> removeclient has the closing socket part <1> mySocket.shutdownInput(); <0> ok <1> mySocket.shutdownOutput(); <1> mySocket.close(); <0> try sto.printStackTrace() after retry++ <0> and paste the exception here. <1> client is supposed to be closed after retry reaches a certain limit <0> Orpheus: you making any progress with Gnu/Linux installation reading ? ;-) <1> btw ... <1> when server is working fine ... there are no CLOSE_WAIT sockets in netstat <0> CLOSE_WAIT is just another fancy name for waiting for the sockets to be closed. <2> the thing is, i wrote a recursive method to do file search, works fine. Now, i want to put it in a runnable but i seem to be stuck. I need to somehow notify the caller that the search is over and that results may be retrieved. <0> vsDude: avoid threads if you can. <1> I know ... the output from netstat is the same for last hour or so after the server stopped accepting responses <2> really ? i just dont want to slow down the rest of the app... <0> threads are good if you want to fork multiple processes and there is always a danger of locking up if you code it wrongly. <1> what might cause serversocket to now accept new connections? besides closing or throwing an exception? <0> it's hard to know without looking at source. <1> now = not <1> while(listening){ <1> try{ <1> <1> Socket temp = server.accept(); <1> <1> SocketHandler client = new SocketHandler(this,temp); <1> client.start(); <1> <1> }catch(Exception t){ <1> System.out.println("LoungeServer: problem with ServerSocket or creating a socket handler"); <1> t.printStackTrace(System.out); <1> } <1> } <1> System.out.println("LoungeServer: not listening anymore"); <1> this is server code <0> where is your listen() ? <1> beleive it ot not, exception was never thrown <2> Is there another way to do the search without blocking the main thread ? <1> server = new ServerSocket(); <1> server.setReuseAddress(true); <1> server.bind(new InetSocketAddress(listenPort),100); <1> u mean this part? <0> Where are you running this code ? <0> http://java.sun.com/j2se/1.4.2/docs/api/java/net/InetSocketAddress.html#InetSocketAddress(java.lang.String,%20int) <1> ? <0> new InetSocketAddress("IP_ADD", int port); <1> I have this server.bind(new InetSocketAddress(listenPort),100); <0> each time you are creating new InetSocketAddress, you are not giving it an IP address! <1> no no <1> my mistake .. <1> the last 3 lines are called once .. prior to the loop <0> what IP address are you trying to bind it to ? <1> but when u asked about the listen() part ... i thought u wanted me to post the part where I bind the server socket <1> localhost <0> try this server.bind(new InetSocketAddress("127.0.0.1",listenPort),100); <1> the server works perfectly... it only stopps acceptign connections for reasonse that are unknown after running for a few days <1> doesnt seem to be related to memory ... <0> the system must have rebooted..lol
<1> nor is it a deadlock because the server keeps servecing those that are still connected .. <1> doesnt seem like the system reached the FD limit <0> what about maximum number of connections ? <1> there is nothing on the java community website or bug website <1> it reached 300 concurrent conenctions with no problems ... <1> but when problem occurs ... it doesnt seem to be related to the number of connected people ... there is no specific number <0> why not move your removeClient() part inside finally { } instead ? <1> however, we notice it when the number of connections is around 300 <1> it is inside finally <0> as i said, move the removeClient() method's contents to finally { //here } and then write a for loop in your client to simulate 1000 connections. <0> ??? <1> will this make a difference? <0> Trying will not harm.. <0> when you run out of ideas, exhaustive coding will help. <1> I understand the simulaiton .. <0> writing your client is easy (will take 10-15 minutes max) <1> but moving content of a method doesnt seem to make any difference .. <0> what's your removeClient() ?? post it here <1> cause eitherway ..the same code will be called ... there are no scopr issues here to make me think that this will make a difference <0> since you don't want the source to be seen, I can't help you. <0> put the whole source at rafb.net <0> the server part. <0> or Server cl*** if you prefer <0> ? <1> http://rafb.net/paste/results/W0H3a929.html <1> im afraid its too big :) <1> been developing the system for the past 5 years <0> mySocket.shutdownOutput(); what's that doing ? <0> and mySocket.shutdownInput(); as well. <1> closes this <1> outStream = new DataOutputStream(mySocket.getOutputStream()); <1> it used to be outStream.close() <0> why did you remove that then ? <1> but thought I'd use this function that was introduced in 1.4 to see if it helps with the CLOSE_WAIT sockets staying there <1> its the same <1> problem was there in either case :) <0> all streams are supposed to be closed( ) no matter waht. <0> that's your problem there. <1> yes ... this functoin closes it <0> you have obvioulsy not closed it. that's why it's left in hanging connection. <1> ok <0> put the source. <0> put the mySocket.shutdownOutput(); source here <1> will try it and see hoe things go <1> one sec .. <1> http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html <1> shutdownoutput will be there <0> As I said, you are suppose to move all the contents of close() to finally { //here }. every connection will close no matter what. <1> thank u <0> yeah.. but why not use close() instead? I don't understand.. you are serving someone something and then when it is done, just use close ( ) <1> I will <0> ok <0> goodluck <1> the function might be doing something other than what I was expecting <1> thank u .. and thank u for your time <0> no prob. <1> but just incase someone else comes with a similar problem ... <1> this might be a bug <1> I'll let u know if the change fixes the problem <0> maybe. ok. <0> I don't go to using newer versions as soon as they are released.. <0> i just wait. ;~P <3> Hello <3> No Java expert here ? <1> I'll keep that in mind :D <3> I didn't understand you C[_] <0> xNokia: don't worry abt it. ;-) <2> starsky, would you have any suggestions to give me ? I mean, as it is right now, the recusive search method is not in a thread anymore, works ok, but im thinking of what would happen if there are many files to search through <0> vsDude: use loop. <3> starsky thanks <3> anyone can help here with Java Secure Socket Extension ?! <0> vsDude: start at your parent directory and check the file according to how you want it to be checked (e.g., if it is a directory => f.isDirectory() ).. etc.. <0> xNokia: you could go to other server.. no one here seems to be interested in helping you. ;) <4> !ping
Return to
#java or Go to some related
logs:
Xzistent #mirc #php #linux dvd writer problems mandriva #php how to enable dvi output linux teh 3r2k fsoap Issa Dante
|
|