Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

selector - java.io.IOException: Unable to establish loopback connection java.net.BindException Address already in use: bind

I am running a long time selector test on the windows7 system on the eclipse console.After 12 hours, so much select.open have been done seccessfully times by times, it,the 'selector.open()', suddenly throws the following excetption:

java.io.IOException: Unable to establish loopback connection
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:125)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:69)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.ch.PipeImpl.<init>(PipeImpl.java:141)
at sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50)
at java.nio.channels.Pipe.open(Pipe.java:150)
at sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:126)
at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44)
at java.nio.channels.Selector.open(Selector.java:227)
at cn.scut.chiu.weibocrawler.job.JobManager.initIO(JobManager.java:55)
at cn.scut.chiu.weibocrawler.job.JobManager.<init>(JobManager.java:50)
at cn.scut.chiu.weibocrawler.distributed.worker.Worker.doCommandJob(Worker.java:80)
at cn.scut.chiu.weibocrawler.distributed.NodeBase.writeOp(NodeBase.java:186)
at cn.scut.chiu.weibocrawler.distributed.NodeBase.selectOp(NodeBase.java:87)
at cn.scut.chiu.weibocrawler.distributed.worker.Worker.run(Worker.java:63)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:344)
at sun.nio.ch.Net.bind(Net.java:336)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:199)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:91)
... 15 more

And my question is that what has happened to the program? And how to fix it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Why do you keep creating Selectors? Maybe you're leaking them? In any case you should use one Selector for as long as possible, not keep creating new ones.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...