You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jo...@apcc.com on 2009/12/17 18:20:49 UTC

java.net.SocketInputStream.socketRead0

Hi,

I'm using commons-httpclient-3.0.1, jre 1.6.0_16.  I have a situation 
where I'm using the HttpClient to do a get, and the call hangs. The thread 
has hung at java.net.SocketInputStream.socketRead0.  I've set the socket 
timeout at two points:
default timeout:
MultiThreadedHttpConnectionManager.getParams().setSoTimeout(60 * 1000);
method timeout:
GetMethod.getParams().setSoTimeout(30 * 1000);

This bug is tough to reproduce, but I have a system in this state. Getting 
the heap dump, I double checked the value of the socket timeout, and it is 
still set to 30 seconds, as expected.

I'm sorry if this is the wrong place to post (considering the issue seems 
to be in java.net.SocketInputStream), but I wanted to see if anyone had 
come across this situation.

Thanks,

Thread dump:
    "Scheduler worker 2119 - Data Collect [192.168.7.19]" daemon id=94405 
RUNNABLE (priority = 5) (block count = 9) (wait count = 0)

     - java.net.SocketInputStream.socketRead0(Native Method)
     - java.net.SocketInputStream.read(Unknown Source)
     - java.io.BufferedInputStream.fill(Unknown Source)
     - java.io.BufferedInputStream.read1(Unknown Source)
     - java.io.BufferedInputStream.read(Unknown Source)
     - 
org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:181)
     - java.io.FilterInputStream.read(Unknown Source)
     - 
org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)
     - java.util.zip.InflaterInputStream.fill(Unknown Source)
     - java.util.zip.InflaterInputStream.read(Unknown Source)
     - java.util.zip.GZIPInputStream.read(Unknown Source)
     - java.io.FilterInputStream.read(Unknown Source)
     - com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:362)
     - com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:110)
     - com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:84)
     - 
com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
     - com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
     - 
com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4626)
     - 
com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3701)
     - 
com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3647)
     - 
com.ctc.wstx.sr.BasicStreamReader.getTextLength(BasicStreamReader.java:858)
     - 
com.netbotz.server.services.sensor.impl.CollectionXmlParser.parseValue(CollectionXmlParser.java:453)
     - 
com.netbotz.server.services.sensor.impl.CollectionXmlParser.parseStruct(CollectionXmlParser.java:560)
     - 
com.netbotz.server.services.sensor.impl.CollectionXmlParser.parseValue(CollectionXmlParser.java:441)
     - 
com.netbotz.server.services.sensor.impl.CollectionXmlParser.parseVariable(CollectionXmlParser.java:202)
     - 
com.netbotz.server.services.sensor.impl.CollectionXmlParser.parse(CollectionXmlParser.java:121)
     - 
com.netbotz.server.services.sensor.impl.DataCollectionTaskImpl.collect(DataCollectionTaskImpl.java:260)
     - 
com.netbotz.server.services.sensor.impl.DataCollectionTaskImpl.collect(DataCollectionTaskImpl.java:149)
     - 
com.netbotz.server.services.sensor.impl.DataCollectionJob.doWork(DataCollectionJob.java:150)
     - 
com.netbotz.server.services.scheduler.AbstractSchedulerJob$Worker.run(AbstractSchedulerJob.java:179)
     - com.netbotz.threadsched.ThreadPool$1.doJob(ThreadPool.java:184)
     - com.netbotz.threadsched.Job.run(Job.java:50)
     - 
com.netbotz.threadsched.ThreadPoolExecutor$ThreadWorker.run(ThreadPoolExecutor.java:166)
     - java.lang.Thread.run(Unknown Source)

Heap dump:
Object at 0x7fa495a44dc8
instance of java.net.SocksSocketImpl@0x7fa495a44dc8 (177 bytes)

Class:
class java.net.SocksSocketImpl

Instance data members:
CONNECTION_NOT_RESET (I) : 0
CONNECTION_RESET (I) : 2
CONNECTION_RESET_PENDING (I) : 1
address (L) : java.net.Inet4Address@0x7fa497a57be0 (40 bytes)
anyLocalBoundAddr (L) : java.net.Inet4Address@0x7fa46ce2b2b0 (40 bytes)
applicationSetProxy (Z) : false
closePending (Z) : false
cmdIn (L) : <null>
cmdOut (L) : <null>
cmdsock (L) : <null>
external_address (L) : <null>
fd (L) : java.io.FileDescriptor@0x7fa495963360 (20 bytes)
fd1 (L) : <null>
fdLock (L) : java.lang.Object@0x7fa4959d0458 (16 bytes)
fdUseCount (I) : 1
lastfd (I) : -1
localport (I) : 56050
port (I) : 1080
port (I) : 80
resetLock (L) : java.lang.Object@0x7fa4959d0470 (16 bytes)
resetState (I) : 0
server (L) : <null>
serverSocket (L) : <null>
shut_rd (Z) : false
shut_wr (Z) : false
socket (L) : java.net.Socket@0x7fa497a57c80 (39 bytes)
socketInputStream (L) : java.net.SocketInputStream@0x7fa4a1ba42e0 (58 
bytes)
timeout (I) : 30000
trafficClass (I) : 0
useV4 (Z) : false

Re: java.net.SocketInputStream.socketRead0

Posted by Oleg Kalnichevski <ol...@apache.org>.
John.O'Leary@apcc.com wrote:
> Hi,
> 
> I'm using commons-httpclient-3.0.1, jre 1.6.0_16.  I have a situation 
> where I'm using the HttpClient to do a get, and the call hangs. The thread 
> has hung at java.net.SocketInputStream.socketRead0.  I've set the socket 
> timeout at two points:
> default timeout:
> MultiThreadedHttpConnectionManager.getParams().setSoTimeout(60 * 1000);
> method timeout:
> GetMethod.getParams().setSoTimeout(30 * 1000);
> 
> This bug is tough to reproduce, but I have a system in this state. Getting 
> the heap dump, I double checked the value of the socket timeout, and it is 
> still set to 30 seconds, as expected.
> 
> I'm sorry if this is the wrong place to post (considering the issue seems 
> to be in java.net.SocketInputStream), but I wanted to see if anyone had 
> come across this situation.
> 

John,

Please note the socket timeout is the maximum period of inactivity 
between two consecutive data packets. If the server sends a packet every 
30 seconds the connection will never time out.

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org