java - Socket ends up in CLOSE_WAIT when using Jython -
i have run problems when utilize jython. have implemented web service can upload python scripts , utilize them info news feeds, etc..
the problem server leaking file descriptors. sockets ends in close_wait , never gets garbage collected. works until news feed down, server runs 'too many open files'.
in implementation, utilize org.python.util.pythoninterpreter, have been able reproduce through jyhton cli. (same problem occurs both version 2.5.3 , 2.7b2).
i've downloaded jython next url. http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/2.5.3/jython-standalone-2.5.3.jar
if run jython cli in 1 shell , @ socket states in another, can see ends in close_wait forever.
to reproduce:
$ java -cp jython-standalone-2.5.3.jar org.python.util.jython >>> import urllib2 >>> urllib2.urlopen('http://www.google.com/notfound') >>> urllib2.urlopen('http://www.google.com/notfound') >>> urllib2.urlopen('http://www.google.com/notfound') >>> urllib2.urlopen('http://www.google.com/notfound') >>> urllib2.urlopen('http://www.google.com/notfound')
to check sockets:
$ netstat -ant|grep close
would grateful if can help me find solution this.
i do not inquire close_wait means, how solve problem.
how can handle socket can close it.
have same problem jython version 2.7b2.
$ java -cp jython-standalone-2.7-b1.jar org.python.util.jython >>> import contextlib, urllib2 >>> u = 'http://www.google.com/notfound' >>> contextlib.closing(urllib2.urlopen(u)) x: >>> print x.read()
it means remote party has send fin tcp connection application yet respond closing socket.
java python sockets jython
No comments:
Post a Comment