Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引导类加载器加载的类无法被sandbox增强 #168

Closed
z529192557 opened this issue Apr 17, 2019 · 2 comments
Closed

引导类加载器加载的类无法被sandbox增强 #168

z529192557 opened this issue Apr 17, 2019 · 2 comments

Comments

@z529192557
Copy link
Collaborator

BootstrapClassLoader 加载的类无法被sandbox注入, ASMUtils 30行报 NPE异常,
分析是 ClassFileTransformer.transform 该方法第一个loader在是BootstrapClassLoader时,为null,该null loader 透传到了ASMUtils 导致 NPE

@z529192557
Copy link
Collaborator Author

异常堆栈
2019-04-17 15:04:46 default WARN transform sun/net/www/protocol/http/HttpURLConnection failed, by module=http-url-connect in loader=null
java.lang.NullPointerException: null
at com.alibaba.jvm.sandbox.core.util.AsmUtils.getCommonSuperClassImplByAsm(AsmUtils.java:30)
at com.alibaba.jvm.sandbox.core.util.AsmUtils.getCommonSuperClass(AsmUtils.java:23)
at com.alibaba.jvm.sandbox.core.enhance.EventEnhancer$1.getCommonSuperClass(EventEnhancer.java:52)
at org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1198)
at org.objectweb.asm.Frame.merge(Frame.java:1294)
at org.objectweb.asm.Frame.merge(Frame.java:1175)
at org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1617)
at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1553)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2426)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:679)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
at com.alibaba.jvm.sandbox.core.enhance.EventEnhancer.toByteCodeArray(EventEnhancer.java:100)
at com.alibaba.jvm.sandbox.core.manager.impl.SandboxClassFileTransformer._transform(SandboxClassFileTransformer.java:135)
at com.alibaba.jvm.sandbox.core.manager.impl.SandboxClassFileTransformer.transform(SandboxClassFileTransformer.java:92)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
at com.alibaba.jvm.sandbox.core.manager.impl.DefaultModuleEventWatcher.reTransformClasses(DefaultModuleEventWatcher.java:119)
at com.alibaba.jvm.sandbox.core.manager.impl.DefaultModuleEventWatcher.watch(DefaultModuleEventWatcher.java:200)
at com.alibaba.jvm.sandbox.core.manager.impl.DefaultModuleEventWatcher.watch(DefaultModuleEventWatcher.java:166)
at com.alibaba.jvm.sandbox.api.listener.ext.EventWatchBuilder.build(EventWatchBuilder.java:764)
at com.alibaba.jvm.sandbox.api.listener.ext.EventWatchBuilder.access$400(EventWatchBuilder.java:35)
at com.alibaba.jvm.sandbox.api.listener.ext.EventWatchBuilder$BuildingForBehavior.onWatch(EventWatchBuilder.java:633)
at com.alibaba.jvm.sandbox.module.debug.HttpURLConnectModule.repairCheckState(HttpURLConnectModule.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.alibaba.jvm.sandbox.core.server.jetty.servlet.ModuleHttpServlet.doMethod(ModuleHttpServlet.java:119)
at com.alibaba.jvm.sandbox.core.server.jetty.servlet.ModuleHttpServlet.doGet(ModuleHttpServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:594)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:351)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:748)

@z529192557 z529192557 changed the title 引导类加载器加载的类无法被sandbox注入 引导类加载器加载的类无法被sandbox增强 Apr 17, 2019
z529192557 pushed a commit to z529192557/jvm-sandbox that referenced this issue Apr 18, 2019
@oldmanpushcart
Copy link
Collaborator

1.2.2版本解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants