Skip to content

Commit

Permalink
Improve JVMCrashByEAVServlet
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tamura committed Feb 13, 2017
1 parent aa4efd4 commit a2cc9fd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.t246osslab.easybuggy.troubles;

import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
Expand All @@ -11,31 +10,26 @@
import javax.servlet.http.HttpServletResponse;

import org.pmw.tinylog.Logger;
import org.t246osslab.easybuggy.utils.Closer;
import org.t246osslab.easybuggy.utils.HTTPResponseCreator;
import org.t246osslab.easybuggy.utils.MessageUtils;

//import sun.dc.path.PathConsumer;
//import sun.dc.pr.PathDasher;
import sun.misc.Unsafe;

@SuppressWarnings("serial")
@WebServlet(urlPatterns = { "/jvmcrasheav" })
public class JVMCrashByEAVServlet extends HttpServlet {

protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
// PathDasher dasher = new PathDasher(null);
PrintWriter writer = null;

try {
Class<?> cl = Class.forName("sun.dc.pr.PathDasher");
Class<?> cl2 = Class.forName("sun.dc.path.PathConsumer");
Constructor<?> cunstructor = cl.getConstructor(new Class[] { cl2 });
cunstructor.newInstance(new Object[] { null });
getUnsafe().getByte(0);
} catch (Exception e) {
Logger.error(e);
HTTPResponseCreator.createSimpleResponse(res, null,
MessageUtils.getMsg("msg.info.jvm.not.crash", req.getLocale()));
} finally {
Closer.close(writer);
}
}

private static Unsafe getUnsafe()
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
Field singleoneInstanceField = Unsafe.class.getDeclaredField("theUnsafe");
singleoneInstanceField.setAccessible(true);
return (Unsafe) singleoneInstanceField.get(null);
}
}
5 changes: 2 additions & 3 deletions src/main/resources/indexpage_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ function.name.dead.lock2=Dead Lock (SQL)
function.description.dead.lock2=Dead lock (SQL) occurs after loading the page few times.
function.name.endless.waiting.process=Endless Waiting Process
function.description.endless.waiting.process=Endless waiting process occurs after loading the page.
function.name.jvm.crash.eav=JVM Crash (EXCEPTION_ACCESS_VIOLATION)
function.description.jvm.crash.eav=JVM crashes after clicking this link.<br>\
(* JVM crash only occurs if using Oracle JDK 6 or 7)
function.name.jvm.crash.eav=JVM Crash
function.description.jvm.crash.eav=JVM crashes after clicking this link.
function.name.redirect.loop=Redirect Loop
function.description.redirect.loop=Redirect loop occurs after clicking this link.
function.name.network.socket.leak=Network Socket Leak
Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/indexpage_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ function.name.dead.lock2=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af (SQL)
function.description.dead.lock2=\u30da\u30fc\u30b8\u3092\u6570\u56de\u30ed\u30fc\u30c9\u3059\u308b\u3068\u3001\u30c7\u30c3\u30c9\u30ed\u30c3\u30af(SQL)\u304c\u767a\u751f\u3057\u307e\u3059\u3002
function.name.endless.waiting.process=\u5b8c\u4e86\u3057\u306a\u3044\u30d7\u30ed\u30bb\u30b9\u306e\u5f85\u6a5f
function.description.endless.waiting.process=\u30da\u30fc\u30b8\u3092\u30ed\u30fc\u30c9\u3059\u308b\u3068\u3001\u5b8c\u4e86\u3057\u306a\u3044\u30d7\u30ed\u30bb\u30b9\u306e\u5f85\u6a5f\u304c\u767a\u751f\u3057\u307e\u3059\u3002
function.name.jvm.crash.eav=JVM\u30af\u30e9\u30c3\u30b7\u30e5 (EXCEPTION_ACCESS_VIOLATION)
function.description.jvm.crash.eav=\u3053\u306e\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068JVM\u304c\u30af\u30e9\u30c3\u30b7\u30e5\u3057\u307e\u3059\u3002<br> \
(* JVM\u306e\u30af\u30e9\u30c3\u30b7\u30e5\u306f\u3001Oracle JDK 6\u307e\u305f\u306f7\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306b\u306e\u307f\u767a\u751f\u3057\u307e\u3059)
function.name.jvm.crash.eav=JVM\u30af\u30e9\u30c3\u30b7\u30e5
function.description.jvm.crash.eav=\u3053\u306e\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068JVM\u304c\u30af\u30e9\u30c3\u30b7\u30e5\u3057\u307e\u3059\u3002
function.name.redirect.loop=\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u30eb\u30fc\u30d7
function.description.redirect.loop=\u3053\u306e\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u30eb\u30fc\u30d7\u304c\u767a\u751f\u3057\u307e\u3059\u3002
function.name.network.socket.leak=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30bd\u30b1\u30c3\u30c8\u30ea\u30fc\u30af
Expand Down

0 comments on commit a2cc9fd

Please sign in to comment.