Archived
This forum has been archived. Please start a new discussion on GitHub.
OutMemoryException from the Ice 3.4.1 for java
I use a work thread by 'amd' in server-side, the error as following. How can I do for this?!
-- 11-5-8 21:15:49:550 Server: Network: received 14 of 14 bytes via tcp
local address = 127.0.0.1:10002
remote address = 127.0.0.1:50758
-- 11-5-8 21:15:49:565 Server: Network: received 71 of 71 bytes via tcp
local address = 127.0.0.1:10002
remote address = 127.0.0.1:50758
-- 11-5-8 21:15:49:565 Server: Protocol: received request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 85
request id = 5
identity = Search
facet =
operation = singalSearch
mode = 0 (normal)
context =
-! 11-5-8 21:15:49:565 Server: warning: Thread-12: dispatch exception:
identity: Search
facet:
operation: singalSearch
Ice.MarshalException
reason = "OutOfMemoryError occurred while allocating a ByteBuffer"
at IceInternal.Buffer.reserve(Buffer.java:164)
at IceInternal.Buffer.(Buffer.java:73)
at IceInternal.Buffer.expand(Buffer.java:60)
at IceInternal.BasicStream.expand(BasicStream.java:2067)
at IceInternal.BasicStream.writeBlob(BasicStream.java:615)
at Engine.METAHelper.write(METAHelper.java:34)
at Engine.ResultNode.__write(ResultNode.java:119)
at Engine._AMD_SearchTile_singalSearch.ice_response(_AMD_SearchTile_singalSearch.java:39)
at WorkThread.run(WorkThread.java:29)
Caused by: java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Unknown Source)
at java.nio.DirectByteBuffer.<init>(Unknown Source)
at java.nio.ByteBuffer.allocateDirect(Unknown Source)
at IceInternal.Buffer.reserve(Buffer.java:138)
... 8 more
-- 11-5-8 21:15:49:550 Server: Network: received 14 of 14 bytes via tcp
local address = 127.0.0.1:10002
remote address = 127.0.0.1:50758
-- 11-5-8 21:15:49:565 Server: Network: received 71 of 71 bytes via tcp
local address = 127.0.0.1:10002
remote address = 127.0.0.1:50758
-- 11-5-8 21:15:49:565 Server: Protocol: received request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 85
request id = 5
identity = Search
facet =
operation = singalSearch
mode = 0 (normal)
context =
-! 11-5-8 21:15:49:565 Server: warning: Thread-12: dispatch exception:
identity: Search
facet:
operation: singalSearch
Ice.MarshalException
reason = "OutOfMemoryError occurred while allocating a ByteBuffer"
at IceInternal.Buffer.reserve(Buffer.java:164)
at IceInternal.Buffer.(Buffer.java:73)
at IceInternal.Buffer.expand(Buffer.java:60)
at IceInternal.BasicStream.expand(BasicStream.java:2067)
at IceInternal.BasicStream.writeBlob(BasicStream.java:615)
at Engine.METAHelper.write(METAHelper.java:34)
at Engine.ResultNode.__write(ResultNode.java:119)
at Engine._AMD_SearchTile_singalSearch.ice_response(_AMD_SearchTile_singalSearch.java:39)
at WorkThread.run(WorkThread.java:29)
Caused by: java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Unknown Source)
at java.nio.DirectByteBuffer.<init>(Unknown Source)
at java.nio.ByteBuffer.allocateDirect(Unknown Source)
at IceInternal.Buffer.reserve(Buffer.java:138)
... 8 more
0
Comments
-
I set the property 'Ice.GC.Interval=30'. But I can't find any collector thread!
Attachment not found.0 -
Ice.GC.Interval is actually only for C++ ... we'll make this clearer in the Properties reference.
In other programming languages (like Java), Ice does not implement its own GC.
It's hard to say why your server is running out of memory. Perhaps your server accumulates AMD callbacks but never provide the response and release them?
Cheers,
Bernard0 -
Bernard,
My demo don't use any business process that just start a thread read from queue and response the request. I really can't find any wrong. Can you give me some sample codes about the Java 'AMD'. Thanks very much!0 -
Oh, my god! I find the reason: My 'LinkedTransferQueue' call ice_response and not release the callback interface. So I set the callback to null. Everything is OK!
Thanks bernard!
Ice is very beautiful thing! Like this! Hope Ice go on!
I want 'BuildingSeq.ice' can surpport offset and length for the array data.0 -
some topics are very useful:
http://www.zeroc.com/forums/help-center/3452-help-why-ice_response-amd-block.html
http://www.zeroc.com/forums/help-center/3452-help-why-ice_response-amd-block.html
http://www.zeroc.com/forums/help-center/3359-what-will-happen-when-ice-report-thread-pool-size-warning.html
http://www.zeroc.com/forums/help-center/2810-timeoutexception-throws-outgoing-cpp-183-a.html
If you never call ice_response or ice_exception, your client will never receive any response or exception, and your server will continue to grow in size (i.e., this is a memory/resource leak).
If there is a timeout configured for the client, your requests will eventually time out, and the whole connection is closed (since timeouts are treated as fatal connection errors, see our user manual for details).
Note that such client timeouts would not resolve any resource leaks in the server caused by incomplete AMD calls. You must make sure that your code calls either ice_response or ice_exception for every AMD call, otherwise your program will leak.0