Hi All,
I'm using jetty client(jetty-client-7.4.5.v20110725)as http client to download html pages, but find that jetty client has socket fd leak issue.
When jetty client download a URL which domain can not be resolved, it will leak a socket fd, such as URL "
http://com.br/".
It will throw an UnresolvedAddressException:
[05 Sep 2011 11:10:55] [main] [Slf4jLog.java:80] [DEBUG] EXCEPTION
java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:30)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:487)
at org.eclipse.jetty.client.SelectConnector.startConnection(SelectConnector.java:99)
at org.eclipse.jetty.client.HttpDestination.startNewConnection(HttpDestination.java:265)
at org.eclipse.jetty.client.HttpDestination.doSend(HttpDestination.java:552)
at org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:490)
at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:178)
at cn.vobile.colander.Crawler.Crawler.addCrawlRequest(Crawler.java:138)
at cn.vobile.colander.Crawler.Crawler.main(Crawler.java:438)
[05 Sep 2011 11:10:56] [main] [Slf4jLog.java:50] [WARN] CONNECTION FAILED
CrawlExchange@1309073=GET//
com.br:80/#9
Then, a socket fd leaked, just like the following fd:
$ lsof -p 4499|grep sock
java 4499 sunjw 41r sock 0,6 0t0 151513 can't identify protocol
java 4499 sunjw 42r unix 0xf4ffc700 0t0 151855 socket
java 4499 sunjw 43r sock 0,6 0t0 151515 can't identify protocol
Is there any method of http client to close these socket(s)?
Thanks.