一直卡死的实验

今天我做了个实验报错了,是把数据从一方传到远程的kafka里。发送方启动server.jar,kafka的接收方也启动server.jar。

java -jar server-v1.0.jar -d C:\Users\Administrator\Desktop\test\ -s 172.21.6.57 -t taxi

传输了不久之后,报错了。
报错日志如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000002be853a, pid=11956, tid=0x0000000000001e10
#
# JRE version: Java(TM) SE Runtime Environment (8.0_171-b11) (build 1.8.0_171-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.171-b11 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# J 2149 C2 sun.nio.ch.IOUtil.write(Ljava/io/FileDescriptor;[Ljava/nio/ByteBuffer;IILsun/nio/ch/NativeDispatcher;)J (509 bytes) @ 0x0000000002be853a [0x0000000002be7e40+0x6fa]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#

--------------- T H R E A D ---------------

Current thread (0x0000000019b3e000): JavaThread "nioEventLoopGroup-2-1" [_thread_in_Java, id=7696, stack(0x0000000019f50000,0x000000001a050000)]

siginfo: ExceptionCode=0xc0000005, writing address 0x0000000033960040

Registers:
RAX=0x00000000d36695f0, RBX=0x0000000000000008, RCX=0x000000001e25ebc0, RDX=0x00000000d7ee5360
RSP=0x000000001a04ef50, RBP=0x00000000d36695f0, RSI=0x000000000000b5a4, RDI=0x0000000000000000
R8 =0x000000000045bf8c, R9 =0x00000000ded44a00, R10=0x0000000033960040, R11=0x0000000000000039
R12=0x0000000000000000, R13=0x00000000d5c00000, R14=0x00000000d47d9430, R15=0x0000000019b3e000
RIP=0x0000000002be853a, EFLAGS=0x0000000000010202

Top of Stack: (sp=0x000000001a04ef50)
0x000000001a04ef50: 0000000000000001 0000000000000020
0x000000001a04ef60: 000000001a04efb8 0000000000000000
0x000000001a04ef70: 0000000000800000 00000000ca036da0
0x000000001a04ef80: 00000000819b6ea8 0000000000000000
0x000000001a04ef90: 0000b5a40000b5a4 00000000817b09c0
0x000000001a04efa0: 0000000019b3e000 00000000819b6c00
0x000000001a04efb0: 00000000819b6ce0 00000000d36695c0
0x000000001a04efc0: 00000000819bc618 00000000819bc578
0x000000001a04efd0: 00000000819bc5a8 00000000819bc618
0x000000001a04efe0: 0000000000000001 0000000002cfda2c
0x000000001a04eff0: 00000000df8e3998 00000001400731a8
0x000000001a04f000: 00000000818cf500 00000000df8eac08
0x000000001a04f010: 00000001df8e3998 00000000ca036da0
0x000000001a04f020: 0000b5a40014578f 00000000819b6dd8
0x000000001a04f030: 00000000819b6ee0 00000000df8e3998
0x000000001a04f040: 000000012803e413 0000000000000001

Instructions: (pc=0x0000000002be853a)
0x0000000002be851a: 00 28 0f 85 47 17 00 00 48 63 c9 49 03 49 10 c5
0x0000000002be852a: f9 7e cb 83 fb 04 0f 84 d7 0f 00 00 4c 8b 52 18
0x0000000002be853a: 49 89 0a 4d 63 db 4d 89 5a 08 41 ba 01 00 00 00
0x0000000002be854a: c4 e1 f9 7e c0 e9 10 fb ff ff 0f 1f 84 00 00 00


Register to memory mapping:

