Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use NettyAsyncHttpProvider #101

Closed
johngray opened this issue May 9, 2012 · 3 comments
Closed

Cannot use NettyAsyncHttpProvider #101

johngray opened this issue May 9, 2012 · 3 comments

Comments

@johngray
Copy link

johngray commented May 9, 2012

Hello.

I have the following sample code:

   AsyncHttpClient asyncHttpClient = new AsyncHttpClient();

    try {

        final Response response = asyncHttpClient.prepareHead(getFullUrl(filePath)).execute().get();

        return response.getStatusCode();

    } catch (Exception e) {

        return 0;
    }

And it gives the following log output:

DEBUG com.ning.http.client.providers.netty.NettyAsyncHttpProvider: Number of application's worker threads is 8
DEBUG com.ning.http.client.providers.netty.NettyAsyncHttpProvider:
Non cached request
DefaultHttpRequest(chunked: false)
HEAD /milton_server/webdav/b/a/hatiko.mkv HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Accept: /
User-Agent: NING/1.0

using Channel
[id: 0x2f33cbcc, /127.0.0.1:52679]

DEBUG com.ning.http.client.providers.netty.NettyAsyncHttpProvider: Unexpected I/O exception on channel [id: 0x2f33cbcc, /127.0.0.1:52679 => localhost/127.0.0.1:8080]
java.nio.channels.ClosedChannelException
at org.jboss.netty.handler.stream.ChunkedWriteHandler.discard(ChunkedWriteHandler.java:168)
at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleDownstream(ChunkedWriteHandler.java:120)
at org.jboss.netty.channel.Channels.write(Channels.java:712)
at org.jboss.netty.channel.Channels.write(Channels.java:679)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:245)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.writeRequest(NettyAsyncHttpProvider.java:432)
at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:82)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:399)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:390)
at org.jboss.netty.channel.DefaultChannelFuture.setSuccess(DefaultChannelFuture.java:334)
at org.jboss.netty.channel.socket.nio.NioWorker$RegisterTask.run(NioWorker.java:187)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processRegisterTaskQueue(AbstractNioWorker.java:337)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:243)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

And after some time (during debugging session), this:

DEBUG com.ning.http.client.providers.netty.NettyAsyncHttpProvider: Unexpected I/O exception on channel [id: 0x2f33cbcc, /127.0.0.1:52679 :> localhost/127.0.0.1:8080]
java.lang.StackOverflowError
at sun.misc.Unsafe.compareAndSwapInt(Native Method)
at java.util.concurrent.atomic.AtomicBoolean.compareAndSet(Unknown Source)
at org.jboss.netty.handler.stream.ChunkedWriteHandler.flush(ChunkedWriteHandler.java:190)
at org.jboss.netty.handler.stream.ChunkedWriteHandler.flush(ChunkedWriteHandler.java:298)

And the last line is repeated several times.

The problem is, when I change provider to JDK everything works fine. But I cant use JDK provider because I wiil neen to upload really large files using the client and sun`s UrlConnetcion class is limited in this matter to approximetely 2GB.

Can somebody provide any help on this?

I am using Netty 3.4.3

@jfarcand
Copy link
Contributor

jfarcand commented May 9, 2012

OK filled

https://github.com/netty/netty/issues/315

Can you try with 3.4.4.Final and see if the issue has been fixed? Also please add your OS and the JDK version. Thanks

@johngray
Copy link
Author

johngray commented May 9, 2012

Linux 3.3.4-2-ARCH kernel

java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

I tried with 3.4.4 and now everything works!
I am dumb, everything I was need to do is just to check the lattest netty version. :)
Thanks. I hope this bug report will be valuable anyway.

@johngray johngray closed this as completed May 9, 2012
@jfarcand
Copy link
Contributor

jfarcand commented May 9, 2012

Thanks for the fast response. This bug is valuable and validated that the bug was fixed between 3.4.3 and 3.4.4. Thanks!

jfarcand added a commit that referenced this issue May 15, 2012
rlubke added a commit that referenced this issue May 15, 2012
rlubke added a commit that referenced this issue Jun 21, 2012
* ahc-1.7.x:
  Fix javadoc warnings.
  Integrate Grizzly 2.2.10.
  Fix for the Grizzly side of #101 : [websocket] onError must not be called when status code is != 101.
  Fix for #111 - [websocket] Both Netty and Grizzly issues with URI without port.
  Incremental fix for #101 [websocket] onError must not be called when status code is != 101. Fix Netty side
  Fix for #111 https://github.com/sonatype/async-http-client/issues/111
  Fix errror with clirr
  Port #102 tests
  Port fix for #102 [websocket] Support redirect
  Bump to the latest Netty release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants