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
This commit is contained in:
Ray Greenwell
2004-02-13 19:10:54 +00:00
parent 3ae08bc60d
commit cd2d0ef47b
@@ -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)