RAX=0x00000000d36695f0 is an oop
[Ljava.nio.ByteBuffer;
- klass: 'java/nio/ByteBuffer'[]
- length: 4571020
RBX=0x0000000000000008 is an unknown value
RCX=0x000000001e25ebc0 is an unknown value
RDX=0x00000000d7ee5360 is an oop
sun.nio.ch.AllocatedNativeObject
- klass: 'sun/nio/ch/AllocatedNativeObject'
RSP=0x000000001a04ef50 is pointing into the stack for thread: 0x0000000019b3e000
RBP=0x00000000d36695f0 is an oop
[Ljava.nio.ByteBuffer;
- klass: 'java/nio/ByteBuffer'[]
- length: 4571020
RSI=0x000000000000b5a4 is an unknown value
RDI=0x0000000000000000 is an unknown value
R8 =0x000000000045bf8c is an unknown value
R9 =0x00000000ded44a00 is an oop
java.nio.DirectByteBuffer
- klass: 'java/nio/DirectByteBuffer'
R10=0x0000000033960040 is an unknown value
R11=0x0000000000000039 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x00000000d5c00000 is an oop
[I
- klass: {type array int}
- length: 4571020
R14=0x00000000d47d9430 is an oop
[I
- klass: {type array int}
- length: 4571020
R15=0x0000000019b3e000 is a thread


Stack: [0x0000000019f50000,0x000000001a050000], sp=0x000000001a04ef50, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C 0x0000000002be853a


--------------- P R O C E S S ---------------

Java Threads: ( => current thread )
0x000000001a5b9800 JavaThread "Thread-1" [_thread_blocked, id=15172, stack(0x000000001cf70000,0x000000001d070000)]
0x000000001a5c9000 JavaThread "kafka-producer-network-thread | producer-1" daemon [_thread_in_native, id=18268, stack(0x000000001ccf0000,0x000000001cdf0000)]
0x000000001a5f8800 JavaThread "threadDeathWatcher-3-1" daemon [_thread_blocked, id=15976, stack(0x000000001bbe0000,0x000000001bce0000)]
=>0x0000000019b3e000 JavaThread "nioEventLoopGroup-2-1" [_thread_in_Java, id=7696, stack(0x0000000019f50000,0x000000001a050000)]
0x0000000018965000 JavaThread "Service Thread" daemon [_thread_blocked, id=10604, stack(0x0000000019380000,0x0000000019480000)]
0x00000000188f8000 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=19388, stack(0x0000000019280000,0x0000000019380000)]
0x00000000188f4000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=9220, stack(0x0000000019160000,0x0000000019260000)]
0x000000001762f000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=1804, stack(0x0000000018e20000,0x0000000018f20000)]
0x00000000188c8800 JavaThread "Attach Listener" daemon [_thread_blocked, id=9820, stack(0x0000000018f50000,0x0000000019050000)]
0x0000000017620000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=8704, stack(0x0000000018d00000,0x0000000018e00000)]
0x000000001760a000 JavaThread "Finalizer" daemon [_thread_blocked, id=6588, stack(0x00000000187c0000,0x00000000188c0000)]
0x00000000175c3000 JavaThread "Reference Handler" daemon [_thread_blocked, id=6064, stack(0x0000000018460000,0x0000000018560000)]
0x000000000020e800 JavaThread "main" [_thread_blocked, id=19140, stack(0x0000000002610000,0x0000000002710000)]

Other Threads:
0x00000000175bb800 VMThread [stack: 0x00000000185e0000,0x00000000186e0000] [id=8132]
0x000000001896e800 WatcherThread [stack: 0x0000000019640000,0x0000000019740000] [id=14692]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
PSYoungGen total 461312K, used 173083K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 71% used [0x00000000d5c00000,0x00000000e0506c90,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1381668K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5949270,0x00000000d5c00000)
Metaspace used 17921K, capacity 18118K, committed 18432K, reserved 1064960K
class space used 2194K, capacity 2284K, committed 2304K, reserved 1048576K

Card table byte_map: [0x0000000011ad0000,0x0000000011ed0000] byte_map_base: 0x00000000116c6000

Marking Bits: (ParMarkBitMap*) 0x00000000531208c0
Begin Bits: [0x00000000128d0000, 0x0000000014880000)
End Bits: [0x0000000014880000, 0x0000000016830000)

Polling page: 0x0000000000140000

CodeCache: size=245760Kb used=5665Kb max_used=6455Kb free=240094Kb
bounds [0x0000000002710000, 0x0000000002d70000, 0x0000000011710000]
total_blobs=2312 nmethods=1836 adapters=388
compilation: enabled

