I need to do few request to the same host for different pages. My first aproach was to create one NetSocket variable and use it for this host. But after five or six requests I've got the next excaption:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.silvertunnel_ng.netlib.layer.tor.stream.TCPStreamOutputStream.write(TCPStreamOutputStream.java:170)
at org.silvertunnel_ng.netlib.layer.tor.stream.TCPStreamOutputStream.write(TCPStreamOutputStream.java:166)
at org.silvertunnel_ng.netlib.layer.tor.stream.TCPStreamOutputStream.write(TCPStreamOutputStream.java:181)
at org.silvertunnel_ng.netlib.util.HttpUtil.request(HttpUtil.java:285)
at org.silvertunnel_ng.netlib.util.HttpUtil.get(HttpUtil.java:183)
at tor.TorCheck.download(TorCheck.java:142)
at tor.TorCheck.download(TorCheck.java:158)
at tor.TorCheck.main(TorCheck.java:118)
After this I changed my code to create new NetSocket instance per request to the same host.
It looks like you don't clean buffer and bufferFilled in TCPStreamOutputStream after request processing.
Regards, Max
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I need to do few request to the same host for different pages. My first aproach was to create one NetSocket variable and use it for this host. But after five or six requests I've got the next excaption:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.silvertunnel_ng.netlib.layer.tor.stream.TCPStreamOutputStream.write(TCPStreamOutputStream.java:170)
at org.silvertunnel_ng.netlib.layer.tor.stream.TCPStreamOutputStream.write(TCPStreamOutputStream.java:166)
at org.silvertunnel_ng.netlib.layer.tor.stream.TCPStreamOutputStream.write(TCPStreamOutputStream.java:181)
at org.silvertunnel_ng.netlib.util.HttpUtil.request(HttpUtil.java:285)
at org.silvertunnel_ng.netlib.util.HttpUtil.get(HttpUtil.java:183)
at tor.TorCheck.download(TorCheck.java:142)
at tor.TorCheck.download(TorCheck.java:158)
at tor.TorCheck.main(TorCheck.java:118)
After this I changed my code to create new NetSocket instance per request to the same host.
It looks like you don't clean buffer and bufferFilled in TCPStreamOutputStream after request processing.
Regards, Max
Hi Max,
the bufferFilled is set to 0 in the flush method which should be executed in the write method.
Are you running the requests threaded? Maybe this part is not threadsafe, can you show me an example code?
thanks and regards,
Tobi
Hi Tobi,
Here is the code I use:
Last edit: Tobias Boese 2016-02-28