java - Connection was forcibly closed by the remote host -
i have java.nio.channels.socketchannel in jscsi implamantation disconnecting when try open driver size greater 4gb. iscsi rfc says basicheadersegment.bhs_fixed_size may 48, position can read bytes on channel. java doc says 5 types of errors, app throwing last 1 doesn't specific information. 1 - notyetconnectedexception 2 - closedchannelexception 3 - asynchronouscloseexception 4 - closedbyinterruptexception 5 - ioexception
public final int read(final socketchannel schannel) throws internetscsiexception, ioexception, digestexception { // read basic header segment first determine total length of // protocol data unit. clear(); final bytebuffer bhs = bytebuffer.allocate(basicheadersegment.bhs_fixed_size); int len = 0; while (len < basicheadersegment.bhs_fixed_size) { int lens = schannel.read(bhs); if (lens == -1) { // channel closed @ target (e.g. target // not support multiple connections) // throw new closedchannelexception(); return lens; } len += lens; logger.trace("receiving through socketchannel: " + len + " of maximal " + basicheadersegment.bhs_fixed_size); } bhs.flip();
error:
java.io.ioexception: existing connection forcibly closed remote host @ sun.nio.ch.socketdispatcher.read0(native method) @ sun.nio.ch.socketdispatcher.read(socketdispatcher.java:43) @ sun.nio.ch.ioutil.readintonativebuffer(ioutil.java:223) @ sun.nio.ch.ioutil.read(ioutil.java:197) @ sun.nio.ch.socketchannelimpl.read(socketchannelimpl.java:379) @ org.jscsi.parser.protocoldataunit.read(protocoldataunit.java:417) @ org.jscsi.target.connection.targetsenderworker.receivefromwire(targetsenderworker.java:145) @ org.jscsi.target.connection.connection$targetconnection.receivepdu(connection.java:217) @ org.jscsi.target.connection.phase.targetfullfeaturephase.execute(targetfullfeaturephase.java:96) @ org.jscsi.target.connection.connection$targetconnection.call(connection.java:264) @ org.jscsi.target.connection.connection$targetconnection.call(connection.java:79) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:744) [pool-9-thread-1] info org.jscsi.target.connection
thanks in advance, felipe
your problem description incorrect. socketchannel isn't closed: connection is; , isn't happening when try open connection: happening when read it.
this results sending after peer has closed connection, in turn means had sent didn't understand.
Comments
Post a Comment