Compilation events (10 events):
Event: 418.857 Thread 0x00000000188f8000 2213 3 io.netty.util.Recycler$Stack::pushLater (93 bytes)
Event: 418.857 Thread 0x000000001762f000 2214 4 io.netty.util.Recycler::access$2100 (4 bytes)
Event: 418.857 Thread 0x000000001762f000 nmethod 2214 0x000000000285ae50 code [0x000000000285af80, 0x000000000285afd8]
Event: 418.858 Thread 0x00000000188f8000 nmethod 2213 0x0000000002bd32d0 code [0x0000000002bd35c0, 0x0000000002bd5008]
Event: 418.861 Thread 0x00000000188f4000 2215 4 io.netty.util.Recycler$WeakOrderQueue::reserveSpace (46 bytes)
Event: 418.862 Thread 0x00000000188f4000 nmethod 2215 0x0000000002b1f2d0 code [0x0000000002b1f400, 0x0000000002b1f478]
Event: 418.862 Thread 0x000000001762f000 2216 4 io.netty.util.Recycler$Stack::pushLater (93 bytes)
Event: 418.863 Thread 0x00000000188f4000 2217 4 io.netty.util.Recycler$WeakOrderQueue::add (84 bytes)
Event: 418.867 Thread 0x00000000188f4000 nmethod 2217 0x00000000029588d0 code [0x0000000002958a20, 0x0000000002958d18]
Event: 418.893 Thread 0x000000001762f000 nmethod 2216 0x0000000002842710 code [0x0000000002842900, 0x0000000002843e50]

GC Heap History (10 events):
Event: 392.153 GC heap before
{Heap before GC invocations=219 (full 62):
PSYoungGen total 461312K, used 231300K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 95% used [0x00000000d5c00000,0x00000000e3de1358,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384162K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5bb8b50,0x00000000d5c00000)
Metaspace used 17944K, capacity 18158K, committed 18432K, reserved 1064960K
class space used 2200K, capacity 2294K, committed 2304K, reserved 1048576K
Event: 395.350 GC heap after
Heap after GC invocations=219 (full 62):
PSYoungGen total 461312K, used 222710K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 92% used [0x00000000d5c00000,0x00000000e357d948,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384162K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5bb8b50,0x00000000d5c00000)
Metaspace used 17944K, capacity 18158K, committed 18432K, reserved 1064960K
class space used 2200K, capacity 2294K, committed 2304K, reserved 1048576K
}
Event: 395.357 GC heap before
{Heap before GC invocations=220 (full 63):
PSYoungGen total 461312K, used 241664K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 100% used [0x00000000d5c00000,0x00000000e4800000,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384162K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5bb8b50,0x00000000d5c00000)
Metaspace used 17944K, capacity 18158K, committed 18432K, reserved 1064960K
class space used 2200K, capacity 2294K, committed 2304K, reserved 1048576K
Event: 400.346 GC heap after
Heap after GC invocations=220 (full 63):
PSYoungGen total 461312K, used 169771K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 70% used [0x00000000d5c00000,0x00000000e01cae08,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384088K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5ba6170,0x00000000d5c00000)
Metaspace used 17944K, capacity 18158K, committed 18432K, reserved 1064960K
class space used 2200K, capacity 2294K, committed 2304K, reserved 1048576K
}
Event: 400.471 GC heap before
{Heap before GC invocations=221 (full 64):
PSYoungGen total 461312K, used 233668K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 96% used [0x00000000d5c00000,0x00000000e4031180,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384088K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5ba6170,0x00000000d5c00000)
Metaspace used 17944K, capacity 18158K, committed 18432K, reserved 1064960K
class space used 2200K, capacity 2294K, committed 2304K, reserved 1048576K
Event: 403.654 GC heap after
Heap after GC invocations=221 (full 64):
PSYoungGen total 461312K, used 225026K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 93% used [0x00000000d5c00000,0x00000000e37c0b78,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384088K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5ba6170,0x00000000d5c00000)
Metaspace used 17944K, capacity 18158K, committed 18432K, reserved 1064960K
class space used 2200K, capacity 2294K, committed 2304K, reserved 1048576K
}
Event: 403.654 GC heap before
{Heap before GC invocations=222 (full 65):
PSYoungGen total 461312K, used 225026K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 93% used [0x00000000d5c00000,0x00000000e37c0b78,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384088K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5ba6170,0x00000000d5c00000)
Metaspace used 17944K, capacity 18158K, committed 18432K, reserved 1064960K
class space used 2200K, capacity 2294K, committed 2304K, reserved 1048576K
Event: 414.327 GC heap after
Heap after GC invocations=222 (full 65):
PSYoungGen total 461312K, used 224508K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 92% used [0x00000000d5c00000,0x00000000e373f278,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384121K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5bae6e8,0x00000000d5c00000)
Metaspace used 17918K, capacity 18118K, committed 18432K, reserved 1064960K
class space used 2194K, capacity 2284K, committed 2304K, reserved 1048576K
}
Event: 414.506 GC heap before
{Heap before GC invocations=223 (full 66):
PSYoungGen total 461312K, used 241664K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 100% used [0x00000000d5c00000,0x00000000e4800000,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1384124K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5baf358,0x00000000d5c00000)
Metaspace used 17921K, capacity 18118K, committed 18432K, reserved 1064960K
class space used 2194K, capacity 2284K, committed 2304K, reserved 1048576K
Event: 418.168 GC heap after
Heap after GC invocations=223 (full 66):
PSYoungGen total 461312K, used 39793K [0x00000000d5c00000, 0x0000000100000000, 0x0000000100000000)
eden space 241664K, 16% used [0x00000000d5c00000,0x00000000d82dc588,0x00000000e4800000)
from space 219648K, 0% used [0x00000000f2980000,0x00000000f2980000,0x0000000100000000)
to space 225280K, 0% used [0x00000000e4800000,0x00000000e4800000,0x00000000f2400000)
ParOldGen total 1384448K, used 1381668K [0x0000000081400000, 0x00000000d5c00000, 0x00000000d5c00000)
object space 1384448K, 99% used [0x0000000081400000,0x00000000d5949270,0x00000000d5c00000)
Metaspace used 17921K, capacity 18118K, committed 18432K, reserved 1064960K
class space used 2194K, capacity 2284K, committed 2304K, reserved 1048576K
}

Deoptimization events (10 events):
Event: 414.331 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002d62914 method=io.netty.buffer.PoolChunkList.free(Lio/netty/buffer/PoolChunk;J)Z @ 13
Event: 414.409 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002c2c29c method=io.netty.util.Recycler$Stack.pushNow(Lio/netty/util/Recycler$DefaultHandle;)V @ 44
Event: 414.409 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002c20a14 method=io.netty.util.Recycler$Stack.pushNow(Lio/netty/util/Recycler$DefaultHandle;)V @ 44
Event: 414.466 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002b60620 method=io.netty.buffer.PoolArena.freeChunk(Lio/netty/buffer/PoolChunk;JLio/netty/buffer/PoolArena$SizeClass;)V @ 96
Event: 418.187 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002cc8478 method=io.netty.buffer.PoolArena.freeChunk(Lio/netty/buffer/PoolChunk;JLio/netty/buffer/PoolArena$SizeClass;)V @ 96
Event: 418.230 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002ac941c method=io.netty.buffer.PoolArena.freeChunk(Lio/netty/buffer/PoolChunk;JLio/netty/buffer/PoolArena$SizeClass;)V @ 96
Event: 418.274 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002b5c524 method=io.netty.buffer.PoolArena.freeChunk(Lio/netty/buffer/PoolChunk;JLio/netty/buffer/PoolArena$SizeClass;)V @ 96
Event: 418.321 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00000000029c4fc8 method=io.netty.buffer.PoolArena.freeChunk(Lio/netty/buffer/PoolChunk;JLio/netty/buffer/PoolArena$SizeClass;)V @ 96
Event: 418.839 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002b20190 method=io.netty.channel.ChannelOutboundBuffer.remove0(Ljava/lang/Throwable;Z)Z @ 6
Event: 418.856 Thread 0x0000000019b3e000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002c3361c method=io.netty.util.Recycler$WeakOrderQueue.add(Lio/netty/util/Recycler$DefaultHandle;)V @ 36

Classes redefined (0 events):
No events

