Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004011 [Hessian] major always 04-21-10 05:33 06-06-12 01:06
Reporter schatterjee View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 3.1.6
Summary 0004011: Server Exceptions Not getting passed to client (Found root cause and possible Fix)
Description Problem Description
-------------------
Server side exception could not be serialized to cilent side.
Even if we throw SabaException from our Server, the client is receiving ?org.springframework.remoting.RemoteAccessException?.


Root Cause
-----------
1. On investigation we found that there were a problem in serialization of exceptions in Hessian 2.0 Protocol.
2. Hessian was using buffers to serialize the exception and the buffer was flushed to output streams only if the buffer was full.
3. There was a problem during serialization of StackTraceElement
4. On completion of serialization the buffer was not flushed, due to which incomplete serialized exception was being sent to client.
5. As a result client gets exception ?readObject: unexpected end of file? while de-serializing the exception and it results in RemoteAccessException

Solution
-------
1. We fixed the issue by adding a flush() statement at the end of writeFault() method in Hessian2Output.java

Please advise if this fix is right or not and when can we expect a formal fix for this.


I have attached both the original source code and modified source code for Hessian2Output.java
Additional Information There is already a bug reported for same error -> 0003030: Server side exception could not be serialized to cilent side. (http://bugs.caucho.com/view.php?id=3030) [^]


Attached Files  Hessian2Output_Fixed.java [^] (34,813 bytes) 04-21-10 05:33
 Hessian2Output.java [^] (34,822 bytes) 04-21-10 05:33

- Relationships

- Notes
(0004539)
schatterjee
04-21-10 05:39
edited on: 04-21-10 05:42

I am using Hessian 3.1.6 and Spring 2.5.2

Related bug reported earlier --> http://bugs.caucho.com/view.php?id=3030 [^]

 
(0005807)
ccampo
06-06-12 01:06

We had the same kind of problem. However I think the problem is different one. The problem is that the HessianServlet does not close the out.stream if there is an exception.

HessianServlet calls out.close() (line 398) only if everything is ok. In the case of an exception no close is called and no buffer is flushed. So the correct solution is to put the out.close in a finally {} block in HessianServlet. (We replaced HessianServlet with our own implementation and did just that.
 

- Issue History
Date Modified Username Field Change
04-21-10 05:33 schatterjee New Issue
04-21-10 05:33 schatterjee File Added: Hessian2Output_Fixed.java
04-21-10 05:33 schatterjee File Added: Hessian2Output.java
04-21-10 05:39 schatterjee Note Added: 0004539
04-21-10 05:42 schatterjee Note Added: 0004540
04-21-10 05:42 schatterjee Note Edited: 0004539
04-21-10 05:42 schatterjee Note Deleted: 0004540
06-06-12 01:06 ccampo Note Added: 0005807


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
36 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker