Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    com.isomorphic.servlet.ProxyServletOutputStream may be causing out of memory problems

    Hi,

    I'm trying to call a custom servlet to execute a download of a very large file (> 500 MB for now). But I keep getting an OutOfMemory error, and I believe that the reason may be because of the code in the com.isomorphic.servlet.ProxyServletOutputStream class. (See error log below). Since I can't see the code of that class (because there's no source code available, right?), I wanted to know how I can get rid of that class from being part of the code that handles this servlet call. (To the best of my knowledge, this isomorphic class should not be handling my servlet call, since it's my custom servlet is mapped to a url called /imageServlet, and I don't think any Isomorphic servlet should be looking at that url, right?)

    On a different note, if there's an approved SmartGWT way of calling a custom server-side class that does stuff (eg zips the files) before serving up the file to be downloaded, please let me know. (Note: In this case, the file size is NOT known ahead of time, so the file should be automicatlly chunked by the webserver container; I think the isomorphic servlet ProxyServletOutputStream is somehow preventing this from occurring.)

    Code:
    [ERROR] Error for /imageServlet
    java.lang.OutOfMemoryError: Java heap space
    	at java.util.Arrays.copyOf(Arrays.java:2786)
    	at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
    	at com.isomorphic.servlet.ProxyServletOutputStream.write(ProxyServletOutputStream.java:65)
    	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
    	at com.smartgwt.sample.server.ImageServlet.doGet(ImageServlet.java:42)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       [ERROR] Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)

    ==============
    Tech Details:
    ==================
    SmartClient Version: SC_SNAPSHOT-2011-12-05/PowerEdition Deployment (built 2011-12-05)
    Browser: Mozilla Firefox 4.0.1

    #2
    You've got the CompressionFilter installed for that URL, so that's going to buffer all data in order to compress it. Disable the CompressionFilter for the URL that will return this large result.

    In general, if you are in a DMI and you want to take over the servletResponse outputStream and do your own thing, call RPCManager.doCustomResponse().

    Comment

    Working...
    X