Internal exceptions (10 events):
Event: 0.675 Thread 0x000000000020e800 Exception <a 'java/lang/NoClassDefFoundError': org/slf4j/impl/StaticLoggerBinder> (0x00000000d72ac3c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\classfile\systemDictionary.cpp, line 199]
Event: 0.683 Thread 0x000000000020e800 Exception <a 'java/lang/NoClassDefFoundError': org/apache/log4j/Priority> (0x00000000d72bb238) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\classfile\systemDictionary.cpp, line 199]
Event: 0.700 Thread 0x000000000020e800 Exception <a 'java/lang/ClassCastException': sun.misc.Cleaner cannot be cast to java.lang.Runnable> (0x00000000d73afc40) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line
Event: 0.701 Thread 0x000000000020e800 Exception <a 'java/lang/NoClassDefFoundError': javassist/ClassPath> (0x00000000d73ba370) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\classfile\systemDictionary.cpp, line 199]
Event: 0.973 Thread 0x000000000020e800 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x00000000d7666800) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\prims\methodHandles.cpp, line 1167]
Event: 0.975 Thread 0x000000000020e800 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x00000000d7673ec0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\prims\methodHandles.cpp, line 1167]
Event: 312.070 Thread 0x000000001a5c9000 Exception <a 'java/lang/NoSuchMethodError': java.lang.Object.lambda$identity$2(Ljava/lang/Object;)Ljava/lang/Object;> (0x00000000e3466588) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\interpreter\linkResolv
Event: 319.814 Thread 0x000000001a5c9000 Implicit null exception at 0x0000000002c4de6e to 0x0000000002c4f2e9
Event: 414.327 Thread 0x0000000019b3e000 Exception <a 'java/lang/OutOfMemoryError'> (0x00000000816f6ef8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u171\10807\hotspot\src\share\vm\gc_interface/collectedHeap.inline.hpp, line 159]
Event: 418.839 Thread 0x0000000019b3e000 Implicit null exception at 0x0000000002b1f835 to 0x0000000002b20171

Events (10 events):
Event: 418.274 Thread 0x0000000019b3e000 DEOPT UNPACKING pc=0x000000000275583b sp=0x000000001a04eef0 mode 2
Event: 418.321 Thread 0x0000000019b3e000 Uncommon trap: trap_request=0xffffff65 fr.pc=0x00000000029c4fc8
Event: 418.321 Thread 0x0000000019b3e000 DEOPT PACKING pc=0x00000000029c4fc8 sp=0x000000001a04eee0
Event: 418.321 Thread 0x0000000019b3e000 DEOPT UNPACKING pc=0x000000000275583b sp=0x000000001a04eec8 mode 2
Event: 418.839 Thread 0x0000000019b3e000 Uncommon trap: trap_request=0xffffff65 fr.pc=0x0000000002b20190
Event: 418.839 Thread 0x0000000019b3e000 DEOPT PACKING pc=0x0000000002b20190 sp=0x000000001a04f120
Event: 418.839 Thread 0x0000000019b3e000 DEOPT UNPACKING pc=0x000000000275583b sp=0x000000001a04f080 mode 2
Event: 418.856 Thread 0x0000000019b3e000 Uncommon trap: trap_request=0xffffff65 fr.pc=0x0000000002c3361c
Event: 418.856 Thread 0x0000000019b3e000 DEOPT PACKING pc=0x0000000002c3361c sp=0x000000001a04f080
Event: 418.856 Thread 0x0000000019b3e000 DEOPT UNPACKING pc=0x000000000275583b sp=0x000000001a04f010 mode 2


