gpt4 book ai didi

java - 许多线程处于 IN_NATIVE 状态

转载 作者:行者123 更新时间:2023-11-28 22:38:03 25 4
gpt4 key购买 nike

我们在 tomcat 节点中发现了一些奇怪的问题。我拿了线程转储来查看线程状态。大多数线程都处于 IN_NATIVE 状态。有人可以告诉我它是什么以及造成这种情况的原因吗?这是线程的堆栈跟踪。

Thread 677: (state = IN_NATIVE)
- java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Compiled frame; information may be imprecise)
- java.net.SocketInputStream.read(byte[], int, int) @bci=84, line=129 (Compiled frame)
- com.sun.net.ssl.internal.ssl.InputRecord.readFully(java.io.InputStream, byte[], int, int) @bci=21, line=293 (Compiled frame)
- com.sun.net.ssl.internal.ssl.InputRecord.read(java.io.InputStream, java.io.OutputStream) @bci=32, line=331 (Compiled frame)
- com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(com.sun.net.ssl.internal.ssl.InputRecord, boolean) @bci=44, line=789 (Compiled frame)
- com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(com.sun.net.ssl.internal.ssl.InputRecord) @bci=15, line=746 (Compiled frame)
- com.sun.net.ssl.internal.ssl.AppInputStream.read(byte[], int, int) @bci=30, line=75 (Compiled frame)
- java.io.BufferedInputStream.fill() @bci=175, line=218 (Compiled frame)
- java.io.BufferedInputStream.read1(byte[], int, int) @bci=44, line=258 (Compiled frame)
- java.io.BufferedInputStream.read(byte[], int, int) @bci=49, line=317 (Compiled frame)
- com.sun.jndi.ldap.Connection.run() @bci=30, line=808 (Compiled frame)
- java.lang.Thread.run() @bci=11, line=619 (Interpreted frame)


Thread 675: (state = IN_NATIVE)
- java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Compiled frame; information may be imprecise)
- java.net.SocketInputStream.read(byte[], int, int) @bci=84, line=129 (Compiled frame)
- com.sun.net.ssl.internal.ssl.InputRecord.readFully(java.io.InputStream, byte[], int, int) @bci=21, line=293 (Compiled frame)
- com.sun.net.ssl.internal.ssl.InputRecord.read(java.io.InputStream, java.io.OutputStream) @bci=32, line=331 (Compiled frame)
- com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(com.sun.net.ssl.internal.ssl.InputRecord, boolean) @bci=44, line=789 (Compiled frame)
- com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(com.sun.net.ssl.internal.ssl.InputRecord) @bci=15, line=746 (Compiled frame)
- com.sun.net.ssl.internal.ssl.AppInputStream.read(byte[], int, int) @bci=30, line=75 (Compiled frame)
- java.io.BufferedInputStream.fill() @bci=175, line=218 (Compiled frame)
- java.io.BufferedInputStream.read1(byte[], int, int) @bci=44, line=258 (Compiled frame)
- java.io.BufferedInputStream.read(byte[], int, int) @bci=49, line=317 (Compiled frame)
- com.sun.jndi.ldap.Connection.run() @bci=30, line=808 (Compiled frame)
- java.lang.Thread.run() @bci=11, line=619 (Interpreted frame)

完整的 Threaddump 是@ https://docs.google.com/document/d/16YnK85jrlxvu_PpQrTQxtIWjWmAlt8AF1ddAOzvisCM/edit?usp=sharing

最佳答案

Java 的编写有点像 C++ 的包装语言。一些库仍然使用 c++ 并使用 java 关键字 native。

这基本上意味着他们调用了一个正在以 c/c++ 代码执行的本地方法。

关于java - 许多线程处于 IN_NATIVE 状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14675113/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com