3 Replies Latest reply on Apr 15, 2010 11:25 AM by Peter Johnson

    Parralel asynchronous calls

    bu jo Newbie

      Hi there!

       

      I'm invoking an asynchronous service of a partner system multiple times (example: 20 times). They all open their own TCP connection and get processed by the partner system. But on result processing I got the exception attached (last line has been manually changed). On less calls (up to 8) everything works fine.

       

      As you can see from the log, the 18 calls are done, and get processed.. obviously not necessarily in the same order. Here the client crashes on processing a fourth result.

       

      The exception lets me suppose that the problem lies in XML parsing. But it happens not regularly, just sometimes.

       

      Anybody here experienced similar problem or is able to better pinpoint the problem?

       

      Thank you, kind regards!

        • 1. Re: Parralel asynchronous calls
          Jim Ma Apprentice

          Do you notice  this error in your log :  Caused by: java.lang.OutOfMemoryError: Java heap space ?

          • 2. Re: Parralel asynchronous calls
            bu jo Newbie

            Sure, I noticed it, but I'm trying to understand what causes it.

            • 3. Re: Parralel asynchronous calls
              Peter Johnson Master

              That error means that either you are running with too small of a heap or you have a memory leak. What heap size (-Xmx) are you specifying? And are you sure that the JVM is using that much heap? Checking the process memory utilization usually helps here - if you set -Xmx512M and the java process is using less than 100MB of memory, you know it didn't see the -Xmx512M. But if the java process is using around 600MB you kn ow that it did see the setting.

               

              If you have a sufficiently large heap, then you need to figure out where the memory leak is. Try setting -XX:+HeapDumpOnOutOfMemoryError. This option causes the JVM to dump the heap to a file which you can then analyze using a tool such as VisualVM. VisualVM will show you which objects occur the most often and which objects are using the most heap space.

               

              By the way, "too small of a heap" depends entirely on your application. If you are passing, and dealing with, very large objects then you will need a lot more heap that if you are working with ints, longs and short strings.