xulunfan / memcached-session-manager

Automatically exported from code.google.com/p/memcached-session-manager
0 stars 0 forks source link

Add really helpful log message to diagnose serialization problems. #219

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please add a key log message to help diagnose problems when MSM will silently 
fail to store sessions.

1. Put things in your session that can't be serialized.
2. Enable MSM and watch it not work silently.

What is the expected output? What do you see instead?
I see this:FINE: Starting for session id 
023D38178F52D22676A2EC0C825CB371-n0.ip-10-1-49-49
Nov 19, 2014 1:04:32 PM de.javakaffee.web.msm.BackupSessionTask call
FINE: Starting for session id 023D38178F52D22676A2EC0C825CB371-n0.ip-10-1-49-49
Nov 19, 2014 1:04:32 PM de.javakaffee.web.msm.BackupSessionTask call
FINE: Starting for session id 023D38178F52D22676A2EC0C825CB371-n0.ip-10-1-49-49

I need to see this:
Nov 19, 2014 2:25:36 PM de.javakaffee.web.msm.BackupSessionTask call
FINE: Starting for session id 11864A559B4296BB88B0B37EB1A0157B-n0.ip-10-1-49-49
Nov 19, 2014 2:25:36 PM de.javakaffee.web.msm.BackupSessionTask call
FINE: FAILED for session id 11864A559B4296BB88B0B37EB1A0157B-n0.ip-10-1-49-49
com.esotericsoftware.kryo.SerializationException: Unable to serialize object of 
type: java.util.concurrent.ConcurrentHashMap
        at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:524)
        at com.esotericsoftware.kryo.ObjectBuffer.writeObject(ObjectBuffer.java:251)

[NOTE: the ConcurrentHashMap isn't the problem, I have a hibernate lazy object 
in the map that can't be serialized]

Using the latest git source (1.8.4-SNAPSHOT) from git on CentOS as of 
19-Nov-2014.

Please add the following (or something similar) to BackupSessionTask.java on or 
around line 150.  Patch file attached.

--- a/core/src/main/java/de/javakaffee/web/msm/BackupSessionTask.java
+++ b/core/src/main/java/de/javakaffee/web/msm/BackupSessionTask.java
@@ -148,7 +148,11 @@ public class BackupSessionTask implements 
Callable<BackupResult> {

             return result;

-        } finally {
+        } catch (Exception e) {
+            _log.warn("FAILED for session id " + _session.getId(), e);
+            throw e;
+        }
+        finally {
             _session.setBackupRunning( false );
             releaseLock();
         }

Original issue reported on code.google.com by tjordahl@gmail.com on 19 Nov 2014 at 10:36

Attachments:

GoogleCodeExporter commented 9 years ago
Good catch! Can you submit a pull request please?

Original comment by martin.grotzke on 19 Nov 2014 at 11:36

GoogleCodeExporter commented 9 years ago
Sent Pull request:
https://github.com/magro/memcached-session-manager/pull/42

Original comment by tjordahl@gmail.com on 20 Nov 2014 at 4:01

GoogleCodeExporter commented 9 years ago
Here ya go
https://github.com/magro/memcached-session-manager/pull/42

Tom Jordahl

On Wed, Nov 19, 2014 at 6:36 PM, <memcached-session-manager@googlecode.com>
wrote:

Original comment by tjordahl@gmail.com on 20 Nov 2014 at 4:01

GoogleCodeExporter commented 9 years ago
Merged, thanks!

Original comment by martin.grotzke on 20 Nov 2014 at 7:03