Usage:
jinfo [option]
(to connect to running process)
jinfo [option]
(to connect to a core file)
jinfo [option] [server_id@]
(to connect to remote debug server)
where
is one of:
-flag to print the value of the named VM flag
-flag [+|-] to enable or disable the named VM flag
-flag = to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
to print both of the above
-h | -help to print this help message
Usage:
jmap [option]
(to connect to running process)
jmap [option]
(to connect to a core file)
jmap [option] [server_id@]
(to connect to remote debug server)
where
is one of:
to print same info as Solaris pmap
-heap to print java heap summary
-histo[:live] to print histogram of java object heap; if the "live"
suboption is specified, only count live objects
-clstats to print class loader statistics
-finalizerinfo to print information on objects awaiting finalization
-dump: to dump java heap in hprof binary format
dump-options:
live dump only live objects; if not specified,
all objects in the heap are dumped.
format=b binary format
file= dump heap to
Example: jmap -dump:live,format=b,file=heap.bin
-F force. Use with -dump: or -histo
to force a heap dump or histogram when does not
respond. The "live" suboption is not supported
in this mode.
-h | -help to print this help message
-J to pass directly to the runtime system
Attaching to process ID 11304, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.271-b09
using thread-local object allocation.
Parallel GC with 10 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 3728736256 (3556.0MB)
NewSize = 78118912 (74.5MB)
MaxNewSize = 1242562560 (1185.0MB)
OldSize = 156762112 (149.5MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 157810688 (150.5MB)
used = 21083640 (20.10692596435547MB)
free = 136727048 (130.39307403564453MB)
13.360083697246159% used
From Space:
capacity = 5242880 (5.0MB)
used = 0 (0.0MB)
free = 5242880 (5.0MB)
0.0% used
To Space:
capacity = 13107200 (12.5MB)
used = 0 (0.0MB)
free = 13107200 (12.5MB)
0.0% used
PS Old Generation
capacity = 114294784 (109.0MB)
used = 18184528 (17.342117309570312MB)
free = 96110256 (91.65788269042969MB)
15.910199366578269% used
16895 interned Strings occupying 1655896 bytes.
jmap -finalizerinfo pid : 打印等待回收的对象信息
Attaching to process ID 11304, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.271-b09
Number of objects pending for finalization: 0
Attaching to process ID 11304, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.271-b09
finding class loader instances ..done.
computing per loader stat ..done.
please wait.. computing liveness.liveness analysis may be inaccurate ...
class_loader classes bytes parent_loader alive? type
2414 4203574 null live
0x00000006e1c34ac0 1 1472 null dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e1c37ac0 1 1471 null dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e1c3a7c0 1 1472 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e2541950 1 880 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e1c381c8 1 1471 null dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e24b1840 1 1474 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e24b4590 1 881 null dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e24aeca0 1 1472 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e24af7a0 1 1472 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e2966078 1 1474 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e1c34930 1 880 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e1c37930 1 1471 null dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e25414a0 1 1471 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e1c38038 1 1471 null dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
0x00000006e2964768 1 1471 0x00000006e1c0de70 dead sun/reflect/DelegatingClassLoader@0x00000007c000a0a0
total = 120 7243 11663417 N/A alive=1, dead=119 N/A
[root@administrator ~]# jhat -port 8083 /root/dump.hprof
Reading from /root/dump.hprof...
Dump file created Thu Oct 13 22:11:40 CST 2022
Snapshot read, resolving...
Resolving 250364 objects...
Chasing references, expect 50 dots..................................................
Eliminating duplicate references..................................................
Snapshot resolved.
Started HTTP server on port 8083
Server is ready.
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.311-b11 mixed mode):
"arthas-command-execute" #54 daemon prio=5 os_prio=0 tid=0x00007f4f480a6800 nid=0xca61 waiting on condition [0x00007f4f70843000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000c8585a18> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1081)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
"arthas-NettyHttpTelnetBootstrap-3-2" #53 daemon prio=5 os_prio=0 tid=0x00007f4f88796800 nid=0xb84d runnable [0x00007f4f70641000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked <0x00000000c85cbed8> (a com.alibaba.arthas.deps.io.netty.channel.nio.SelectedSelectionKeySet)
- locked <0x00000000c85cbec8> (a java.util.Collections$UnmodifiableSet)
- locked <0x00000000c85cbe80> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
at com.alibaba.arthas.deps.io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:68)
at com.alibaba.arthas.deps.io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:813)
at com.alibaba.arthas.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at com.alibaba.arthas.deps.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
at com.alibaba.arthas.deps.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at com.alibaba.arthas.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
"arthas-UserStat" #51 daemon prio=9 os_prio=0 tid=0x00007f4f60527800 nid=0xb83f waiting on condition [0x00007f4f5818a000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000c85cc408> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
"arthas-session-manager" #50 daemon prio=9 os_prio=0 tid=0x00007f4f60520000 nid=0xb83c waiting on condition [0x00007f4f5828b000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000c85ea4a8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
生产环境下的定位与分析
内存溢出
main 代码
public static void main(String[] args) {
ArrayList arrayList = new ArrayList<>();
while (true) {
arrayList.add(UUID.randomUUID().toString());
}
}
jvm 配置
-Xms10m -Xmx10m -XX:+HeapDumpOnOutOfMemoryError
将会生成一个java_pid**.hprof类似文件
java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to java_pid16952.hprof ...
Heap dump file created [10500212 bytes in 0.026 secs]
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.lang.String.substring(String.java:1933)
at java.util.UUID.digits(UUID.java:386)
at java.util.UUID.toString(UUID.java:379)
at com.example.demo.job.Test.main(Test.java:10)
死锁问题
死锁代码
public class TestDeadLock {
private static Object lock1 = new Object();
private static Object lock2 = new Object();
public static void main(String[] args) {
new Thread(() -> {
synchronized (lock1) {
System.out.println("Thread1成功获取lock1锁");
try {
// 停顿2秒,让Thread2线程拿到lock2的锁
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
synchronized (lock2) {
System.out.println("Thread1成功获取lock2锁");
}
}
}).start();
new Thread(() -> {
synchronized (lock2) {
System.out.println("Thread2成功获取lock2锁");
try {
// 停顿2秒,让Thread1线程拿到lock1的锁
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
synchronized (lock1) {
System.out.println("Thread2成功获取lock1锁");
}
}
}).start();
}
}
使用jstack进行分析
D:\>jps
12112
18736 TestDeadLock
7584 RemoteMavenServer36
16116 Launcher
17784 jar
20088
21448 Jps
D:\>jstack 18736
Java stack information for the threads listed above:
===================================================
"Thread-1":
at com.example.demo.excel.TestDeadLock.lambda$main$1(TestDeadLock.java:33)
- waiting to lock <0x0000000776245d98> (a java.lang.Object)
- locked <0x0000000776245da8> (a java.lang.Object)
at com.example.demo.excel.TestDeadLock$$Lambda$2/1967205423.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
"Thread-0":
at com.example.demo.excel.TestDeadLock.lambda$main$0(TestDeadLock.java:18)
- waiting to lock <0x0000000776245da8> (a java.lang.Object)
- locked <0x0000000776245d98> (a java.lang.Object)
at com.example.demo.excel.TestDeadLock$$Lambda$1/1911006827.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Found 1 deadlock.
最近受我的朋友委托用js+HTML做一个像手册一样的程序,里面要有可展开的大纲,模糊查找等功能。我这个人说实在的懒,本来是不愿意的,但想起了父亲以前教我要给朋友搞好关系,再加上这也可以巩固自己的js技术,于是就开始开发这个程序,没想到却出了点小问题,我做的查找只能绝对查找。具体的js代码如下:
function search(){
var arr=new Array("my
实例:
CREATE OR REPLACE PROCEDURE test_Exception
(
ParameterA IN varchar2,
ParameterB IN varchar2,
ErrorCode OUT varchar2 --返回值,错误编码
)
AS
/*以下是一些变量的定义*/
V1 NUMBER;
V2 nvarc
Spark Streaming简介
NetworkWordCount代码
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
代码示例:
# include <stdio.h>
//冒泡排序
void sort(int * a, int len)
{
int i, j, t;
for (i=0; i<len-1; i++)
{
for (j=0; j<len-1-i; j++)
{
if (a[j] > a[j+1]) // >表示升序
nginx日志分割 for linux 默认情况下,nginx是不分割访问日志的,久而久之,网站的日志文件将会越来越大,占用空间不说,如果有问题要查看网站的日志的话,庞大的文件也将很难打开,于是便有了下面的脚本 使用方法,先将以下脚本保存为 cutlog.sh,放在/root 目录下,然后给予此脚本执行的权限
复制代码代码如下:
chmo
http://bukhantsov.org/2011/08/how-to-determine-businessobjects-service-pack-and-fix-pack/
The table below is helpful. Reference
BOE XI 3.x
12.0.0.
y BOE XI 3.0 12.0.
x.
y BO
大家都知道吧,这很坑,尤其是用惯了mysql里的自增字段设置,结果oracle里面没有的。oh,no 我用的是12c版本的,它有一个新特性,可以这样设置自增序列,在创建表是,把id设置为自增序列
create table t
(
id number generated by default as identity (start with 1 increment b