为什么我的 Jetty 服务器记录 DNS 错误?

为什么我的 Jetty 服务器记录 DNS 错误?

我有一台 Xen 虚拟机,其中安装了 Jetty 7.4.5,用于运行 Hudson 实例。它运行良好,大约一个月。今天我们注意到 Hudson 无法生成构建。问题是我们的磁盘空间不够了,因为我们一天前有一个包含 34 Gb 数据的 jetty 日志文件。

该文件包含许多有关 DNS 的消息,如下所示:

21/09/2011 07:34:30 javax.jmdns.impl.DNSIncoming$MessageInputStream readName
GRAVE: Extended label are not currently supported.
21/09/2011 07:34:30 javax.jmdns.impl.DNSIncoming$MessageInputStream readName
GRAVE: Extended label are not currently supported.
21/09/2011 07:34:30 javax.jmdns.impl.DNSIncoming$MessageInputStream readName
GRAVE: Extended label are not currently supported.
21/09/2011 07:34:30 javax.jmdns.impl.DNSIncoming$MessageInputStream readName
GRAVE: Extended label are not currently supported.
21/09/2011 07:34:30 javax.jmdns.impl.constants.DNSRecordType typeForIndex
GRAVE: Could not find record type for index: 120
21/09/2011 07:34:30 javax.jmdns.impl.DNSIncoming readQuestion
GRAVE: Could not find record type: dns[query,10.10.2.53:5353, length=296, id=0x0, flags=0x6544:aa]
   0: 6963654465736372 3d32342d706f7274 2031302f3130302f 3130303020457468     iceDescr =24-port .10/100/ 1000.Eth
  20: 65726e6574205377 69746368c02b0021 000100000078001a 00000000a5500c53     ernet.Sw itch.+.! .....x.. .....P.S
  40: 7769746368313832 396261056c6f6361 6c00c02b00100001 0000007800bc0d6d     witch182 9ba.loca l..+.... ...x...m
  60: 6f64656c3d534745 3230303015736572 69616c4e6f3d374e 3430304843303033     odel=SGE 2000.ser ialNo=7N 400HC003
  80: 3137126877766572 73696f6e3d30302e 30302e303112666d 56657273696f6e3d     17.hwver sion=00. 00.01.fm Version=
  a0: 332e302e302e3137 0d69667665727369 6f6e3d312e30174d 4143416464726573     3.0.0.17 .ifversi on=1.0.M ACAddres
  c0: 733d303032323662 3138323962611164 6576696365547970 653d537769746368     s=00226b 1829ba.d eviceTyp e=Switch
  e0: 09686f73746e616d 653d2f6465766963 6544657363723d32 342d706f72742031     .hostnam e=/devic eDescr=2 4-port.1
 100: 302f3130302f3130 3030204574686572 6e65742053776974 6368c02b00210001     0/100/10 00.Ether net.Swit ch.+.!..
 120: 00000078001a0000                                                        ...x....

21/09/2011 07:34:30 javax.jmdns.impl.constants.DNSRecordClass classForIndex
AVISO: Could not find record class for index: 26

我们已将日志文件复制到另一个位置,将其从服务器中移除以释放空间,并注意到实际日志文件再次包含此类消息。此外,我们注意到 jetty 正在使用以下端口(netstat 结果):

tcp6       0      0 :::8080                 :::*                    LISTEN       1598/java       
tcp6       0      0 :::55224                :::*                    LISTEN       1598/java       
udp6       0      0 :::33848                :::*                                1598/java       
udp6       0      0 :::5353                 :::*                                1598/java

有人知道为什么 jetty 使用不同于 8080 的端口,以及这些 DNS 消息来自哪里吗?我们只安装了 hudson。

答案1

我不会对此发表最终决定,但我在运行 Jenkins(它包含 Hudson)时遇到了同样的问题。

Hudson 使用 Jmdns 在本地网络上实现服务发现(通过广播)。我认为当 Hudson 收到来自其他星球的消息时,它会感到恐慌。我不知道如何让它高兴,但就我而言,我禁用了该功能。使用 Jenkins 时,它会这样运行:

java -Dhudson.DNSMultiCast.disabled=true -jar path/to/jenkins.war

答案2

您可以通过调整 Jenkins 内的日志设置来禁用这些 DNS 错误的日志记录。

从 Jenkins Web 界面转到:

管理 Jenkins -> 系统日志 -> 日志级别(左侧)

添加以下条目:

姓名:javax.jmdns

等级:离开

这样,您可以保留多播 DNS 功能,但无需保留所有日志数据。

相关内容