Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001588 [Resin] minor sometimes 01-26-07 04:15 04-06-07 15:16
Reporter bjornm View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.1 Product Version 3.0.20
  Product Build
Summary 0001588: Hessian SerializerFactory HashMaps involved in 100% CPU infinite loop?
Description During load tests to HessianServlets, we've sometimes experienced that the jvm would hang with 100% cpu. Thread dumps showed many threads were busy in HashMap.get:

"http-0.0.0.0-8080-8" daemon prio=1 tid=0x465bfbd8 nid=0x64e2 runnable [0x3f371000..0x3f3721b0]
        at java.util.HashMap.get(HashMap.java:346)
        at com.caucho.hessian.io.SerializerFactory.getSerializer(SerializerFactory.java)
        at com.caucho.hessian.io.HessianOutput.writeObject(HessianOutput.java:315)
        at com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:242)
        at com.caucho.hessian.io.JavaSerializer.writeObject10(JavaSerializer.java:175)
        at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:157)
        at com.caucho.hessian.io.HessianOutput.writeObject(HessianOutput.java:317)
        at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:172)
        at com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:365)

A look at SerializerFactory shows it uses a set of hashmaps which are not synchronized:

  private HashMap _cachedSerializerMap;
  private HashMap _cachedDeserializerMap;
  private HashMap _cachedTypeDeserializerMap;

My guess is that if a HessianServlet receives many simultaneous calls during startup (when the maps are empty), concurrent read and write to the _cachedSerializerMap could cause this behavior. If this is the case, I suggest wrapping them in synchronizers:

_cachedDeserializerMap = Collections.synchronizedMap(new HashMap(8));

I have however been unable to reproduce this in some simple tests. Maybe someone who is more familiar with the code could advise.
Steps To Reproduce
Additional Information About infinite loops in unsynchronized HashMaps:
http://blogs.opensymphony.com/plightbo/2005/07/hashmapget_can_cause_an_infini.html [^]
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
01-26-07 04:15 bjornm New Issue
04-06-07 15:16 ferg Assigned To  => ferg
04-06-07 15:16 ferg Status new => closed
04-06-07 15:16 ferg Resolution open => fixed
04-06-07 15:16 ferg Fixed in Version  => 3.1.1


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