This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.sun.btrace.annotations.*; | |
| import static com.sun.btrace.BTraceUtils.*; | |
| /** | |
| * 症状: Spring容器启动时,hikari连接池起不来,日志如下: | |
| * 2018-10-09 14:40:28.929 INFO [main][HikariDataSource.java:103] - HikariCP pool HikariCP is starting. | |
| * 2018-10-09 14:40:33.114 INFO [main][BaseHikariPool.java:265] - HikariCP pool HikariCP is shutting down. | |
| * Spring Exception encountered during context initialization - " + | |
| * * "cancelling refresh attempt: xxxx | |
| * <p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 结论: | |
| 从JDK7开始,count的值就不再直接在String中维护了. | |
| http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/b2317f5542ce/src/share/classes/java/lang/String.java#l658 | |
| 在OSX(64bit上) | |
| 1.6.0_65: | |
| char[] value | |
| int hash | |
| int count | |
| int offset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 测试【command &】 | |
| 结论: | |
| 1)将父进程设置为init进程,不堵塞原父进程. | |
| 2)stdout 和 stderr 依旧对应着终端, 如果对端退出,通过lsof可看到状态为 Deleted | |
| #run session | |
| root@server2:~# tty | |
| /dev/pts/4 | |
| root@server2:~# cat daemon.sh | |
| tail -f /dev/null & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.lang.management.ManagementFactory; | |
| import java.lang.management.RuntimeMXBean; | |
| import java.util.List; | |
| /** | |
| * -XX:PretenureSizeThreshold 控制直接在Old区分配内存的大对象的阈值, | |
| * 但只在DefNew 或者 ParNew 收集器下工作. | |
| */ | |
| public class PretenureSizeThresholdDemo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 用Arthas jad 命令反编译代码. | |
| 发现Bytebuddy在java.lang.System的静态构造器里增加了代码,然后把native方法 java.lang.System#currentTimeMillis 的方法体修改为 return 0; | |
| $ jad java.lang.System | |
| ClassLoader: | |
| Location: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.sun.btrace.annotations.*; | |
| import static com.sun.btrace.BTraceUtils.*; | |
| /** | |
| * 症状: redis.clients.jedis.JedisPool#getResource 爆出异常时, | |
| * 只有 redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool | |
| * 没有 内部异常(Cause by),需要定位内部异常以排查问题. | |
| * <p> | |
| * 原因:使用一个经过二次封装的低版本Jedis. | |
| * 封装者重抛异常时丢掉了原始异常(这是一个处理异常的坏习惯)。 |
NewerOlder