Results 1 to 5 of 5

Thread: OutOfMemoryError Exception in the client side

  1. #1
    lucsat's Avatar
    lucsat is offline Registered User
    Name: Jordi Rubio
    Organization: Grupo Intercom
    Project: I+D
    Join Date
    Oct 2005
    Location
    Terrassa
    Posts
    15

    Question OutOfMemoryError Exception in the client side

    Hi,

    I have a servlet that connects with an Ice server and implements a basic search page. The servlet works fine with a lot of load (I'm testing with JMeter, with 50 concurrent users per second). Now I'm testing the same functionality with ColdFusion MX (Developers Edition, that it's free ), and when I run the JMeter test plan during 5 minutes, the Ice ThreadPool launches this exception:

    java.lang.OutOfMemoryError
    at java.nio.Bits.reserveMemory(Bits.java:618)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer. java:95)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java :285)
    at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java :54)
    at sun.nio.ch.IOUtil.read(IOUtil.java:205)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImp l.java:207)
    at IceInternal.TcpTransceiver.read(TcpTransceiver.jav a:236)
    at Ice.ConnectionI.read(ConnectionI.java:1061)
    at IceInternal.ThreadPool.read(ThreadPool.java:898)
    at IceInternal.ThreadPool.run(ThreadPool.java:698)
    at IceInternal.ThreadPool.access$100(ThreadPool.java: 12)
    at IceInternal.ThreadPool$EventHandlerThread.run(Thre adPool.java:1194)

    This is the Java object that all the requests in ColdFusion shares:

    public final class Lucene {
    private static TCommand tCommand = null;

    private Lucene() {}

    private static TCommand getTCommand() throws TExecuteException {
    if (tCommand==null){
    TCommand c;
    try {
    c = new TCommand("lucene_conf.xml");
    } catch (TExecuteException te){
    // blablabla exception
    }

    Lucene.tCommand = c;
    }

    return Lucene.tCommand;
    }

    public static final TResultSet search(Map map) throws TExecuteException {
    return getTCommand().execute ( "search", map);
    }
    }

    I'm sure that all the threads in ColdFusion shares the same instance of TCommand (the object that connects with the server). In the constructor of TCommand I initialize the Ice.Communicator, and in the execute method I only connect with the remote object. TCommand is used in the servlet that works fine.

    The test plan is the same in the Tomcat test and ColdFusion Test. Has Ice some problem with ColdFusion MX? Is my class Lucene? (I have read somewhere that is not a good idea to create threads in a J2EE server, and perhaps ColdFusion crashes with the ThreadPool... I don't know...)

    Cheers, and thanks a lot!
    Jordi Rubio Moreno
    Grupo Intercom
    www.grupointercom.com

  2. #2
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    It's impossible to say what's going wrong from the context you provided. All I can see is that the JVM is running out of memory. There could be hundreds of reasons for that, quite possibly unrelated to Ice.

    Note that you are getting the exception on the server side because it is thrown by the thread pool in response to an incoming request. The only way for this to happen on the client side would be if the server makes a callback to the client.

    I have no suggestion other than to keep simplifying your server until you end up removing the part that causes the problem. For starters, I would try this with a empty, dummy servant implementation, that is, by disabling as much of the application logic as possible. If the error goes away with that, you know that it's most likely caused by something in the application code. If not, it may be Ice-related.

    Cheers,

    Michi.

  3. #3
    lucsat's Avatar
    lucsat is offline Registered User
    Name: Jordi Rubio
    Organization: Grupo Intercom
    Project: I+D
    Join Date
    Oct 2005
    Location
    Terrassa
    Posts
    15

    Wink

    Hi Michi!

    I'm getting the exception on the client side, not in the server side.

    I removed the Ice application logic, and instead of connecting with Ice server I connect to basic server that connects with MySQL. I didn't have problems with this test.

    Thanks a lot for your time!
    Jordi Rubio Moreno
    Grupo Intercom
    www.grupointercom.com

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Another thing that you could try is to write a simple Ice client that simulates what your servlet is doing and see if you get the OutOfMemoryError exception. But I suspect it will work if it worked with Tomcat... Perhaps you simply need to increase the maximum heap size for the JVM when using Cold Fusion MX?

    Btw, although this is probably not the cause of your issue, I don't see any synchronization for the initialization of the "tCommand" singleton so if multiple threads invoke the getTCommand() method at the same time it's possible that you initialize multiple TCommand object.

    In any case, we're not aware of any incompatibilities between Ice and ColdFusion.

    Benoit.

  5. #5
    lucsat's Avatar
    lucsat is offline Registered User
    Name: Jordi Rubio
    Organization: Grupo Intercom
    Project: I+D
    Join Date
    Oct 2005
    Location
    Terrassa
    Posts
    15

    Smile

    Hi Benoit,

    ok, i'll run a simple Ice client to debug all the process.

    Thank you very much, and happy new year!
    Jordi Rubio Moreno
    Grupo Intercom
    www.grupointercom.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Client-side objects
    By Kenni in forum Help Center
    Replies: 1
    Last Post: 12-28-2008, 09:30 AM
  2. Replies: 3
    Last Post: 10-30-2007, 04:45 PM
  3. Client side invocations from a Server app.
    By vincei in forum Comments
    Replies: 3
    Last Post: 07-04-2007, 09:27 AM
  4. Replies: 3
    Last Post: 03-13-2006, 02:49 AM
  5. client-side thread safety
    By fitzharrys in forum Help Center
    Replies: 1
    Last Post: 07-06-2005, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •