|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
MINA and GlassfishHi,
I have a really simple client application that uses the following method to establish a connection: Logger logger = LoggerFactory.getLogger("test"); IoConnector ioConnector = new NioSocketConnector(); ioConnector.getFilterChain().addLast("logger", new LoggingFilter()); ioConnector.setHandler(new IoHandlerAdapter()); logger.debug("Before connect..."); ConnectFuture cf = ioConnector.connect(new InetSocketAddress("localhost", 19971)); logger.debug("After connect..."); logger.debug("Before await..."); cf.awaitUninterruptibly(); logger.debug("After await..."); I created a standard java application that invokes this method and got the following output: 04:37:58.575 [main] DEBUG test - Before connect... 04:37:58.581 [main] DEBUG test - After connect... 04:37:58.582 [main] DEBUG test - Before await... 04:37:58.596 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter - CREATED 04:37:58.597 [main] DEBUG test - After await... 04:37:58.598 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter - OPENED 04:37:58.609 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter - RECEIVED: HeapBuffer[pos=0 lim=114 cap=2048: 43 49 4D 44 32 2D 41 20 43 6F 6E 6E 65 63 74 69...] That's OK, I expected this behavior. However I also created a web application that includes a ContextListener. The ContextListener calls the method on startup and I get this output: 04:30:48.469 [httpWorkerThread-4848-1] DEBUG test - Before connect... 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - After connect... 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - Before await... 04:30:48.481 [NioSocketConnector-1] WARN o.a.m.core.DefaultExceptionMonitor - Unexpected exception. java.lang.NullPointerException at org.apache.mina.core.polling.AbstractPollingIoConnector$ConnectionRequest.access$200(AbstractPollingIoConnector.java:517) at org.apache.mina.core.polling.AbstractPollingIoConnector.processTimedOutSessions(AbstractPollingIoConnector.java:446) at org.apache.mina.core.polling.AbstractPollingIoConnector.access$600(AbstractPollingIoConnector.java:64) at org.apache.mina.core.polling.AbstractPollingIoConnector$Worker.run(AbstractPollingIoConnector.java:471) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) What can go wrong when I use the web application? Can I make it work somehow? I'm not really sure if it is a problem with MINA itself or Glassfish or something else, so if you think it's not really a MINA issue please let me know and I'll ask on a more proper forum. -- Zizi "Oh, by the way... Anyone still experiencing stress by the end of the day... WILL BE FIRED!!!" |
|
|
Re: MINA and GlassfishOn Fri, Aug 1, 2008 at 4:55 AM, Mezei Zoltan <mezei.zoltan@...> wrote:
> What can go wrong when I use the web application? Can I make it work somehow? Update: I tried to run the program using MINA 2.0.0-M2 when I got the exceptions. The equivalent program works perfectly from the web context using MINA 1.1.7. Should I submit a bug report about this regression? Can I help with more testing or anything else? -- Zizi "Oh, by the way... Anyone still experiencing stress by the end of the day... WILL BE FIRED!!!" |
|
|
Re: MINA and GlassfishOn Fri, 1 Aug 2008 13:18:17 +0200
"Mezei Zoltan" <mezei.zoltan@...> wrote: > On Fri, Aug 1, 2008 at 4:55 AM, Mezei Zoltan <mezei.zoltan@...> > wrote: > > What can go wrong when I use the web application? Can I make it > > work somehow? > > Update: I tried to run the program using MINA 2.0.0-M2 when I got the > exceptions. The equivalent program works perfectly from the web > context using MINA 1.1.7. > > Should I submit a bug report about this regression? > > Can I help with more testing or anything else? can you provide a small test case so we can reproduce it ? If so feel free to attach to a JIRA issue, so we can look at the problem. Cheers, Julien |
|
|
Re: MINA and GlassfishDid anyone get any further with this issue as the exact same thing is happening to me.
cheers.
|
|
|
Re: MINA and Glassfishprivate void processTimedOutSessions(Iterator<H> handles) {
long currentTime = System.currentTimeMillis(); while (handles.hasNext()) { H handle = handles.next(); ConnectionRequest entry = connectionRequest(handle); // ***** entry is null pointer here ! *************** // next line will blow !!! if (currentTime >= entry.deadline) { entry.setException( new ConnectException("Connection timed out.")); cancelQueue.offer(entry); } } }
|
|
|
Re: MINA and GlassfishHey
Has anyone made any progress on the troubles with MINA 2.0 in Glassfish? We have had some FtpServer users who have run into problems when deploying FtpServer in Glassfish, and they seem to be related. I just tried deploying our WAR example in Glassfish V2 UR2 b04 and got the following exception thrown repeatedly: [#|2008-10-21T11:16:20.593+0200|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=NioSocketAcceptor-2;|[ WARN] 2008-10-21 11:16:20,593 [] [] Unexpected exception. java.lang.NullPointerException at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:206) at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48) at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.processHandles(AbstractPollingIoAcceptor.java:451) at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.run(AbstractPollingIoAcceptor.java:388) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) I'm sorry to say that I don't know the internals of NIO nor Glassfish enough to track this down myself but I'll be glad to be of any help I can to solve this. Should we maybe get in touch with our friends over at Glassfish? /niklas On Fri, Aug 1, 2008 at 4:55 AM, Mezei Zoltan <mezei.zoltan@...> wrote: > Hi, > > I have a really simple client application that uses the following > method to establish a connection: > > Logger logger = LoggerFactory.getLogger("test"); > IoConnector ioConnector = new NioSocketConnector(); > ioConnector.getFilterChain().addLast("logger", new LoggingFilter()); > ioConnector.setHandler(new IoHandlerAdapter()); > logger.debug("Before connect..."); > ConnectFuture cf = ioConnector.connect(new > InetSocketAddress("localhost", 19971)); > logger.debug("After connect..."); > logger.debug("Before await..."); > cf.awaitUninterruptibly(); > logger.debug("After await..."); > > I created a standard java application that invokes this method and got > the following output: > > 04:37:58.575 [main] DEBUG test - Before connect... > 04:37:58.581 [main] DEBUG test - After connect... > 04:37:58.582 [main] DEBUG test - Before await... > 04:37:58.596 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter - CREATED > 04:37:58.597 [main] DEBUG test - After await... > 04:37:58.598 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter - OPENED > 04:37:58.609 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter > - RECEIVED: HeapBuffer[pos=0 lim=114 cap=2048: 43 49 4D 44 32 2D 41 20 > 43 6F 6E 6E 65 63 74 69...] > > That's OK, I expected this behavior. > > However I also created a web application that includes a > ContextListener. The ContextListener calls the method on startup and I > get this output: > > 04:30:48.469 [httpWorkerThread-4848-1] DEBUG test - Before connect... > 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - After connect... > 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - Before await... > 04:30:48.481 [NioSocketConnector-1] WARN > o.a.m.core.DefaultExceptionMonitor - Unexpected exception. > java.lang.NullPointerException > at org.apache.mina.core.polling.AbstractPollingIoConnector$ConnectionRequest.access$200(AbstractPollingIoConnector.java:517) > at org.apache.mina.core.polling.AbstractPollingIoConnector.processTimedOutSessions(AbstractPollingIoConnector.java:446) > at org.apache.mina.core.polling.AbstractPollingIoConnector.access$600(AbstractPollingIoConnector.java:64) > at org.apache.mina.core.polling.AbstractPollingIoConnector$Worker.run(AbstractPollingIoConnector.java:471) > at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) > at java.lang.Thread.run(Thread.java:619) > > What can go wrong when I use the web application? Can I make it work somehow? > > I'm not really sure if it is a problem with MINA itself or Glassfish > or something else, so if you think it's not really a MINA issue please > let me know and I'll ask on a more proper forum. > -- > Zizi > > "Oh, by the way... Anyone still experiencing stress by the end of the > day... WILL BE FIRED!!!" > |
|
|
Re: MINA and GlassfishNiklas Gustavsson wrote:
> Hey > > Has anyone made any progress on the troubles with MINA 2.0 in > Glassfish? We have had some FtpServer users who have run into problems > when deploying FtpServer in Glassfish, and they seem to be related. I > just tried deploying our WAR example in Glassfish V2 UR2 b04 and got > the following exception thrown repeatedly: > [#|2008-10-21T11:16:20.593+0200|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=NioSocketAcceptor-2;|[ > WARN] 2008-10-21 11:16:20,593 [] [] Unexpected exception. > java.lang.NullPointerException > at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:206) > at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48) > at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.processHandles(AbstractPollingIoAcceptor.java:451) > at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.run(AbstractPollingIoAcceptor.java:388) > at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:619) > > I'm sorry to say that I don't know the internals of NIO nor Glassfish > enough to track this down myself but I'll be glad to be of any help I > can to solve this. Should we maybe get in touch with our friends over > at Glassfish? > > /niklas > > On Fri, Aug 1, 2008 at 4:55 AM, Mezei Zoltan <mezei.zoltan@...> wrote: > >> Hi, >> >> I have a really simple client application that uses the following >> method to establish a connection: >> >> Logger logger = LoggerFactory.getLogger("test"); >> IoConnector ioConnector = new NioSocketConnector(); >> ioConnector.getFilterChain().addLast("logger", new LoggingFilter()); >> ioConnector.setHandler(new IoHandlerAdapter()); >> logger.debug("Before connect..."); >> ConnectFuture cf = ioConnector.connect(new >> InetSocketAddress("localhost", 19971)); >> logger.debug("After connect..."); >> logger.debug("Before await..."); >> cf.awaitUninterruptibly(); >> logger.debug("After await..."); >> >> I created a standard java application that invokes this method and got >> the following output: >> >> 04:37:58.575 [main] DEBUG test - Before connect... >> 04:37:58.581 [main] DEBUG test - After connect... >> 04:37:58.582 [main] DEBUG test - Before await... >> 04:37:58.596 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter - CREATED >> 04:37:58.597 [main] DEBUG test - After await... >> 04:37:58.598 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter - OPENED >> 04:37:58.609 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter >> - RECEIVED: HeapBuffer[pos=0 lim=114 cap=2048: 43 49 4D 44 32 2D 41 20 >> 43 6F 6E 6E 65 63 74 69...] >> >> That's OK, I expected this behavior. >> >> However I also created a web application that includes a >> ContextListener. The ContextListener calls the method on startup and I >> get this output: >> >> 04:30:48.469 [httpWorkerThread-4848-1] DEBUG test - Before connect... >> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - After connect... >> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - Before await... >> 04:30:48.481 [NioSocketConnector-1] WARN >> o.a.m.core.DefaultExceptionMonitor - Unexpected exception. >> java.lang.NullPointerException >> at org.apache.mina.core.polling.AbstractPollingIoConnector$ConnectionRequest.access$200(AbstractPollingIoConnector.java:517) >> at org.apache.mina.core.polling.AbstractPollingIoConnector.processTimedOutSessions(AbstractPollingIoConnector.java:446) >> at org.apache.mina.core.polling.AbstractPollingIoConnector.access$600(AbstractPollingIoConnector.java:64) >> at org.apache.mina.core.polling.AbstractPollingIoConnector$Worker.run(AbstractPollingIoConnector.java:471) >> at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) >> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) >> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) >> at java.lang.Thread.run(Thread.java:619) >> >> What can go wrong when I use the web application? Can I make it work somehow? >> protected NioSession accept(IoProcessor<NioSession> processor, ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector); if (!key.isAcceptable()) { <--- Here, if the key is null, you get a NPE... I will fix that immediatly. Could you check it with Glassfish when I will have committed the code ? Thanks ! -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org |
|
|
Re: MINA and GlassfishNiklas Gustavsson wrote:
> Hey > > Has anyone made any progress on the troubles with MINA 2.0 in > Glassfish? We have had some FtpServer users who have run into problems > when deploying FtpServer in Glassfish, and they seem to be related. I > just tried deploying our WAR example in Glassfish V2 UR2 b04 and got > the following exception thrown repeatedly: > [#|2008-10-21T11:16:20.593+0200|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=NioSocketAcceptor-2;|[ > WARN] 2008-10-21 11:16:20,593 [] [] Unexpected exception. > java.lang.NullPointerException > http://svn.apache.org/viewvc?rev=706585&view=rev fixes the problem. Anywone can test it ? -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org |
|
|
Re: MINA and GlassfishOn Tue, Oct 21, 2008 at 1:45 PM, Emmanuel Lecharny <elecharny@...> wrote:
> I would like to know if the trunk with this patch : > > http://svn.apache.org/viewvc?rev=706585&view=rev > > fixes the problem. Anywone can test it ? I'll do it now, however it might take a time to get mina compiled from source, I didn't do that before. -- Zizi "Oh, by the way... Anyone still experiencing stress by the end of the day... WILL BE FIRED!!!" |
|
|
Re: MINA and GlassfishOn Tue, Oct 21, 2008 at 1:09 PM, Emmanuel Lecharny <elecharny@...> wrote:
> I think there is something wrong in MINA code : > > protected NioSession accept(IoProcessor<NioSession> processor, > ServerSocketChannel handle) throws Exception { > > SelectionKey key = handle.keyFor(selector); > if (!key.isAcceptable()) { <--- Here, if the key is null, you get a > NPE... While I agree with analysis that it will throw a NPE, the problem is rather why we get a null key in Glassfish but not in any other environment that I've tested in. Checking for null and returning null might not solve the problem, only hide it. > Could you check it with Glassfish when I will have committed the code ? Sure, I'll check it tonight. /niklas |
|
|
Re: MINA and GlassfishNiklas Gustavsson wrote:
> On Tue, Oct 21, 2008 at 1:09 PM, Emmanuel Lecharny <elecharny@...> wrote: > >> I think there is something wrong in MINA code : >> >> protected NioSession accept(IoProcessor<NioSession> processor, >> ServerSocketChannel handle) throws Exception { >> >> SelectionKey key = handle.keyFor(selector); >> if (!key.isAcceptable()) { <--- Here, if the key is null, you get a >> NPE... >> > > While I agree with analysis that it will throw a NPE, the problem is > rather why we get a null key in Glassfish but not in any other > environment that I've tested in. Checking for null and returning null > might not solve the problem, only hide it. > In this very case, the NPE is just revealing that some specific condition is not handled correctly. Fixing it is mandatory. So what is this condition ? protected NioSession accept(IoProcessor<NioSession> processor, ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector); if ((key == null) || (!key.isValid()) || (!key.isAcceptable()) ) { return null; } The 'accept' method is called when the server is binding the listening socket. This is done in a specific thread, after a select() is done : private class Acceptor implements Runnable { public void run() { int nHandles = 0; while (selectable) { try { int selected = select(); if (selected > 0) { processHandles(selectedHandles()); } with : protected Iterator<ServerSocketChannel> selectedHandles() { return new ServerSocketChannelIterator(selector.selectedKeys()); } and private void processHandles(Iterator<H> handles) throws Exception { while (handles.hasNext()) { H handle = handles.next(); handles.remove(); T session = accept(processor, handle); Now, as the select() method might gives you a list of SelectionKey which is obsolete, you may have a handle which is not anymore registered to a channel, and this will lead to a NPE if you don't test the keyFor( Selector ) return against null. The Javadoc is explicit : Returns: The key returned when this channel was last registered with the given selector, or null if this channel is not currently registered with that selector. The problem, now, is to reproduce this case and understand why we get this error. Sadly, as MINA logs is, to say the least, badly minimal, we are in dire straight to diagnose what could happen in Glassfish Another important task, beside the needed javadocing : adding a bunch of logs ! PS : could we have the step necessary to install MINA into Glassfish ? -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org |
|
|
Re: MINA and GlassfishOn Tue, Oct 21, 2008 at 2:28 PM, Emmanuel Lecharny <elecharny@...> wrote:
> In this very case, the NPE is just revealing that some specific condition is > not handled correctly. Fixing it is mandatory. So what is this condition ? Agreed. I don't know the condition, all that was done was deploying the app and trying to connect using an FTP client. > PS : could we have the step necessary to install MINA into Glassfish ? What I did was to use the ftpserver-example-spring-war example located here: http://svn.apache.org/repos/asf/mina/ftpserver/trunk/examples/ftpserver-example-spring-war/ Build it using mvn package, take the WAR and copy to the Glassfish autodeploy directory. After that, try connecting using any FTP client on port 2121. The Glassfish server log will then be full of the stacktraces I showed above. /niklas |
|
|
Re: MINA and GlassfishOn Tue, Oct 21, 2008 at 1:50 PM, Mezei Zoltan <mezei.zoltan@...> wrote:
> On Tue, Oct 21, 2008 at 1:45 PM, Emmanuel Lecharny <elecharny@...> wrote: >> I would like to know if the trunk with this patch : >> >> http://svn.apache.org/viewvc?rev=706585&view=rev >> >> fixes the problem. Anywone can test it ? > > I'll do it now, however it might take a time to get mina compiled from > source, I didn't do that before. Ok, I did it, but it didn't help :-( I used the following test class: package test; import java.net.InetSocketAddress; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.apache.mina.core.future.ConnectFuture; import org.apache.mina.core.service.IoConnector; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.filter.logging.LoggingFilter; import org.apache.mina.transport.socket.nio.NioSocketConnector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TestServletContextListener implements ServletContextListener { public void contextInitialized(ServletContextEvent arg0) { Logger logger = LoggerFactory.getLogger("test"); IoConnector ioConnector = new NioSocketConnector(); ioConnector.getFilterChain().addLast("logger", new LoggingFilter()); ioConnector.setHandler(new IoHandlerAdapter()); logger.debug("Before connect..."); ConnectFuture cf = ioConnector.connect(new InetSocketAddress("localhost", 19971)); logger.debug("After connect..."); logger.debug("Before await..."); cf.awaitUninterruptibly(); logger.debug("After await..."); } public void contextDestroyed(ServletContextEvent arg0) { throw new UnsupportedOperationException("Not supported yet."); } } It was used in a .war file with the following web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <listener> <description>ServletContextListener</description> <listener-class>test.TestServletContextListener</listener-class> </listener> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> When I deployed the war file to a glassfish instance it yielded the following logs: 14:55:55.469 [pool-1-thread-4] DEBUG test - Before connect... 14:55:55.484 [pool-1-thread-4] DEBUG test - After connect... 14:55:55.484 [pool-1-thread-4] DEBUG test - Before await... 14:55:56.422 [NioSocketConnector-1] WARN o.a.m.util.DefaultExceptionMonitor - Unexpected exception. java.lang.NullPointerException at java.util.concurrent.ConcurrentLinkedQueue.offer(ConcurrentLinkedQueue.java:190) at org.apache.mina.core.polling.AbstractPollingIoConnector.processConnections(AbstractPollingIoConnector.java:440) at org.apache.mina.core.polling.AbstractPollingIoConnector.access$500(AbstractPollingIoConnector.java:64) at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:476) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) I used the current trunk version of MINA with your patch. From the log I guess that in AbstractPollingIoConnector the following line fails: } finally { if (!success) { // The connection failed, we have to cancel it. cancelQueue.offer(connectionRequest); // <----- This line fails with NPE } } It might mean that it is possible that in some situations the cancelQueue might not have been initialized before the offer statement but that's not the case here. But according to the javadoc: http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html#offer(E) offer() might throw an NPE when the offered element (connectionRequest in this case) is null. Now, I don't know why/how that can happen :-( -- Zizi "Oh, by the way... Anyone still experiencing stress by the end of the day... WILL BE FIRED!!!" |
|
|
Re: MINA and Glassfish>> I'll do it now, however it might take a time to get mina compiled from >> source, I didn't do that before. >> > > Ok, I did it, but it didn't help :-( > At least, this is not the same NPE :) > > It was used in a .war file with the following web.xml: > When I deployed the war file to a glassfish instance it yielded the > following logs: > > > 14:55:55.469 [pool-1-thread-4] DEBUG test - Before connect... > 14:55:55.484 [pool-1-thread-4] DEBUG test - After connect... > 14:55:55.484 [pool-1-thread-4] DEBUG test - Before await... > 14:55:56.422 [NioSocketConnector-1] WARN > o.a.m.util.DefaultExceptionMonitor - Unexpected exception. > java.lang.NullPointerException > at java.util.concurrent.ConcurrentLinkedQueue.offer(ConcurrentLinkedQueue.java:190) > at org.apache.mina.core.polling.AbstractPollingIoConnector.processConnections(AbstractPollingIoConnector.java:440) > at org.apache.mina.core.polling.AbstractPollingIoConnector.access$500(AbstractPollingIoConnector.java:64) > at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:476) > at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65) > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) > at java.lang.Thread.run(Thread.java:619) > > > I used the current trunk version of MINA with your patch. > > >From the log I guess that in AbstractPollingIoConnector the following > line fails: > > } finally { > if (!success) { > // The connection failed, we have to cancel it. > cancelQueue.offer(connectionRequest); // <----- > This line fails with NPE > } > } > > It might mean that it is possible that in some situations the > cancelQueue might not have been initialized before the offer statement > but that's not the case here. But according to the javadoc: > code : private int processConnections(Iterator<H> handlers) { int nHandles = 0; // Loop on each connection request while (handlers.hasNext()) { H handle = handlers.next(); handlers.remove(); ConnectionRequest connectionRequest = getConnectionRequest(handle); // Here, we should do that : if ( connectionRequest == null) { continue; } Without the check, as the getConnectionRequest() method can return null for the very same reason than the previously fixed accept() method, you will have a NPE. I have committed a patch for this case. Can you run another test ? (I'm currently installing glassfish, but it will take a bit to have it up and running) Thanks ! -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org |
|
|
Re: MINA and GlassfishOn Tue, Oct 21, 2008 at 3:36 PM, Emmanuel Lecharny <elecharny@...> wrote:
>> Ok, I did it, but it didn't help :-( > At least, this is not the same NPE :) :-) > Without the check, as the getConnectionRequest() method can return null for > the very same reason than the previously fixed accept() method, you will > have a NPE. Right. > I have committed a patch for this case. Can you run another test ? Yepp, I did. However it yielded the following log messages only: 16:44:01.530 [pool-1-thread-1] DEBUG test - Before connect... 16:44:01.546 [pool-1-thread-1] DEBUG test - After connect... 16:44:01.546 [pool-1-thread-1] DEBUG test - Before await... And nothing else. The same code from a standalone application produces the following log messages (I added an additional logging line here: logger.debug("Before await..."); cf.awaitUninterruptibly(); logger.debug(cf.getException().getMessage()); logger.debug("After await..."); ) 16:50:48.796 [main] DEBUG test - Before connect... 16:50:48.812 [main] DEBUG test - After connect... 16:50:48.812 [main] DEBUG test - Before await... 16:50:49.718 [main] DEBUG test - Connection refused: no further information 16:50:49.718 [main] DEBUG test - After await... It's OK if I get the connection refused message as there are nothing listening on the address I use, but then why don't I get the same error from the web application? It seems that the waitUninterruptably() call just waits, but it doesn't terminate when the connection attempt is unsuccessful. Somehow it makes sense, as the ConnectionRequest is null, so I wouldn't wait for it to somehow provide a proper, terminating ConnectFuture. I hope it makes sense for you. > (I'm currently installing glassfish, but it will take a bit to have it up > and running) Well, good luck with that :-) -- Zizi "Oh, by the way... Anyone still experiencing stress by the end of the day... WILL BE FIRED!!!" |
|
|
Re: MINA and GlassfishMezei Zoltan wrote:
> However it yielded the following log messages only: > > 16:44:01.530 [pool-1-thread-1] DEBUG test - Before connect... > 16:44:01.546 [pool-1-thread-1] DEBUG test - After connect... > 16:44:01.546 [pool-1-thread-1] DEBUG test - Before await... > > And nothing else. > > The same code from a standalone application produces the following log > messages (I added an additional logging line here: > > logger.debug("Before await..."); > cf.awaitUninterruptibly(); > logger.debug(cf.getException().getMessage()); > logger.debug("After await..."); > > ) > > 16:50:48.796 [main] DEBUG test - Before connect... > 16:50:48.812 [main] DEBUG test - After connect... > 16:50:48.812 [main] DEBUG test - Before await... > 16:50:49.718 [main] DEBUG test - Connection refused: no further information > 16:50:49.718 [main] DEBUG test - After await... > > It's OK if I get the connection refused message as there are nothing > listening on the address I use, but then why don't I get the same > error from the web application? It seems that the > waitUninterruptably() call just waits, but it doesn't terminate when > the connection attempt is unsuccessful. Somehow it makes sense, as the > ConnectionRequest is null, so I wouldn't wait for it to somehow > provide a proper, terminating ConnectFuture. > > I hope it makes sense for you. > for some unknown reason, so it's pretty hard to understand what's going on here... -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org |
|
|
MINA and ASyncWebI have been having a hell of a time trying to get this to work together.
I am building a simple AJAX Server and want to use reuse many of the codecs/components from the ASyncWeb project, however the jar files I have downloaded (from https://svn.safehaus.org/repos/asyncweb/release/) do not work. It looks like the entire org.safehaus.asyncweb.common package and classes are missing (from the jar file, but still present in the trunk). Has anyone worked on this? Maybe I am just missing something. Landon Fabbricino IT Applications Phone: 403.225.7515 Fax: 403.225.7604 lfabbric@... IMPORTANT NOTICE ! This E-Mail transmission and any accompanying attachments may contain confidential information intended only for the use of the individual or entity named above. Any dissemination, distribution, copying or action taken in reliance on the contents of this E-Mail by anyone other than the intended recipient is strictly prohibited and is not intended to, in anyway, waive privilege or confidentiality. If you have received this E-Mail in error please immediately delete it and notify sender at the above E-Mail address. Agrium uses state of the art anti-virus technology on all incoming and outgoing E-Mail. We encourage and promote the use of safe E-Mail management practices and recommend you check this, and all other E-Mail and attachments you receive for the presence of viruses. The sender and Agrium accept no liability for any damage caused by a virus or otherwise by the transmittal of this E-Mail. |
|
|
Re: MINA and GlassfishSalut,
this is a problem with GlassFish: https://glassfish.dev.java.net/issues/show_bug.cgi?id=5321 Mainly, there is a severe bug (we all whine about this %$#% mechanism, which has been dropped in v3). Just add, in domain.xml: -Dcom.sun.enterprise.server.ss.ASQuickStartup=false and the problem will go away. A+ -- Jeanfrancois Emmanuel Lecharny wrote: > Niklas Gustavsson wrote: >> Hey >> >> Has anyone made any progress on the troubles with MINA 2.0 in >> Glassfish? We have had some FtpServer users who have run into problems >> when deploying FtpServer in Glassfish, and they seem to be related. I >> just tried deploying our WAR example in Glassfish V2 UR2 b04 and got >> the following exception thrown repeatedly: >> [#|2008-10-21T11:16:20.593+0200|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=NioSocketAcceptor-2;|[ >> >> WARN] 2008-10-21 11:16:20,593 [] [] Unexpected exception. >> java.lang.NullPointerException >> at >> org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:206) >> >> at >> org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48) >> >> at >> org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.processHandles(AbstractPollingIoAcceptor.java:451) >> >> at >> org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.run(AbstractPollingIoAcceptor.java:388) >> >> at >> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) >> >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) >> >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) >> >> at java.lang.Thread.run(Thread.java:619) >> >> I'm sorry to say that I don't know the internals of NIO nor Glassfish >> enough to track this down myself but I'll be glad to be of any help I >> can to solve this. Should we maybe get in touch with our friends over >> at Glassfish? >> >> /niklas >> >> On Fri, Aug 1, 2008 at 4:55 AM, Mezei Zoltan <mezei.zoltan@...> >> wrote: >> >>> Hi, >>> >>> I have a really simple client application that uses the following >>> method to establish a connection: >>> >>> Logger logger = LoggerFactory.getLogger("test"); >>> IoConnector ioConnector = new NioSocketConnector(); >>> ioConnector.getFilterChain().addLast("logger", new LoggingFilter()); >>> ioConnector.setHandler(new IoHandlerAdapter()); >>> logger.debug("Before connect..."); >>> ConnectFuture cf = ioConnector.connect(new >>> InetSocketAddress("localhost", 19971)); >>> logger.debug("After connect..."); >>> logger.debug("Before await..."); >>> cf.awaitUninterruptibly(); >>> logger.debug("After await..."); >>> >>> I created a standard java application that invokes this method and got >>> the following output: >>> >>> 04:37:58.575 [main] DEBUG test - Before connect... >>> 04:37:58.581 [main] DEBUG test - After connect... >>> 04:37:58.582 [main] DEBUG test - Before await... >>> 04:37:58.596 [NioProcessor-1] INFO >>> o.a.m.filter.logging.LoggingFilter - CREATED >>> 04:37:58.597 [main] DEBUG test - After await... >>> 04:37:58.598 [NioProcessor-1] INFO >>> o.a.m.filter.logging.LoggingFilter - OPENED >>> 04:37:58.609 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter >>> - RECEIVED: HeapBuffer[pos=0 lim=114 cap=2048: 43 49 4D 44 32 2D 41 20 >>> 43 6F 6E 6E 65 63 74 69...] >>> >>> That's OK, I expected this behavior. >>> >>> However I also created a web application that includes a >>> ContextListener. The ContextListener calls the method on startup and I >>> get this output: >>> >>> 04:30:48.469 [httpWorkerThread-4848-1] DEBUG test - Before connect... >>> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - After connect... >>> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - Before await... >>> 04:30:48.481 [NioSocketConnector-1] WARN >>> o.a.m.core.DefaultExceptionMonitor - Unexpected exception. >>> java.lang.NullPointerException >>> at >>> org.apache.mina.core.polling.AbstractPollingIoConnector$ConnectionRequest.access$200(AbstractPollingIoConnector.java:517) >>> >>> at >>> org.apache.mina.core.polling.AbstractPollingIoConnector.processTimedOutSessions(AbstractPollingIoConnector.java:446) >>> >>> at >>> org.apache.mina.core.polling.AbstractPollingIoConnector.access$600(AbstractPollingIoConnector.java:64) >>> >>> at >>> org.apache.mina.core.polling.AbstractPollingIoConnector$Worker.run(AbstractPollingIoConnector.java:471) >>> >>> at >>> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) >>> >>> at java.lang.Thread.run(Thread.java:619) >>> >>> What can go wrong when I use the web application? Can I make it work >>> somehow? >>> > I think there is something wrong in MINA code : > > protected NioSession accept(IoProcessor<NioSession> processor, > ServerSocketChannel handle) throws Exception { > > SelectionKey key = handle.keyFor(selector); > if (!key.isAcceptable()) { <--- Here, if the key is null, you > get a NPE... > > I will fix that immediatly. > > Could you check it with Glassfish when I will have committed the code ? > > Thanks ! > |
|
|
Re: MINA and GlassfishSalut,
the exact bug is (we got so much issues related to that :-)) https://glassfish.dev.java.net/issues/show_bug.cgi?id=3027 Someone from this community already added a workaround. A+ -- Jeanfrancois Jeanfrancois Arcand wrote: > Salut, > > this is a problem with GlassFish: > > https://glassfish.dev.java.net/issues/show_bug.cgi?id=5321 > > Mainly, there is a severe bug (we all whine about this %$#% mechanism, > which has been dropped in v3). Just add, in domain.xml: > > -Dcom.sun.enterprise.server.ss.ASQuickStartup=false > > and the problem will go away. > > A+ > > -- Jeanfrancois > > Emmanuel Lecharny wrote: >> Niklas Gustavsson wrote: >>> Hey >>> >>> Has anyone made any progress on the troubles with MINA 2.0 in >>> Glassfish? We have had some FtpServer users who have run into problems >>> when deploying FtpServer in Glassfish, and they seem to be related. I >>> just tried deploying our WAR example in Glassfish V2 UR2 b04 and got >>> the following exception thrown repeatedly >>> [#|2008-10-21T11:16:20.593+0200|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=NioSocketAcceptor-2;|[ >>> >>> WARN] 2008-10-21 11:16:20,593 [] [] Unexpected exception. >>> java.lang.NullPointerException >>> at >>> org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:206) >>> >>> at >>> org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48) >>> >>> at >>> org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.processHandles(AbstractPollingIoAcceptor.java:451) >>> >>> at >>> org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.run(AbstractPollingIoAcceptor.java:388) >>> >>> at >>> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) >>> >>> at java.lang.Thread.run(Thread.java:619) >>> >>> I'm sorry to say that I don't know the internals of NIO nor Glassfish >>> enough to track this down myself but I'll be glad to be of any help I >>> can to solve this. Should we maybe get in touch with our friends over >>> at Glassfish? >>> >>> /niklas >>> >>> On Fri, Aug 1, 2008 at 4:55 AM, Mezei Zoltan <mezei.zoltan@...> >>> wrote: >>> >>>> Hi, >>>> >>>> I have a really simple client application that uses the following >>>> method to establish a connection: >>>> >>>> Logger logger = LoggerFactory.getLogger("test"); >>>> IoConnector ioConnector = new NioSocketConnector(); >>>> ioConnector.getFilterChain().addLast("logger", new LoggingFilter()); >>>> ioConnector.setHandler(new IoHandlerAdapter()); >>>> logger.debug("Before connect..."); >>>> ConnectFuture cf = ioConnector.connect(new >>>> InetSocketAddress("localhost", 19971)); >>>> logger.debug("After connect..."); >>>> logger.debug("Before await..."); >>>> cf.awaitUninterruptibly(); >>>> logger.debug("After await..."); >>>> >>>> I created a standard java application that invokes this method and got >>>> the following output: >>>> >>>> 04:37:58.575 [main] DEBUG test - Before connect... >>>> 04:37:58.581 [main] DEBUG test - After connect... >>>> 04:37:58.582 [main] DEBUG test - Before await... >>>> 04:37:58.596 [NioProcessor-1] INFO >>>> o.a.m.filter.logging.LoggingFilter - CREATED >>>> 04:37:58.597 [main] DEBUG test - After await... >>>> 04:37:58.598 [NioProcessor-1] INFO >>>> o.a.m.filter.logging.LoggingFilter - OPENED >>>> 04:37:58.609 [NioProcessor-1] INFO o.a.m.filter.logging.LoggingFilter >>>> - RECEIVED: HeapBuffer[pos=0 lim=114 cap=2048: 43 49 4D 44 32 2D 41 20 >>>> 43 6F 6E 6E 65 63 74 69...] >>>> >>>> That's OK, I expected this behavior. >>>> >>>> However I also created a web application that includes a >>>> ContextListener. The ContextListener calls the method on startup and I >>>> get this output: >>>> >>>> 04:30:48.469 [httpWorkerThread-4848-1] DEBUG test - Before connect... >>>> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - After connect... >>>> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - Before await... >>>> 04:30:48.481 [NioSocketConnector-1] WARN >>>> o.a.m.core.DefaultExceptionMonitor - Unexpected exception. >>>> java.lang.NullPointerException >>>> at >>>> org.apache.mina.core.polling.AbstractPollingIoConnector$ConnectionRequest.access$200(AbstractPollingIoConnector.java:517) >>>> >>>> at >>>> org.apache.mina.core.polling.AbstractPollingIoConnector.processTimedOutSessions(AbstractPollingIoConnector.java:446) >>>> >>>> at >>>> org.apache.mina.core.polling.AbstractPollingIoConnector.access$600(AbstractPollingIoConnector.java:64) >>>> >>>> at >>>> org.apache.mina.core.polling.AbstractPollingIoConnector$Worker.run(AbstractPollingIoConnector.java:471) >>>> >>>> at >>>> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) >>>> >>>> at >>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) >>>> >>>> at >>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) >>>> >>>> at java.lang.Thread.run(Thread.java:619) >>>> >>>> What can go wrong when I use the web application? Can I make it work >>>> somehow? >>>> >> I think there is something wrong in MINA code : >> >> protected NioSession accept(IoProcessor<NioSession> processor, >> ServerSocketChannel handle) throws Exception { >> >> SelectionKey key = handle.keyFor(selector); >> if (!key.isAcceptable()) { <--- Here, if the key is null, you >> get a NPE... >> >> I will fix that immediatly. >> >> Could you check it with Glassfish when I will have committed the code ? >> >> Thanks ! >> |
|
|
Re: MINA and GlassfishJeanfrancois Arcand wrote:
> Salut, > > this is a problem with GlassFish: > > https://glassfish.dev.java.net/issues/show_bug.cgi?id=5321 > > Mainly, there is a severe bug (we all whine about this %$#% mechanism, > which has been dropped in v3). Just add, in domain.xml: > > -Dcom.sun.enterprise.server.ss.ASQuickStartup=false > > and the problem will go away. Thank a lot, Jean-François ! This will spare a hell lot of time for us ;) (and, btw, we also fixed some bugs in MINA while tracking this issue :) -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |