From cd2d0ef47ba3fe7440389fdcb4d681da2b06aa0b Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 13 Feb 2004 19:10:54 +0000 Subject: [PATCH] Completely hacky debugging code added to help me figure out why intro pirates sometimes (never on my server!) released twice. This will save the stack trace from the first release and spit it out after the "normal" error-reporting stack trace from the second release. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2955 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/ClientManager.java | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/presents/server/ClientManager.java b/src/java/com/threerings/presents/server/ClientManager.java index ce2157117..cd2172bb0 100644 --- a/src/java/com/threerings/presents/server/ClientManager.java +++ b/src/java/com/threerings/presents/server/ClientManager.java @@ -1,8 +1,13 @@ // -// $Id: ClientManager.java,v 1.33 2003/08/20 19:30:52 mdb Exp $ +// $Id: ClientManager.java,v 1.34 2004/02/13 19:10:54 ray Exp $ package com.threerings.presents.server; +// imports for hackery TODO: remove +import java.util.Date; +import com.samskivert.util.Tuple; +// end: hackery imports + import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -251,6 +256,25 @@ public class ClientManager Log.warning("Requested to release unmapped client object " + "[username=" + username + "]."); Thread.dumpStack(); + + // hackery. TODO: remove! + if (isIntro(username)) { + Tuple t = (Tuple) _hackyStacks.remove(username); + if (t == null) { + Log.warning("There was no previous request to free this " + + "intro pirate?"); + } else { + String timestamp = (String) t.left; + StackTraceElement[] trace = + (StackTraceElement[]) t.right; + Throwable walden = new Throwable(); + walden.setStackTrace(trace); + Log.warning("Last release happened at " + timestamp); + Log.logStackTrace(walden); + } + } + // end: hackery + return; } @@ -260,6 +284,14 @@ public class ClientManager return; } + // hackery. TODO: remove + if (isIntro(username)) { + Throwable walden = new Throwable(); + Tuple t = new Tuple(new Date().toString(), walden.getStackTrace()); + _hackyStacks.put(username, t); + } + // end: hackery + Log.debug("Destroying client " + clobj.who() + "."); // we're all clear to go; remove the mapping @@ -269,6 +301,23 @@ public class ClientManager PresentsServer.omgr.destroyObject(clobj.getOid()); } + + // HACKERY to track some stuff down + // TODO: remove! + protected boolean isIntro (String username) + { + return username.startsWith("Intro ") || + username.startsWith("Sensei ") || + username.startsWith("Captain ") || + username.startsWith("Weathered ") || + username.startsWith("Aged ") || + username.startsWith("Wise "); + } + + protected HashMap _hackyStacks = new HashMap(); + // END: HACKERY + + // documentation inherited public synchronized void connectionEstablished ( Connection conn, AuthRequest req, AuthResponse rsp)