Skip to content

Commit

Permalink
Merge pull request #43 from qunarcorp/hot-fix
Browse files Browse the repository at this point in the history
Hot fix
  • Loading branch information
xleiy committed Sep 10, 2019
2 parents 2642ca0 + 03b6e81 commit 2738daf
Show file tree
Hide file tree
Showing 62 changed files with 642 additions and 367 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -36,6 +36,7 @@ Bistoury提供可视化页面实时查看机器和应用的各种信息,包括

## 使用文档
- [快速开始](docs/cn/quick_start.md)
- [git及maven配置](docs/cn/gitlab_maven.md)
- [在线debug](docs/cn/debug.md)
- [线程级cpu使用率监控](docs/cn/jstack.md)
- [命令使用文档](docs/cn/commands.md)
Expand Down
2 changes: 1 addition & 1 deletion bistoury-agent-common/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-agent-task/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-agent/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-application/bistoury-application-api/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury-application</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-application/bistoury-application-mysql/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury-application</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-application/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-attach-arthas/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Expand Up @@ -51,15 +51,15 @@ public class JarDebugClient implements InstrumentClient {

private static final String FILE_PROTOCOL = "file:";

private Map<String, ClassInfo> class_classInfo = Maps.newHashMap();
private final InstrumentInfo instrumentInfo;

private InstrumentInfo instrumentInfo;
private volatile Map<String, ClassInfo> classNameToClassInfoMapping = Maps.newHashMap();

JarDebugClient(InstrumentInfo instrumentInfo) {
this.instrumentInfo = instrumentInfo;
logger.info("start init jar debugg client");
try {
class_classInfo = initAllClassInfo(instrumentInfo, true);
classNameToClassInfoMapping = initAllClassInfo(instrumentInfo, true);
logger.info("success init jar decompiler client");
} catch (Exception e) {
destroy();
Expand All @@ -74,14 +74,14 @@ private Map<String, ClassInfo> initAllClassInfo(InstrumentInfo instrumentInfo, b
if (isLoadAll) {
classInfoMap = Maps.newHashMap();
} else {
classInfoMap = Maps.newHashMap(class_classInfo);
classInfoMap = Maps.newHashMap(classNameToClassInfoMapping);
}
Map<String, JarFile> jarFileMap = new HashMap<>();
Map<String, Optional<Properties>> mavenInfoMap = new HashMap<>();
try {
for (Class clazz : loadedClasses) {
final String clazzName = clazz.getName();
if (Strings.isNullOrEmpty(clazzName) || clazzName.startsWith("[") || clazzName.indexOf("$") >= 0) {
if (Strings.isNullOrEmpty(clazzName) || clazzName.startsWith("[") || clazzName.contains("$")) {
continue;
}

Expand Down Expand Up @@ -111,7 +111,7 @@ private Map<String, ClassInfo> initAllClassInfo(InstrumentInfo instrumentInfo, b
}

public Set<String> getAllClass() {
return ImmutableSet.copyOf(class_classInfo.keySet());
return ImmutableSet.copyOf(classNameToClassInfoMapping.keySet());
}

/**
Expand All @@ -121,8 +121,7 @@ public Set<String> getAllClass() {
*/
public boolean reloadAllClass() {
logger.info("begin reload all class");
Map<String, ClassInfo> tmpClassInfo = initAllClassInfo(instrumentInfo, true);
class_classInfo = tmpClassInfo;
classNameToClassInfoMapping = initAllClassInfo(instrumentInfo, true);
logger.info("end reload all class");
return true;
}
Expand All @@ -134,15 +133,14 @@ public boolean reloadAllClass() {
*/
public boolean reLoadNewClass() {
logger.info("begin reload new class");
Map<String, ClassInfo> tmpClassInfo = initAllClassInfo(instrumentInfo, false);
class_classInfo = tmpClassInfo;
classNameToClassInfoMapping = initAllClassInfo(instrumentInfo, false);
logger.info("end reload new class");
return true;
}


public ClassInfo getClassPath(final String className) {
return class_classInfo.get(className);
return classNameToClassInfoMapping.get(className);
}

private ClassInfo getClassInfo(Class clazz, Map<String, JarFile> jarFileMap, Map<String, Optional<Properties>> mavenInfoMap) {
Expand Down
Expand Up @@ -113,12 +113,16 @@ public Class<?> get() {
}

public static synchronized void destroy() {
if (instrumentInfo != null) {
instrumentInfo.reset();
try {
if (instrumentInfo != null) {
instrumentInfo.reset();

for (InstrumentClient client : clients) {
client.destroy();
for (InstrumentClient client : clients) {
client.destroy();
}
}
} catch (Exception e) {
logger.error("", "destroy error", e);
}
}
}
Expand Up @@ -124,6 +124,10 @@ public void bind(Configure configure) throws Throwable {
if (shellServer != null) {
shellServer.close();
}

InstrumentClientStore.destroy();

isBindRef.compareAndSet(true, false);
throw e;
}
}
Expand Down
Expand Up @@ -48,11 +48,7 @@ public void process(CommandProcess process) {
// ignore
}

try {
InstrumentClientStore.destroy();
} catch (Exception e) {
// ignore
}
InstrumentClientStore.destroy();

process.write("bistoury Server is going to shut down...\n");
} finally {
Expand Down
2 changes: 1 addition & 1 deletion bistoury-attach-common/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-clientside-common/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-commands/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-common/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Expand Up @@ -38,8 +38,8 @@ public class AsyncHttpClientHolder {

private static final AsyncHttpClient INSTANCE = initClient();

private static final int CONN_TIMEOUT = 1000;
private static final int REQUEST_TIMEOUT = 2000;
private static final int CONN_TIMEOUT = 2000;
private static final int REQUEST_TIMEOUT = 3000;
private static final int READ_TIMEOUT = Integer.MAX_VALUE;

private static final int BOSS_COUNT = 1;
Expand Down
Expand Up @@ -56,7 +56,7 @@ public class BistouryConstants {
public static final String SPY_CLASSNAME = "qunar.tc.bistoury.instrument.spy.BistourySpys1";

// todo: 先这么写吧
public static final String CURRENT_VERSION = "2.0.5";
public static final String CURRENT_VERSION = "2.0.6";

public static final String BISTOURY_VERSION_LINE_PREFIX = "bistoury version:";

Expand Down
Expand Up @@ -19,6 +19,7 @@

import com.google.common.base.Charsets;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import com.google.common.io.Files;

Expand Down Expand Up @@ -59,31 +60,25 @@ public static List<File> listFile(File file, Predicate<File> filter) {
return result;
}

private static void listFile(List<String> result, File file) {
if (file.isDirectory()) {
File[] files = file.listFiles();
if (files == null)
return;

for (File f : files) {
listFile(result, f);
}
} else {
result.add(file.getName());
private static void listFile(List<String> resultNames, File file) {
List<File> resultFiles = Lists.newArrayList();
listFile(resultFiles, file, Predicates.<File>alwaysTrue());
for (File resultFile : resultFiles) {
resultNames.add(resultFile.getName());
}
}

private static void listFile(List<File> result, File file, Predicate<File> filter) {
private static void listFile(List<File> resultFiles, File file, Predicate<File> filter) {
if (file.isDirectory()) {
File[] files = file.listFiles();
if (files == null) {
return;
}
for (File f : files) {
listFile(result, f, filter);
listFile(resultFiles, f, filter);
}
} else if (filter.apply(file)) {
result.add(file);
resultFiles.add(file);
}
}

Expand Down
2 changes: 1 addition & 1 deletion bistoury-decompiler-fernflower/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-dist/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-independent-agent/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-instrument-agent/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Expand Up @@ -325,6 +325,6 @@ private static void bind(Instrumentation inst, ClassLoader agentLoader, String a
throw e;
}
}
ps.println("Arthas server already bind.");
ps.println("Bistoury server already bind.");
}
}
2 changes: 1 addition & 1 deletion bistoury-instrument-client/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-instrument-spy/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bistoury-magic-classes/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>bistoury</artifactId>
<groupId>qunar.tc.bistoury</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit 2738daf

Please sign in to comment.