我已经向AWS EC2实例部署了一个spring引导应用程序。很好用了一段时间。但一天后,应用程序就停止工作了。我使用了不同类型的EC2,从t2.micro到t3.media。只有一件事改变了。在较大的EC2实例中,应用程序在不停止的情况下工作时间更长。内存使用率不高。但是在CPU利用率方面发生了一些奇怪的事情。应用程序的CPU利用率低于2%,但突然达到50%,之后停止工作。
这是代码的主要部分。
@Scheduled(fixedDelay = 5, timeUnit = TimeUnit.SECONDS)
public void trackChanges() {
String uuid = UUID.randomUUID().toString();
log.info("Start processing new track changes with id {} at {}", uuid, LocalDateTime.now());
List<Pair<Asset, Fiat>> pairs = new ArrayList<>();
for (Asset asset : Asset.values()) {
for (Fiat fiat : Fiat.values()) {
pairs.add(new Pair<>(asset, fiat));
}
}
ExecutorService executorService = Executors.newFixedThreadPool(3);
CountDownLatch latch = new CountDownLatch(pairs.size());
for (Pair<Asset, Fiat> assetFiatPair : pairs) {
executorService.submit(() -> {
getProfit(assetFiatPair.getFirst(), assetFiatPair.getSecond());
latch.countDown();
});
}
try {
latch.await();
} catch (InterruptedException e) {
log.error("TrackChanges was interrupted!", e);
// Restore interrupted state...
Thread.currentThread().interrupt();
}
executorService.shutdown();
log.info("Finish processing new track changes with id {} on {}", uuid, LocalDateTime.now());
}
private void getProfit(Asset asset, Fiat fiat) {
Report report = binanceSearchService.check(asset, fiat);
if (!report.isEmpty()) {
CompareReport result = comparator.compare(report);
if (result.isChanged()) {
messageNotificator.sendMessage(result.getMessage());
}
}
}
内存使用度量
CPU利用率度量
‘'dmesg’命令输出
[ 0.761452] rcu: Hierarchical SRCU implementation.
[ 0.765381] NMI watchdog: Perf NMI watchdog permanently disabled
[ 0.765481] smp: Bringing up secondary CPUs ...
[ 0.769067] x86: Booting SMP configuration:
[ 0.769410] .... node #0, CPUs: #1
[ 0.712169] kvm-clock: cpu 1, msr 2fa01041, secondary cpu clock
[ 0.771735] kvm-guest: stealtime: cpu 1, msr 3d134080
[ 0.777469] MDS CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html for more details.
[ 0.781409] MMIO Stale Data CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/processor_mmio_stale_data.html for more details.
[ 0.785433] smp: Brought up 1 node, 2 CPUs
[ 0.788782] smpboot: Max logical packages: 1
[ 0.789408] smpboot: Total of 2 processors activated (9999.99 BogoMIPS)
[ 0.795554] node 0 deferred pages initialised in 0ms
[ 0.797570] devtmpfs: initialized
[ 0.800549] x86/mm: Memory block size: 128MB
[ 0.805588] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.813414] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[ 0.817590] NET: Registered protocol family 16
[ 0.821176] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[ 0.825418] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[ 0.829410] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[ 0.837419] audit: initializing netlink subsys (disabled)
[ 0.841472] thermal_sys: Registered thermal governor 'fair_share'
[ 0.841473] thermal_sys: Registered thermal governor 'step_wise'
[ 0.845642] audit: type=2000 audit(1664284498.244:1): state=initialized audit_enabled=0 res=1
[ 0.845578] thermal_sys: Registered thermal governor 'user_space'
[ 0.853460] cpuidle: using governor ladder
[ 0.861412] cpuidle: using governor menu
[ 0.865516] ACPI: bus type PCI registered
[ 0.868850] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[ 0.873566] PCI: Using configuration type 1 for base access
[ 0.882108] Kprobes globally optimized
[ 0.885615] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[ 0.889441] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[ 1.017504] ACPI: Added _OSI(Module Device)
[ 1.021424] ACPI: Added _OSI(Processor Device)
[ 1.024946] ACPI: Added _OSI(3.0 _SCP Extensions)
[ 1.025409] ACPI: Added _OSI(Processor Aggregator Device)
[ 1.029321] ACPI: Added _OSI(Linux-Dell-Video)
[ 1.029408] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[ 1.033310] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[ 1.034172] ACPI: 3 ACPI AML tables successfully acquired and loaded
[ 1.038238] ACPI: Interpreter enabled
[ 1.041398] ACPI: (supports S0 S4 S5)
[ 1.041408] ACPI: Using IOAPIC for interrupt routing
[ 1.045119] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[ 1.045728] ACPI: Enabled 16 GPEs in block 00 to 0F
[ 1.052476] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[ 1.053412] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI HPX-Type3]
[ 1.057415] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[ 1.061714] acpiphp: Slot [3] registered
[ 1.065057] acpiphp: Slot [4] registered
[ 1.065428] acpiphp: Slot [5] registered
[ 1.068743] acpiphp: Slot [6] registered
[ 1.069427] acpiphp: Slot [7] registered
[ 1.072763] acpiphp: Slot [8] registered
[ 1.073430] acpiphp: Slot [9] registered
[ 1.076764] acpiphp: Slot [10] registered
[ 1.077430] acpiphp: Slot [11] registered
[ 1.080856] acpiphp: Slot [12] registered
[ 1.081429] acpiphp: Slot [13] registered
[ 1.084825] acpiphp: Slot [14] registered
[ 1.085428] acpiphp: Slot [15] registered
[ 1.088796] acpiphp: Slot [16] registered
[ 1.089428] acpiphp: Slot [17] registered
[ 1.092761] acpiphp: Slot [18] registered
[ 1.093428] acpiphp: Slot [19] registered
[ 1.096756] acpiphp: Slot [20] registered
[ 1.097428] acpiphp: Slot [21] registered
[ 1.100793] acpiphp: Slot [22] registered
[ 1.101428] acpiphp: Slot [23] registered
[ 1.104754] acpiphp: Slot [24] registered
[ 1.105429] acpiphp: Slot [25] registered
[ 1.108765] acpiphp: Slot [26] registered
[ 1.109427] acpiphp: Slot [27] registered
[ 1.112791] acpiphp: Slot [28] registered
[ 1.113429] acpiphp: Slot [29] registered
[ 1.116748] acpiphp: Slot [30] registered
[ 1.117428] acpiphp: Slot [31] registered
[ 1.120757] PCI host bridge to bus 0000:00
[ 1.121410] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]
[ 1.125408] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]
[ 1.129408] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[ 1.133408] pci_bus 0000:00: root bus resource [mem 0x80000000-0xfebfffff window]
[ 1.137408] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 1.141336] pci 0000:00:00.0: [8086:1237] type 00 class 0x060000
[ 1.141870] pci 0000:00:01.0: [8086:7000] type 00 class 0x060100
[ 1.146516] pci 0000:00:01.3: [8086:7113] type 00 class 0x000000
[ 1.150272] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
[ 1.153424] pci 0000:00:01.3: quirk: [io 0xb100-0xb10f] claimed by PIIX4 SMB
[ 1.157467] pci 0000:00:01.3: PIIX4 devres E PIO at fff0-ffff
[ 1.161421] pci 0000:00:01.3: PIIX4 devres F MMIO at ffc00000-ffffffff
[ 1.165423] pci 0000:00:01.3: PIIX4 devres G PIO at fff0-ffff
[ 1.169392] pci 0000:00:01.3: PIIX4 devres H MMIO at ffc00000-ffffffff
[ 1.169421] pci 0000:00:01.3: PIIX4 devres I PIO at fff0-ffff
[ 1.173424] pci 0000:00:01.3: PIIX4 devres J PIO at fff0-ffff
[ 1.177411] pci 0000:00:01.3: quirk_piix4_acpi+0x0/0x170 took 27343 usecs
[ 1.181764] pci 0000:00:03.0: [1d0f:1111] type 00 class 0x030000
[ 1.185953] pci 0000:00:03.0: reg 0x10: [mem 0xfe400000-0xfe7fffff pref]
[ 1.191003] pci 0000:00:03.0: reg 0x30: [mem 0xfebe0000-0xfebeffff pref]
[ 1.193800] pci 0000:00:04.0: [1d0f:8061] type 00 class 0x010802
[ 1.198499] pci 0000:00:04.0: reg 0x10: [mem 0xfebf0000-0xfebf3fff]
[ 1.204156] pci 0000:00:05.0: [1d0f:ec20] type 00 class 0x020000
[ 1.205863] pci 0000:00:05.0: reg 0x10: [mem 0xfebf4000-0xfebf7fff]
[ 1.212400] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[ 1.213505] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[ 1.217499] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[ 1.221502] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[ 1.225457] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[ 1.229583] iommu: Default domain type: Translated
[ 1.233347] pci 0000:00:03.0: vgaarb: setting as boot VGA device
[ 1.233404] pci 0000:00:03.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[ 1.233413] pci 0000:00:03.0: vgaarb: bridge control possible
[ 1.237409] vgaarb: loaded
[ 1.240400] EDAC MC: Ver: 3.0.0
[ 1.241472] NetLabel: Initializing
[ 1.245418] NetLabel: domain hash size = 128
[ 1.249407] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
[ 1.253423] NetLabel: unlabeled traffic allowed by default
[ 1.257407] PCI: Using ACPI for IRQ routing
[ 1.261410] PCI: pci_cache_line_size set to 64 bytes
[ 1.261549] e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff]
[ 1.261551] e820: reserve RAM buffer [mem 0x3e3ea000-0x3fffffff]
[ 1.261597] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0, 0, 0, 0, 0, 0
[ 1.265410] hpet0: 8 comparators, 32-bit 62.500000 MHz counter
[ 1.271493] clocksource: Switched to clocksource kvm-clock
[ 1.292189] VFS: Disk quotas dquot_6.6.0
[ 1.295513] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 1.299975] pnp: PnP ACPI init
[ 1.302968] pnp 00:00: Plug and Play ACPI device, IDs PNP0b00 (active)
[ 1.303009] pnp 00:01: Plug and Play ACPI device, IDs PNP0303 (active)
[ 1.303038] pnp 00:02: Plug and Play ACPI device, IDs PNP0f13 (active)
[ 1.303097] pnp 00:03: Plug and Play ACPI device, IDs PNP0400 (active)
[ 1.303153] pnp 00:04: Plug and Play ACPI device, IDs PNP0501 (active)
[ 1.303361] pnp: PnP ACPI: found 5 devices
[ 1.313175] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[ 1.320052] NET: Registered protocol family 2
[ 1.323607] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 1.330159] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[ 1.336822] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 1.343219] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[ 1.349502] TCP: Hash tables configured (established 8192 bind 8192)
[ 1.353946] MPTCP token hash table entries: 1024 (order: 2, 24576 bytes, linear)
[ 1.360312] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 1.364763] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 1.369364] NET: Registered protocol family 1
[ 1.372866] NET: Registered protocol family 44
[ 1.376381] pci_bus 0000:00: resource 4 [io 0x0000-0x0cf7 window]
[ 1.380532] pci_bus 0000:00: resource 5 [io 0x0d00-0xffff window]
[ 1.384665] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[ 1.389072] pci_bus 0000:00: resource 7 [mem 0x80000000-0xfebfffff window]
[ 1.393544] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[ 1.397575] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[ 1.401817] pci 0000:00:03.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[ 1.408530] PCI: CLS 0 bytes, default 64
[ 1.411866] Trying to unpack rootfs image as initramfs...
[ 1.436481] Freeing initrd memory: 10524K
[ 1.439944] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x240937b9988, max_idle_ns: 440795218083 ns
[ 1.447198] clocksource: Switched to clocksource tsc
[ 1.547895] check: Scanning for low memory corruption every 60 seconds
[ 1.554854] Initialise system trusted keyrings
[ 1.558416] Key type blacklist registered
[ 1.561800] workingset: timestamp_bits=36 max_order=18 bucket_order=0
[ 1.567133] zbud: loaded
[ 1.569988] SGI XFS with ACLs, security attributes, quota, no debug enabled
[ 1.575060] Key type asymmetric registered
[ 1.578443] Asymmetric key parser 'x509' registered
[ 1.582145] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 1.588490] io scheduler mq-deadline registered
[ 1.592061] io scheduler kyber registered
[ 1.595427] io scheduler bfq registered
[ 1.599093] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[ 1.603553] intel_idle: Please enable MWAIT in BIOS SETUP
[ 1.603854] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 1.608392] 00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 1.615674] nvme nvme0: pci function 0000:00:04.0
[ 1.619359] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[ 1.619724] PCI Interrupt Link [LNKD] enabled at IRQ 11
[ 1.626369] i8042: Warning: Keylock active
[ 1.634373] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 1.638083] serio: i8042 AUX port at 0x60,0x64 irq 12
[ 1.642093] rtc_cmos 00:00: RTC can wake from S4
[ 1.649124] rtc_cmos 00:00: registered as rtc0
[ 1.649799] nvme nvme0: 2/0/0 default/read/poll queues
[ 1.656818] rtc_cmos 00:00: setting system clock to 2022-09-27T13:14:59 UTC (1664284499)
[ 1.656820] rtc_cmos 00:00: alarms up to one day, 114 bytes nvram
[ 1.656843] intel_pstate: CPU model not supported
[ 1.665972] nvme0n1: p1 p128
[ 1.667924] hid: raw HID events driver (C) Jiri Kosina
[ 1.678472] NET: Registered protocol family 10
[ 1.685564] Segment Routing with IPv6
[ 1.688823] NET: Registered protocol family 17
[ 1.692786] IPI shorthand broadcast: enabled
[ 1.696227] sched_clock: Marking stable (988039228, 708169048)->(2004698642, -308490366)
[ 1.702831] registered taskstats version 1
[ 1.706189] Loading compiled-in X.509 certificates
[ 1.711772] Loaded X.509 cert 'Build time autogenerated kernel key: fac365f2d336592a96aa486ff67edc69a1905893'
[ 1.719024] zswap: loaded using pool lzo/zbud
[ 1.722589] ima: No TPM chip found, activating TPM-bypass!
[ 1.726519] ima: Allocated hash algorithm: sha1
[ 1.730049] ima: No architecture policies found
[ 1.735339] Freeing unused decrypted memory: 2036K
[ 1.739539] Freeing unused kernel image (initmem) memory: 2444K
[ 1.745426] Write protecting the kernel read-only data: 22528k
[ 1.750030] Freeing unused kernel image (text/rodata gap) memory: 2036K
[ 1.754693] Freeing unused kernel image (rodata/data gap) memory: 1264K
[ 1.759086] Run /init as init process
[ 1.762294] with arguments:
[ 1.762295] /init
[ 1.762295] with environment:
[ 1.762296] HOME=/
[ 1.762297] TERM=linux
[ 1.762297] BOOT_IMAGE=/boot/vmlinuz-5.10.135-122.509.amzn2.x86_64
[ 1.762298] biosdevname=0
[ 1.778065] systemd[1]: systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
[ 1.790139] systemd[1]: Detected virtualization amazon.
[ 1.793925] systemd[1]: Detected architecture x86-64.
[ 1.797618] systemd[1]: Running in initial RAM disk.
[ 1.803140] systemd[1]: No hostname configured.
[ 1.806681] systemd[1]: Set hostname to <localhost>.
[ 1.810404] systemd[1]: Initializing machine ID from VM UUID.
[ 1.838112] systemd[1]: Reached target Swap.
[ 1.842768] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[ 1.850819] systemd[1]: Reached target Timers.
[ 2.021357] XFS (nvme0n1p1): Mounting V5 Filesystem
[ 2.158082] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
[ 2.167552] XFS (nvme0n1p1): Ending clean mount
[ 2.330907] systemd-journald[730]: Received SIGTERM from PID 1 (systemd).
[ 2.337914] printk: systemd: 20 output lines suppressed due to ratelimiting
[ 2.358856] SELinux: Runtime disable is deprecated, use selinux=0 on the kernel cmdline.
[ 2.365439] SELinux: Disabled at runtime.
[ 2.429460] audit: type=1404 audit(1664284500.276:2): enforcing=0 old_enforcing=0 auid=4294967295 ses=4294967295 enabled=0 old-enabled=1 lsm=selinux res=1
[ 2.827122] xfs filesystem being remounted at / supports timestamps until 2038 (0x7fffffff)
[ 2.868438] ena 0000:00:05.0: Elastic Network Adapter (ENA) v2.7.4g
[ 2.882224] ena 0000:00:05.0: ENA device version: 0.10
[ 2.886546] ena 0000:00:05.0: ENA controller version: 0.0.1 implementation version 1
[ 2.896619] systemd-journald[1190]: Received request to flush runtime journal from PID 1
[ 2.953435] ena 0000:00:05.0: LLQ is not supported Fallback to host mode policy.
[ 2.972054] ena 0000:00:05.0: Elastic Network Adapter (ENA) found at mem febf4000, mac addr 0e:08:bc:ee:a3:a6
[ 3.499349] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input3
[ 3.562336] ACPI: Power Button [PWRF]
[ 3.581368] input: Sleep Button as /devices/LNXSYSTM:00/LNXSLPBN:00/input/input4
[ 3.609853] ACPI: Sleep Button [SLPF]
[ 3.729446] input: ImPS/2 Generic Wheel Mouse as /devices/platform/i8042/serio1/input/input5
[ 3.787051] cryptd: max_cpu_qlen set to 1000
[ 3.849634] AVX2 version of gcm_enc/dec engaged.
[ 3.853675] AES CTR mode by8 optimization enabled
[ 3.853750] mousedev: PS/2 mouse device common for all mice
[ 4.241130] device-mapper: uevent: version 1.0.3
[ 4.245459] device-mapper: ioctl: 4.43.0-ioctl (2020-10-01) initialised: dm-devel@redhat.com
[ 4.365543] RPC: Registered named UNIX socket transport module.
[ 4.365544] RPC: Registered udp transport module.
[ 4.365544] RPC: Registered tcp transport module.
[ 4.365545] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 4.459333] xfs filesystem being remounted at /tmp supports timestamps until 2038 (0x7fffffff)
[ 4.459814] xfs filesystem being remounted at /var/tmp supports timestamps until 2038 (0x7fffffff)
[ 5.655228] ena 0000:00:05.0 eth0: Local page cache is disabled for less than 16 channels
[ 6.687093] xfs filesystem being remounted at /tmp supports timestamps until 2038 (0x7fffffff)
[ 6.687576] xfs filesystem being remounted at /var/tmp supports timestamps until 2038 (0x7fffffff)
[ 383.753381] systemd-sysv-generator[3046]: Configuration file /usr/lib/systemd/system/codedeploy-agent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
[ 383.829685] systemd-sysv-generator[3066]: Configuration file /usr/lib/systemd/system/codedeploy-agent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
[ 408.424891] systemd-sysv-generator[3206]: Configuration file /usr/lib/systemd/system/codedeploy-agent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
[ 408.487008] systemd-sysv-generator[3225]: Configuration file /usr/lib/systemd/system/codedeploy-agent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
[ 892.144130] systemd-sysv-generator[7167]: Configuration file /usr/lib/systemd/system/codedeploy-agent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
[ 892.226105] systemd-sysv-generator[7187]: Configuration file /usr/lib/systemd/system/codedeploy-agent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
var/log/messages
输出
Sep 27 14:59:03 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 130770ms.
Sep 27 15:00:01 ip-172-31-3-156 systemd: Started Session 13 of user root.
Sep 27 15:01:01 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:01:01 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:01:01 ip-172-31-3-156 systemd: Started Session 14 of user root.
Sep 27 15:01:01 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:01:14 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 114790ms.
Sep 27 15:03:09 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 130520ms.
Sep 27 15:05:19 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 114090ms.
Sep 27 15:07:13 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 127250ms.
Sep 27 15:09:21 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 116810ms.
Sep 27 15:10:01 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:10:01 ip-172-31-3-156 systemd: Started Session 15 of user root.
Sep 27 15:10:01 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:11:18 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 125810ms.
Sep 27 15:13:24 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 109230ms.
Sep 27 15:15:13 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 115140ms.
Sep 27 15:17:08 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 113270ms.
Sep 27 15:19:01 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 110410ms.
Sep 27 15:20:01 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:20:01 ip-172-31-3-156 systemd: Started Session 16 of user root.
Sep 27 15:20:01 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:20:52 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 120500ms.
Sep 27 15:22:53 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 124260ms.
Sep 27 15:22:57 ip-172-31-3-156 systemd: Started Session 17 of user ec2-user.
Sep 27 15:22:57 ip-172-31-3-156 systemd-logind: New session 17 of user ec2-user.
Sep 27 15:24:57 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 109210ms.
Sep 27 15:26:18 ip-172-31-3-156 dhclient[2039]: DHCPREQUEST on eth0 to 172.31.0.1 port 67 (xid=0x2ac6e237)
Sep 27 15:26:18 ip-172-31-3-156 dhclient[2039]: DHCPACK from 172.31.0.1 (xid=0x2ac6e237)
Sep 27 15:26:19 ip-172-31-3-156 NET: dhclient: Locked /run/dhclient/resolv.lock
Sep 27 15:26:19 ip-172-31-3-156 dhclient[2039]: bound to 172.31.3.156 -- renewal in 1779 seconds.
Sep 27 15:26:19 ip-172-31-3-156 ec2net: [get_meta] Querying IMDS for meta-data/network/interfaces/macs/0e:08:bc:ee:a3:a6/local-ipv4s
Sep 27 15:26:19 ip-172-31-3-156 ec2net: [get_meta] Getting token for IMDSv2.
Sep 27 15:26:19 ip-172-31-3-156 ec2net: [get_meta] Trying to get http://169.254.169.254/latest/meta-data/network/interfaces/macs/0e:08:bc:ee:a3:a6/local-ipv4s
Sep 27 15:26:19 ip-172-31-3-156 ec2net: [remove_aliases] Removing aliases of eth0
Sep 27 15:26:46 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 122080ms.
Sep 27 15:27:05 ip-172-31-3-156 systemd: log4j-cve-2021-44228-hotpatch.service holdoff time over, scheduling restart.
Sep 27 15:27:05 ip-172-31-3-156 systemd: Stopped Run the CVE-2021-44228 hotfix script.
Sep 27 15:27:05 ip-172-31-3-156 systemd: Started Run the CVE-2021-44228 hotfix script.
Sep 27 15:27:05 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Starting up now...
Sep 27 15:27:05 ip-172-31-3-156 root: Starting up now...
Sep 27 15:27:05 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Found JVMs with pids [4857]
Sep 27 15:27:05 ip-172-31-3-156 root: Found JVMs with pids [4857]
Sep 27 15:27:05 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Attempting to patch 4857
Sep 27 15:27:05 ip-172-31-3-156 root: Attempting to patch 4857
Sep 27 15:27:07 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Found JVM running with effective UID of 0
Sep 27 15:27:07 ip-172-31-3-156 root: Found JVM running with effective UID of 0
Sep 27 15:27:07 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Found JVM for pid 4857 at /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java
Sep 27 15:27:07 ip-172-31-3-156 root: Found JVM for pid 4857 at /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java
Sep 27 15:27:07 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:27:07 ip-172-31-3-156 systemd: Started Session c22 of user root.
Sep 27 15:27:07 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:27:07 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] JVM version is openjdk version "17.0.4.1" 2022-08-12 LTS
Sep 27 15:27:07 ip-172-31-3-156 root: JVM version is openjdk version "17.0.4.1" 2022-08-12 LTS
Sep 27 15:27:07 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Identified JVM[openjdk] of (openjdk version "17.0.4.1" 2022-08-12 LTS) with major version 17
Sep 27 15:27:07 ip-172-31-3-156 root: Identified JVM[openjdk] of (openjdk version "17.0.4.1" 2022-08-12 LTS) with major version 17
Sep 27 15:27:08 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:27:08 ip-172-31-3-156 systemd: Started Session c23 of user root.
Sep 27 15:27:08 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Using Java 17 hotpatch
Sep 27 15:27:08 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:27:08 ip-172-31-3-156 root: Using Java 17 hotpatch
Sep 27 15:27:08 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:27:08 ip-172-31-3-156 systemd: Started Session c24 of user root.
Sep 27 15:27:08 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:27:08 ip-172-31-3-156 log4j-cve-2021-44228-hotpatch: [log4j-hotpatch] Hotpatch application returned 0
Sep 27 15:27:08 ip-172-31-3-156 root: Hotpatch application returned 0
Sep 27 15:28:48 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 121490ms.
Sep 27 15:30:01 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:30:01 ip-172-31-3-156 systemd: Started Session 18 of user root.
Sep 27 15:30:01 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:30:50 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 115800ms.
Sep 27 15:32:46 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 125350ms.
Sep 27 15:34:51 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 117180ms.
Sep 27 15:36:49 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 129010ms.
Sep 27 15:38:58 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 129190ms.
Sep 27 15:40:01 ip-172-31-3-156 systemd: Created slice User Slice of root.
Sep 27 15:40:01 ip-172-31-3-156 systemd: Started Session 19 of user root.
Sep 27 15:40:01 ip-172-31-3-156 systemd: Removed slice User Slice of root.
Sep 27 15:41:07 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 128040ms.
Sep 27 15:43:15 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 129220ms.
Sep 27 15:45:24 ip-172-31-3-156 dhclient[2086]: XMT: Solicit on eth0, interval 126940ms.
发布于 2022-09-29 03:52:13
我终于找到了原因。问题就在密码里。其中一个线程被困在无限循环中,因为我写错了条件。然而,帮助我解决问题的是jstack
工具。我运行ps -C java -o pid
命令来查找java应用程序的PID,而不是jstack PID
,并获得非常容易理解的日志,说明线程在哪里和线程卡在哪里。
https://stackoverflow.com/questions/73863856
复制相似问题