Open Hearen opened 5 years ago
Checked the mentioned (currently used ugly/stale termd which is packaged /Users/lhearen/.m2/repository/com/alibaba/middleware/termd-core/1.1.5/termd-core-1.1.5.jar
), but it's indeed ugly.
how the Web Console works now to handle requests and respond?
**/arthas/agent/AgentBootstrap.java
will be first started and using reflection in bind
method to load **/arthas/core/server/ArthasBootstrap.java
. bind
method, we invoke server bind
method to bind TelnetTermServer
and HttpTermServer
to specified IP and ports (telnetPort: 3658 httpPort: 8563). # start a demo listening at: 8000
$ javac Demo.java && java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000 Demo
# configure Arthas to start a remote debug named: demo-remote (port: 8000)
# and start bin/as.sh
# select the demo
https://github.com/alibaba/arthas/issues/222#issuecomment-429014000 debugging Arthas to re-produce the mentioned.
as.sh
selecting the target java Pid and start Arthas core with this Pid;**/arthas/core/Arthas.java
list all available VMs and locate the target VM and load the Arthas agent. as.sh
. JPDA_SUSPEND=y bin/as.sh debug
# configure remote debug named as: arthas-remote (port: 8888) to debug Arthas core.
# start to debug now
https://github.com/alibaba/arthas/issues/222#issue-369185026
ArthasBootstrap
in core booted and BuiltinCommandPack
added to resolvers
for later command location;TelnetTermServer
and HttpTermServer
, the ShellServerImpl will listen
and TelnetTermServer
, it will bind a termHandler
at specified IP and port with TermImpl TermImpl
will load the key map and command history from local config files waiting to readlines from console;ShellServerImpl.handleTerm
will bind TermServerTermHandler
for each *TermServer
(creating a new session with ShellImpl
by passing in the term
);ShellImpl
start to read line in handleTerm
, invoking term.readLine
with ShellLineHandler
;TermImpl
bind ShellLineHandler
to handle the new line;ShellLineHandler.handle
will handle the input by ShellImpl.createJob(tokens)
;GlobalJobControllerImpl.createJob(InternalCommandManager commandManager, List<CliToken> tokens, ShellImpl shell)
which will first invoke JobControllerImpl.createJob
and set the global options;JobControllerImpl.createJob
first create a process ProcessImpl
(locating the Command
, passing in all args, binding the AnnotatedCommandImpl
which is used to parse the annotated); JobImpl
to handle the request;ShellLineHandler.handle
will then run the job
if created successfully; JobImpl.run
will be invoked;ProcessImpl.run
will then be invoked (AnnotatedCommandImpl.cli
getting the CLI, command options will be parsed by CLI.parse
- default with DefaultCLI.DefaultParser
);CommandProcessTask(CommandProcessImpl)
will be created and started by ArthasBootstrap.getInstance().execute(task)
;
Why?