8 Replies Latest reply on Oct 22, 2002 2:11 PM by Ralph Espinola

    Size of objects being passed

    Ralph Espinola Newbie

      Does JBoss have a size limit on how big an object can be for it to be passed from server to client through EJB?

      Thanks.

        • 2. Re: Size of objects being passed
          Ralph Espinola Newbie

          The reason I ask is that I try to send back a large object to a client and the client reports the following:

          java.rmi.ServerError: Error occurred in server thread; nested exception is:
          java.lang.OutOfMemoryError
          java.lang.OutOfMemoryError
          at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
          at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
          ...

          This happens right at the code that returns to the client from the server. Right before I send the object back, I check the free memory and I have over 8Gigs left (-Xms8G -Xmx10G) The object being sent is about 300 megs. I also have a try catch block for OutOfMemoryError's on the server side code, wrapped around the return, and I get no errors on the JBoss console. I am using JBoss3.0.0.

          Any ideas??

          • 3. Re: Size of objects being passed
            Greg Turner Apprentice

            Given that you have a lot of memory, this looks like some kind of infinite loop kind of problem. Something keeps getting called over and over, allocating memory. You don't say what your object is, but perhaps its got something in it that causes this. For kicks, write a simple app with main that serializes your object to a file and then read it back in again.

            • 4. Re: Size of objects being passed
              Ralph Espinola Newbie

              I am dealing with BufferedImages that I serialize to pass back to the client. I took your advice and did the serializing and deserializing on the server as a test and it all seems to be working fine, i get the original image and everything. But whenever i try to pass the serialized bufferedImage back to the client it bombs.

              I ran it with jdk1.4.0 and got this message:

              java.rmi.ServerError: Error occurred in server thread; nested exception is:
              java.lang.OutOfMemoryError
              at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java)
              at sun.rmi.transport.Transport$1.run(Transport.java)
              ...
              Caused by: java.lang.OutOfMemoryError
              at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java)
              at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java)
              at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java)

              • 5. Re: Size of objects being passed
                Greg Turner Apprentice

                I am at a loss to understand what you are doing because BufferedImage class is not even Serializable.

                • 6. Re: Size of objects being passed
                  Ralph Espinola Newbie

                  I made a serializable class that holds the BufferedImage data so that I was able to pass it over the network.

                  • 7. Re: Size of objects being passed
                    Juha Lindfors Master

                    hmm, well I guess you need to try to track down where the memory is spent, using a tool like OptimizeIt, or try to play with the image sizes to see where the memory threshold is.

                    • 8. Re: Size of objects being passed
                      Ralph Espinola Newbie

                      Someone suggested to me that I increase my permanent heap size with the command:

                      java -XX:MaxPermSize=XXm

                      But after digging around, I found that the JVM I am using, IBM's JDK, does not support any options to increase the permanent heap size. Arrrggghhhh!