SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
807 stars 171 forks source link

OutOfMemoryError We got #120

Closed caarto closed 8 years ago

caarto commented 8 years ago

hi there: for a long time working, we got a issue in RH in this morning, here is the log


09:33:16.682 [XNIO-1 task-5] ERROR org.restheart.handlers.ErrorHandler - Error handling the request
java.lang.OutOfMemoryError: null
    at java.util.zip.Deflater.init(Native Method) ~[na:1.8.0_60]
    at java.util.zip.Deflater.<init>(Deflater.java:171) ~[na:1.8.0_60]
    at io.undertow.conduits.DeflatingStreamSinkConduit.<init>(DeflatingStreamSinkConduit.java:85) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.conduits.GzipStreamSinkConduit.<init>(GzipStreamSinkConduit.java:44) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.handlers.encoding.GzipEncodingProvider$1.wrap(GzipEncodingProvider.java:39) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.handlers.encoding.GzipEncodingProvider$1.wrap(GzipEncodingProvider.java:36) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.handlers.encoding.AllowedContentEncodings.wrap(AllowedContentEncodings.java:100) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.handlers.encoding.AllowedContentEncodings.wrap(AllowedContentEncodings.java:37) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.HttpServerExchange$WrapperStreamSinkConduitFactory.create(HttpServerExchange.java:2300) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.HttpServerExchange.getResponseChannel(HttpServerExchange.java:1262) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.io.UndertowOutputStream.writeBufferBlocking(UndertowOutputStream.java:285) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.io.UndertowOutputStream.close(UndertowOutputStream.java:334) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.io.BlockingSenderImpl.close(BlockingSenderImpl.java:174) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.io.DefaultIoCallback.onComplete(DefaultIoCallback.java:54) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.io.BlockingSenderImpl.invokeOnComplete(BlockingSenderImpl.java:230) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.io.BlockingSenderImpl.send(BlockingSenderImpl.java:99) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.io.BlockingSenderImpl.send(BlockingSenderImpl.java:121) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.hal.AbstractRepresentationFactory.sendRepresentation(AbstractRepresentationFactory.java:47) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.collection.GetCollectionHandler.handleRequest(GetCollectionHandler.java:124) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.RequestDispacherHandler.handleRequest(RequestDispacherHandler.java:377) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.injectors.CollectionPropsInjectorHandler.handleRequest(CollectionPropsInjectorHandler.java:84) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.injectors.DbPropsInjectorHandler.handleRequest(DbPropsInjectorHandler.java:83) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.AccessManagerHandler.handleRequest(AccessManagerHandler.java:56) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.AuthTokenInjecterHandler.handleRequest(AuthTokenInjecterHandler.java:71) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:54) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:55) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:85) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.SecurityHandler.handleRequest(SecurityHandler.java:50) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.SecurityHandlerDispacher.handleRequest(SecurityHandlerDispacher.java:60) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.injectors.BodyInjectorHandler.handleRequest(BodyInjectorHandler.java:92) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.OptionsHandler.handleRequest(OptionsHandler.java:58) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.injectors.RequestContextInjectorHandler.handleRequest(RequestContextInjectorHandler.java:413) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.security.handlers.CORSHandler.handleRequest(CORSHandler.java:88) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.RequestLoggerHandler.handleRequest(RequestLoggerHandler.java:84) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.PipedHttpHandler.handleRequest(PipedHttpHandler.java:86) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:94) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.handlers.HttpContinueAcceptingHandler.handleRequest(HttpContinueAcceptingHandler.java:78) ~[restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.ErrorHandler.handleRequest(ErrorHandler.java:54) ~[restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72) [restheart.jar:2.0.0-SNAPSHOT]
    at org.restheart.handlers.GzipEncodingHandler.handleRequest(GzipEncodingHandler.java:65) [restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) [restheart.jar:2.0.0-SNAPSHOT]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793) [restheart.jar:2.0.0-SNAPSHOT]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

At the same time, we got a tomcat server crash, its log show that the RH did not response in that time,not read time out。

mkjsix commented 8 years ago

At first sight it seems to me the server was trying to return a too big response and the JVM had not enough heap space to perform the related data compression. To better identify the problem you have to understand what was the causing request and verify how big was the data.

Then try to check your memory settings by running:

$ java -XX:+PrintFlagsFinal -version | grep MaxHeapSize

In case you can try to increase the max heap with the -Xmx parameter (https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html)

mkjsix commented 8 years ago

Hi @caarto, any news on this?

ujibang commented 8 years ago

no enough information to analyze.

closing for now; @caarto reopen it if you find a way to reproduce it.

RusEu commented 6 years ago

got same problem, I have 200 documents in a database, each document size is about 160kb and I got a Java Heap OutOfMemory error every time I try to query this collection.

ujibang commented 6 years ago

Hi @RusEu , this is a very old issue.

Can you please open a new one with steps to reproduce?

(please note we have several installations with collections with hundreds of thousands of documents, and never had OutOfMemory, it must be something with your server; java isn't able to allocate enough memory.)