Hi Jerome,

My environment is as follows:
OS: Windows XP Pro SP2
JVM:
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

Regards,

Jerome Louvel wrote:
Hi Bruce,

Thanks for the reporting this new issue. I've entered a formal report:

"NPE during NIO SelectableChannel.register"
http://restlet.tigris.org/issues/show_bug.cgi?id=603

As it looks like a JVM bug, it would be very useful if you could indicate
your OS, JVM version on the report.
Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : news [mailto:[EMAIL PROTECTED] De la part de Bruce Lee
Envoyé : vendredi 26 septembre 2008 18:39
À : discuss@restlet.tigris.org
Objet : Re: Random Grizzly IOException

Hi Jerome,

I downloaded the Restlet 1.1 RC2 and although it seems to be much better than before, under running the test with Jmeter, there is still exceptions being thrown. The exception is as follows:
SEVERE: An exception occured writing the response entity
java.lang.NullPointerException
at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableC
hannel.java:180)
        at
java.nio.channels.SelectableChannel.register(SelectableChannel.java:254)
at org.restlet.util.ByteUtils$NbChannelOutputStream.doWrite(ByteUtils.java:261) at org.restlet.util.ByteUtils$NbChannelOutputStream.write(ByteUtils.java:294)
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
        at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116)
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:203)
        at java.io.Writer.write(Writer.java:140)
at org.restlet.resource.StringRepresentation.write(StringRepresentation.java:21
0)
at org.restlet.resource.StreamRepresentation.write(StreamRepresentation.java:68
)
at com.noelios.restlet.http.HttpServerCall.writeResponseBody(HttpServerCall.jav
a:491)
at com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:429
)
at com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java
:388)
at com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148) at com.noelios.restlet.ext.grizzly.HttpParserFilter.execute(HttpParserFilter.ja
va:78)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolCh
ain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.jav
a:67)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56
)
        at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)
Sep 26, 2008 12:35:53 PM com.noelios.restlet.LogFilter afterHandle

Regards,

Bruce Lee wrote:
Hi Jerome,

Thanks a lot for the timely fix! I'll be looking forward to test out the 1.1RC2.

Regards,

Jerome Louvel wrote:
Hi Bruce,

Thanks a lot for sharing this test class. It helped me to fix the remaining NIO exception that occured when the main selector was exhausted. Now a new temporary selector is properly registered and selected. Your test class works flawlessly!

Please check in the upcoming 1.1 RC2.

Best,
Jerome


Jerome Louvel a écrit :
Hi Bruce,

I've just fixed the Grizzly/NIO exception that occurred on Linux "Resource temporarily unavailable). This solves an issue that was reported by several
persons and that we were experiencing as well.

I suggest that you try again when 1.1 RC2 is released. Hopefully soon now.

Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

-----Message d'origine-----
De : news [mailto:[EMAIL PROTECTED] De la part de Bruce Lee
Envoyé : vendredi 19 septembre 2008 20:43
À : discuss@restlet.tigris.org
Objet : Re: Random Grizzly IOException

Hi Jerome,

Sorry to took so long to reply as I got side tracked with other tasks at hand, but I have tried my test case with the latest Restlet 1.1 RC1 and the same problem still exists. I've attached my test code with simple http server that simply tries to write 80k chars into the response. If the client repeatedly request the page, then eventually bytesWritten on the channel would be 0 (line 248 in ByteUtils.java) and then it'll wait for 10 seconds with line 249
if (SelectorFactory.getSelector().select(10000) == 0) {
Finally an exception will be logged. Interesting though, if you remove the select line and allow it to spin on the channel write, the correct data still gets written to the response. However, that is far from the correct way to implement NIO so I've also tried replacing the select with the following code.

Selector writeSelector = SelectorFactory
        .getSelector();
if (writeSelector == null) {
    // Continue using the main one.
    continue;
}

((SelectableChannel) this.channel).register(
        writeSelector, SelectionKey.OP_WRITE);

if (writeSelector.select(10000) == 0) {
    throw new IOException("Client disconnected");
}

But another set of exceptions occurs after a few requests:

java.io.IOException: An established connection was aborted by the software in your host machine
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
    at sun.nio.ch.IOUtil.write(IOUtil.java:75)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at
org.restlet.util.ByteUtils$NbChannelOutputStream.doWrite(ByteUtils.java:243)

at
org.restlet.util.ByteUtils$NbChannelOutputStream.write(ByteUtils.java:291)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
    at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
    at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)
    at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
    at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)
