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

HTTP Api return Sever Error for stack command, InaccessibleObjectException: accessible: module java.base does not "opens java.lang" to unnamed module #2151

Closed
1 task done
ayoubeddafali opened this issue Apr 15, 2022 · 3 comments
Milestone

Comments

@ayoubeddafali
Copy link

ayoubeddafali commented Apr 15, 2022

  • I have searched the issues of this repository and believe that this is not a duplicate.

Environment

  • Arthas version: 3.6.0
  • Operating System version: Ubuntu 18.04
  • Java version of target JVM: openjdk version 17
  • Java version of JVM used to attach: openjdk version 17

Steps to reproduce this issue

  1. attach arthas to a running jvm , and export 8563 port .
  2. http api async_exec action with the following command "stack -n 1 *JsonSanitizer sanitizeString"

Expected Result

I expect to get the stack trace, like this one when running interactively :

Affect(class count: 1 , method count: 1) cost in 240 ms, listenerId: 21
Condition express: null , result: true
ts=2022-04-15 10:54:09;thread_name=http-nio-8080-exec-5;id=18;is_daemon=true;priority=5;TCCL=org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader@180da663
    @com.google.json.JsonSanitizer.sanitizeString()
        at com.google.json.JsonSanitizer.sanitize(JsonSanitizer.java:237)
        at com.google.json.JsonSanitizer.sanitize(JsonSanitizer.java:122)
        at com.google.json.JsonSanitizer.sanitize(JsonSanitizer.java:109)

Actual Result

Server Error

If there is an exception, please attach the exception trace:

In arthas.log there is this exception

http request error: /api
com.alibaba.arthas.deps.com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.75, class com.taobao.arthas.core.shell.term.impl.http.api.ApiResponse, write javaBean error, fastjson version 1.2.75, class com.taobao.arthas.core.command.model.StackModel, fieldName : 0, Unable to make field private java.lang.String java.lang.StackTraceElement.fileName accessible: module java.base does not "opens java.lang" to unnamed module @6145930e
	at com.alibaba.arthas.deps.com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:539)
	at com.alibaba.arthas.deps.com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
	at com.alibaba.arthas.deps.com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:312)
	at com.alibaba.arthas.deps.com.alibaba.fastjson.JSON.writeJSONString(JSON.java:1002)
	at com.alibaba.arthas.deps.com.alibaba.fastjson.JSON.writeJSONString(JSON.java:954)
	at com.alibaba.arthas.deps.com.alibaba.fastjson.JSON.writeJSONString(JSON.java:944)
	at com.taobao.arthas.core.shell.term.impl.http.api.HttpApiHandler.writeResult(HttpApiHandler.java:177)
	at com.taobao.arthas.core.shell.term.impl.http.api.HttpApiHandler.handle(HttpApiHandler.java:137)
	at com.taobao.arthas.core.shell.term.impl.http.HttpRequestHandler.channelRead0(HttpRequestHandler.java:80)
	at com.taobao.arthas.core.shell.term.impl.http.HttpRequestHandler.channelRead0(HttpRequestHandler.java:39)
	at com.alibaba.arthas.deps.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)

@ayoubeddafali
Copy link
Author

I couldn't reproduce the error when using java 8, so I am not sure if this is exclusive to version 17

@hengyunabc hengyunabc added this to the 3.6.1 milestone Apr 18, 2022
@hengyunabc
Copy link
Collaborator

When using jdk 17, this JVM option --add-opens java.base/java.lang=ALL-UNNAMED is required in many scenarios.

The next version will try to fix the fastjson problem.

@hengyunabc hengyunabc changed the title HTTP Api return Sever Error for stack command HTTP Api return Sever Error for stack command, InaccessibleObjectException: accessible: module java.base does not "opens java.lang" to unnamed module Apr 18, 2022
@ayoubeddafali
Copy link
Author

@hengyunabc, Thank you so much.

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