Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues
Bug 797 - Client deadlock when handling big reply
Summary: Client deadlock when handling big reply
Status: RESOLVED FIXED
Alias: None
Product: JacORB
Classification: Unclassified
Component: ORB (show other bugs)
Version: 2.3.0 beta 2
Hardware: PC Linux
: P2 normal
Assignee: Gerald Brose
URL:
Depends on:
Blocks:
 
Reported: 2007-07-27 20:41 UTC by ciju john
Modified: 2013-06-17 11:21 UTC (History)
1 user (show)

See Also:


Attachments
Big reply client deadlock demo (9.24 KB, application/octet-stream)
2007-07-27 20:43 UTC, ciju john
Details
revised test case (3.38 KB, application/octet-stream)
2012-07-12 17:31 UTC, Phil Mesnier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ciju john 2007-07-27 20:41:46 UTC
The problem occurs when the
 JacORB client gets a BIG reply. In handling the big reply, the VM runs
 throws an java.lang.OutOfMemoryError exception

[jacorb.orb.giop] ERROR : unexpected exception during doWork
org.omg.CORBA.NO_MEMORY: java.lang.OutOfMemoryError: Java heap space
        at org.jacorb.orb.BufferManager.getBuffer(BufferManager.java:252)
        at org.jacorb.orb.BufferManager.getBuffer(BufferManager.java:208)
        at org.jacorb.orb.giop.GIOPConnection.getMessage(GIOPConnection.java:38\
8)
        at org.jacorb.orb.giop.GIOPConnection.receiveMessages(GIOPConnection.ja\
va:464)
        at org.jacorb.orb.giop.MessageReceptor.doWork(MessageReceptor.java:71)
        at org.jacorb.util.threadpool.ConsumerTie.run(ConsumerTie.java:61)
        at java.lang.Thread.run(Thread.java:595)

The client invocation hangs at this point instead of getting the
 CORBA.NO_MEMORY exception. A work around is to have a timeout
 on the invocation, however that brings out the real problem. In
 handling the java.lang.OutOfMemoryError the client thread just
 bails out without cleaning up the tcp buffer. In a big reply scenario,
 this backsup to the server and can potentially deadlock the server.
 At the minimum it will eat up server resources (memory, file
 descriptor etc.). A proper solution may be:

 1. Have the client first cleanup the current GIOP package from the
    tcp buffer.
 2. Once cleanup is done, throw a org.omg.CORBA.NO_MEMORY exception
    to the client app.

I will attach my test next. I have used a TAO based c++ server as I didn't want
a VM related issues there. This problem is independent of the VM version,
although different VM's may have slightly differing behavior. Bottom line at
some point the VM will exhaust all its heap and throw a OutOfMemoryError
exception, which point JacORB handles incorrectly.

Ciju
Comment 1 ciju john 2007-07-27 20:43:28 UTC
Created attachment 317 [details]
Big reply client deadlock demo
Comment 2 Phil Mesnier 2012-07-12 17:31:16 UTC
Created attachment 397 [details]
revised test case

The original test case no longer compiles with modern TAO. This update is appropriate for versions 2.x.x of TAO.
Comment 3 Nick Cross 2013-06-17 11:21:39 UTC
Marking as fixed now.

During testing improved logging under https://github.com/rnc/JacORB/commit/9a53e13cf1cfb5b21b45fb42739e72ad77507ab7