Dynamic libraries:
0x000000013fff0000 - 0x0000000140027000 F:\java\jdk1.8\bin\java.exe
0x0000000076ff0000 - 0x000000007719a000 C:\Windows\SYSTEM32\ntdll.dll
0x0000000076ed0000 - 0x0000000076fef000 C:\Windows\system32\kernel32.dll
0x000007fefcd20000 - 0x000007fefcd8a000 C:\Windows\system32\KERNELBASE.dll
0x000007fefebf0000 - 0x000007fefeccb000 C:\Windows\system32\ADVAPI32.dll
0x000007fefeae0000 - 0x000007fefeb7f000 C:\Windows\system32\msvcrt.dll
0x000007fefeb80000 - 0x000007fefeb9f000 C:\Windows\SYSTEM32\sechost.dll
0x000007fefe340000 - 0x000007fefe46d000 C:\Windows\system32\RPCRT4.dll
0x0000000076dd0000 - 0x0000000076eca000 C:\Windows\system32\USER32.dll
0x000007fefe0b0000 - 0x000007fefe117000 C:\Windows\system32\GDI32.dll
0x000007fefee30000 - 0x000007fefee3e000 C:\Windows\system32\LPK.dll
0x000007fefe1c0000 - 0x000007fefe28b000 C:\Windows\system32\USP10.dll
0x000007fefb460000 - 0x000007fefb654000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll
0x000007fefe7a0000 - 0x000007fefe811000 C:\Windows\system32\SHLWAPI.dll
0x000007fefee00000 - 0x000007fefee2e000 C:\Windows\system32\IMM32.DLL
0x000007fefecd0000 - 0x000007fefedd9000 C:\Windows\system32\MSCTF.dll
0x000000006a760000 - 0x000000006a832000 F:\java\jdk1.8\jre\bin\msvcr100.dll
0x0000000052900000 - 0x00000000531a0000 F:\java\jdk1.8\jre\bin\server\jvm.dll
0x000007fef9550000 - 0x000007fef9559000 C:\Windows\system32\WSOCK32.dll
0x000007fefeba0000 - 0x000007fefebed000 C:\Windows\system32\WS2_32.dll
0x000007fefe290000 - 0x000007fefe298000 C:\Windows\system32\NSI.dll
0x000007fefad40000 - 0x000007fefad7b000 C:\Windows\system32\WINMM.dll
0x000007fefbda0000 - 0x000007fefbdac000 C:\Windows\system32\VERSION.dll
0x00000000771c0000 - 0x00000000771c7000 C:\Windows\system32\PSAPI.DLL
0x0000000073540000 - 0x000000007354f000 F:\java\jdk1.8\jre\bin\verify.dll
0x0000000070720000 - 0x0000000070749000 F:\java\jdk1.8\jre\bin\java.dll
0x0000000070e00000 - 0x0000000070e16000 F:\java\jdk1.8\jre\bin\zip.dll
0x000007fefd0a0000 - 0x000007fefde2a000 C:\Windows\system32\SHELL32.dll
0x000007fefdeb0000 - 0x000007fefe0ac000 C:\Windows\system32\ole32.dll
0x000007fefcce0000 - 0x000007fefccef000 C:\Windows\system32\profapi.dll
0x0000000073550000 - 0x000000007355d000 F:\java\jdk1.8\jre\bin\management.dll
0x0000000070de0000 - 0x0000000070dfa000 F:\java\jdk1.8\jre\bin\net.dll
0x000007fefc450000 - 0x000007fefc4a5000 C:\Windows\system32\mswsock.dll
0x000007fefc440000 - 0x000007fefc447000 C:\Windows\System32\wship6.dll
0x000007fefb1e0000 - 0x000007fefb1f5000 C:\Windows\system32\NLAapi.dll
0x000007fef1050000 - 0x000007fef1065000 C:\Windows\system32\napinsp.dll
0x000007fef1030000 - 0x000007fef1049000 C:\Windows\system32\pnrpnsp.dll
0x000007fefc2d0000 - 0x000007fefc32b000 C:\Windows\system32\DNSAPI.dll
0x000007fefa5c0000 - 0x000007fefa5cb000 C:\Windows\System32\winrnr.dll
0x000007fefa2a0000 - 0x000007fefa2b0000 C:\Windows\system32\wshbth.dll
0x000007fefbe70000 - 0x000007fefbe77000 C:\Windows\System32\wshtcpip.dll
0x000007fefa970000 - 0x000007fefa997000 C:\Windows\system32\IPHLPAPI.DLL
0x000007fefa950000 - 0x000007fefa95b000 C:\Windows\system32\WINNSI.DLL
0x000007fef8b50000 - 0x000007fef8b58000 C:\Windows\system32\rasadhlp.dll
0x000007fef9e90000 - 0x000007fef9ee3000 C:\Windows\System32\fwpuclnt.dll
0x0000000070b80000 - 0x0000000070b91000 F:\java\jdk1.8\jre\bin\nio.dll
0x000007fefc4b0000 - 0x000007fefc4c8000 C:\Windows\system32\CRYPTSP.dll
0x000007fefc1b0000 - 0x000007fefc1f7000 C:\Windows\system32\rsaenh.dll
0x000007fefd080000 - 0x000007fefd09e000 C:\Windows\system32\USERENV.dll
0x000007fefcb40000 - 0x000007fefcb4f000 C:\Windows\system32\CRYPTBASE.dll
0x000007fef9cf0000 - 0x000007fef9d08000 C:\Windows\system32\dhcpcsvc.DLL
0x000007fef9cd0000 - 0x000007fef9ce1000 C:\Windows\system32\dhcpcsvc6.DLL
0x000007fef67e0000 - 0x000007fef6905000 C:\Windows\system32\dbghelp.dll