at
org.restlet.resource.StringRepresentation.write(StringRepresentation.java:21

2)
at
org.restlet.resource.StreamRepresentation.write(StreamRepresentation.java:68

)
at
com.noelios.restlet.http.HttpServerCall.writeResponseBody(HttpServerCall.jav

a:491)
at
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:429

)
at
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java

:388)
at
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
at
com.noelios.restlet.ext.grizzly.HttpParserFilter.execute(HttpParserFilter.ja

va:78)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolCh

ain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.jav

a:67)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56

)
    at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)
Sep 19, 2008 2:29:40 PM com.noelios.restlet.http.HttpServerConverter commit
SEVERE: An exception occured writing the response entity
java.io.IOException: Unable to write to the non-blocking channel. An established connection was aborted by the software in your host machine at
org.restlet.util.ByteUtils$NbChannelOutputStream.doWrite(ByteUtils.java:274)

at
org.restlet.util.ByteUtils$NbChannelOutputStream.write(ByteUtils.java:291)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
    at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
    at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)
    at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
    at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)
at
org.restlet.resource.StringRepresentation.write(StringRepresentation.java:21

2)
at
org.restlet.resource.StreamRepresentation.write(StreamRepresentation.java:68

)
at
com.noelios.restlet.http.HttpServerCall.writeResponseBody(HttpServerCall.jav

a:491)
at
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:429

)
at
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java

:388)
at
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
at
com.noelios.restlet.ext.grizzly.HttpParserFilter.execute(HttpParserFilter.ja

va:78)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolCh

ain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.jav

a:67)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56

)
    at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)
Sep 19, 2008 2:29:40 PM com.noelios.restlet.http.HttpServerConverter commit
WARNING: Unable to send error response
java.io.IOException: An established connection was aborted by the software in your host machine
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
    at sun.nio.ch.IOUtil.write(IOUtil.java:75)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
    at
com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:105)
    at
com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:73)
at
com.noelios.restlet.ext.grizzly.GrizzlyServerCall.writeResponseHead(GrizzlyS

erverCall.java:269)
at
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:416

)
at
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java

:407)
at
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
at
com.noelios.restlet.ext.grizzly.HttpParserFilter.execute(HttpParserFilter.ja

va:78)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolCh

ain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.jav

a:67)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56

)
    at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)


Regards

Jerome Louvel wrote:
Hi Bruce,

There is an existing bug report covering this exception:

"File transfer exception on Linux"
http://restlet.tigris.org/issues/show_bug.cgi?id=502
It would help if you could attach a simple reproducible test case and
maybe
dig into Grizzly extension code if you are more adventurous!

Best regards,
Jerome


-----Message d'origine-----
De : news [mailto:[EMAIL PROTECTED] De la part de Bruce Lee
Envoye : mercredi 2 juillet 2008 22:02
A : discuss@restlet.tigris.org
Objet : Random Grizzly IOException

Hi,

I'm testing out grizzly connector with the 1.1M4 built and I noticed that
for
requests takes a bit longer to generate the report, sometimes the
following
exceptions occurs:

Jul 2, 2008 4:01:11 PM com.noelios.restlet.http.HttpServerConverter commit
INFO: Exception intercepted
java.io.IOException: Unable to write to the non-blocking channel. Unable
to
sele
ct the channel to write to it. Selection timed out.
    at

org.restlet.util.ByteUtils$NbChannelOutputStream.write(ByteUtils.java:219)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116)
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:203)
    at java.io.Writer.write(Writer.java:140)
    at

org.restlet.resource.StringRepresentation.write(StringRepresentation.java:19

9)
    at

org.restlet.resource.StreamRepresentation.write(StreamRepresentation.java:59

)
    at

com.noelios.restlet.http.HttpServerCall.writeResponseBody(HttpServerCall.jav

a:545)
    at

com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:484

)
    at

com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java

:394)
    at

com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:96)
    at

com.noelios.restlet.ext.grizzly.HttpParserFilter.execute(HttpParserFilter.ja

va:68)
    at

com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolCh

ain.java:124)
    at

com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at

com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:75)
    at

com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.jav

a:54)
    at

com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57

)
    at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:154)

This happens maybe every few other requests and hence renders the
extension
unusable. I'm wondering if this is a known issue with the extension or
there
is
something I need to configure to avoid hitting this error.

My environment is as follows:
jdk1.6.0_06
restlet 1.1m4
grizzly 1.7.3 (also tried 1.8.0, the same error)
The output is a XML file converted to String object, stored with
StringRepresentation.

Regards,



--
Jerome Louvel
http://www.noelios.com





Reply via email to