VM Arguments:
java_command: server-v1.0.jar -d C:\Users\Administrator\Desktop\test\ -s 172.21.6.57 -t taxi
java_class_path (initial): server-v1.0.jar
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=F:\java\jdk1.8
CLASSPATH=.;F:\java\jdk1.8\lib\dt.jar;F:\java\jdk1.8\lib\tools.jar;
PATH=F:\apache-maven-3.3.9\bin;F:\java\jdk1.8\bin;F:\java\jdk1.8\jre\bin;C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem; F:\java\jdk1.8\bin;F:\java\jdk1.8\jre\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;E:\Software\Node.js\;E:\Go\bin;E:\Software\CMDer\bin;D:\software\python3\Scripts\;D:\software\python3\;D:\software\codeblocks\MinGW\bin;C:\Users\Administrator\AppData\Roaming\npm
USERNAME=Administrator
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel



--------------- S Y S T E M ---------------

OS: Windows 7 , 64 bit Build 7601 (6.1.7601.23889)

CPU:total 4 (initial active 4) (2 cores per cpu, 2 threads per core) family 6 model 60 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2

Memory: 4k page, physical 8302960k(1130368k free), swap 16604060k(7792288k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.171-b11) for windows-amd64 JRE (1.8.0_171-b11), built on Mar 28 2018 16:06:12 by "java_re" with MS VC++ 10.0 (VS2010)

time: Fri Apr 05 19:10:48 2019
elapsed time: 419 seconds (0d 0h 6m 59s)

原因:典型的内存错误 。发生了FullGC,老年代不够用了。那么应该如果调整JVM参数,不让他报错呢?光增大老年代大小就可以了吗?万一内存就这么大怎么办?

按说不应该用这么多内存啊,是不是发生了内存泄漏?怎么查看这个代码存不存在内存泄漏的情况?

我们都知道发生内存泄漏的情况会很多,比如

(1)静态集合类,例如HashMap和Vector。如果这些容器为静态的,由于它们的声明周期与程序一致,那么容器中的对象在程序结束之前将不能被释放,从而造成内存泄漏。

(2)各种连接,例如数据库的连接、网络连接以及IO连接等。

(3)监听器。在Java语言中,往往会使用到监听器。通常一个应用中会用到多个监听器,但在释放对象的同时往往没有相应的删除监听器,这也可能导致内存泄漏。

(4)变量不合理的作用域。一般而言,如果一个变量定义的作用域大于其使用范围,很有可能会造成内存泄漏,另一方面如果没有及时地把对象设置为Null,很有可能会导致内存泄漏的放生,如下:

1
2
3
4
5
6
7
8
9
10
11
class Server{

private String msg;

public void receiveMsg(){

readFromNet();//从网络接收数据保存在msg中

saveDB()//把msg保存到数据库中


从上面的代码中,通过readFromNet()方法接收的消息保存在变量msg中,然后调用saveDB()方法把msg的内容保存到数据库中,此时msg已经没用了,但是由于msg的声明周期与对象的声明周期相同,此时msg还不能被回收,因此造成了内存泄漏。对于这个问题,有如下两种解决方案:第一种方法,由于msg的作用范围只在receiveMsg()方法内,因此可以把msg定义为这个方法的局部变量,当方法结束后,msg的声明周期就会结束,此时垃圾回收器就会可以回收msg的内容了;第二种方法,在使用完msg后就设置为null,这样垃圾回收器也会自动回收msg内容所占用的内存空间。

(5)单例模式可能会造成内存泄漏

利用工具进行检查

利用jconsole发现(直接在cmd里输入jconsole就能出来),老年代确实用满了,大概是1.6G的样子,名称 = ‘PS MarkSweep’, 收集 = 73, 总花费时间 = 5 分钟,可以发现光老年代的GC时间达到了5分钟,这不行啊。总共运行7分钟程序,光GC时间就5分钟。然后我调大了老年代大小,设置成了堆大小是4G,新生代是400m。但是运行了一段时间后,内存占用又上升到了3.2G左右,这个这么占内存吗?

利用jvisualvm.exe 可以查看JVM参数,但是不知道为啥这个程序看不见。。。显示出来一个 - 就。通过java命令行加入 JVM参数后,就显示出来了。

通过这个工具发现了有一些对象,年代数特别大,58.怎么回事呢?还有一个疑问,当类加载数直线上升时,代表了啥?(类加载数从1000到5000)

会不会和ByteBuffer有关

因为在代码中用到了ByteBuffer,所以怀疑是不是和这个有关。
代码中有一段是这样的

1
2
3
4
5
randomAccessFile = new RandomAccessFile(f, "r");
FileChannel channel = randomAccessFile.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(1048576);
int bytesRead = channel.read(buffer);
ByteBuffer stringBuffer = ByteBuffer.allocate(1024);

我们都知道写NIO程序经常使用ByteBuffer来读取或者写入数据,那么使用ByteBuffer.allocate(capability)还是使用ByteBuffer.allocteDirect(capability)来分配缓存了?第一种方式是分配JVM堆内存,属于GC管辖范围,由于需要拷贝所以速度相对较慢;第二种方式是分配OS本地内存,不属于GC管辖范围,由于不需要内存拷贝所以速度相对较快,但是内存分配起来比较慢,所以并非不论什么时候allocateDirect的操作效率都是最高的。但是当操作数据量非常小时,两种分配方式操作使用时间基本是同样的(大小是1024000之前都差不多),第一种方式有时可能会更快,可是当数据量非常大时,用ByteBuffer.allocteDirect(capability)这个就比较快了。

无意收获

今天读了一篇博客,http://www.ityouknow.com/arch/2017/02/12/a-script-caused-bloody-case.html.其中,有这个一段,“重新启动观察之后mimor gc的频率确实有所下降,测试大约过了3小时候之后又反馈tomcat down掉了,继续分析启动参数配置的时候发现了这么一句-XX:-+DisableExplicitGC,显示的禁止了System.gc(),但是使用了java.nio的大量框架中使用System.gc()来执行gc期通过full gc来强迫已经无用的DirectByteBuffer对象释放掉它们关联的native memory,如果禁用会导致OOM,随即怀疑是否是这个参数引发的问题,在启动参数中去掉它。”
大意是我没有禁用,所以不能GC,所以OOM。明白了。。。。。如果我们的应用中使用了java nio中的direct memory,那么使用-XX:+DisableExplicitGC一定要小心,存在潜在的内存泄露风险。

但是这个程序的内存跑到后期的时候,占用的内存还是很大,老年代GC时间很长,虽然没有OOM了,但是这样也不行啊。。。

ByteBuffer操作介绍

https://www.cnblogs.com/jiduoduo/p/6397454.html

小插曲

因为这个程序占用了CPU 几乎100%,造成了虚拟机抱了这些

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@rabbitmq _posts]# 
Message from syslogd@rabbitmq at May 25 20:39:18 ...
kernel:NMI watchdog: BUG: soft lockup - CPU#0 stuck for 33s! [rtkit-daemon:736]

Message from syslogd@rabbitmq at May 25 20:39:39 ...
kernel:NMI watchdog: BUG: soft lockup - CPU#0 stuck for 35s! [scsi_eh_1:275]

Message from syslogd@rabbitmq at May 25 20:39:39 ...
kernel:NMI watchdog: BUG: soft lockup - CPU#0 stuck for 21s! [pickup:4845]

Message from syslogd@rabbitmq at May 25 20:39:39 ...
kernel:NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [dhclient:871]

Message from syslogd@rabbitmq at May 25 20:39:39 ...
kernel:NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [master:2807]

Message from syslogd@rabbitmq at May 25 20:39:39 ...
kernel:NMI watchdog: BUG: soft lockup - CPU#0 stuck for 29s! [abrt-hook-ccpp:5402]

Message from syslogd@rabbitmq at May 25 20:39:58 ...
kernel:NMI watchdog: BUG: soft lockup - CPU#0 stuck for 21s! [abrt-hook-ccpp:5402]

原因是占用过多CPU,造成内核软死锁(soft lockup)。Soft lockup名称解释:所谓,soft lockup就是说,这个bug没有让系统彻底死机,但是若干个进程(或者kernel thread)被锁死在了某个状态(一般在内核区域),很多情况下这个是由于内核锁的使用的问题。

知识点

  • Code Cache (non-heap):HotSpot Java虚拟机包括一个用于编译和保存本地代码(native code)的内存,叫做“代码缓存区”(code cache) (这里大概是6、7M的大小)

你会写导致内存泄漏的代码吗?

https://stackoverflow.com/questions/6470651/creating-a-memory-leak-with-java

参考

https://blog.csdn.net/jsqfengbao/article/details/44787267
https://www.cnblogs.com/mengfanrong/p/3984841.html

-------------本文结束感谢您的阅读-------------