I am currently developing a UDP Client/Server Test Application. While developing this test application I came across the following bug. I am getting a (SIGBUS) violation in datagram socket send() and close(). It happens with UDP datagram packets greater than 3K in bytes.
Here is the datagram socket close() SIGBUS violation I get with datagram packets of size 3K.
java udpClient -d -v -b 3 k -l 5
VERBOSE: port number is = 26000
VERBOSE: buffer size is = 3 K
VERBOSE: real buffer size is = 3072
VERBOSE: server name = localhost
VERBOSE: loop count messages is = 5
VERBOSE: data comparison = false
VERBOSE: random buffer sizes = false
DEBUG: DATAGRAM SOCKET INFO
DEBUG: --------------------
DEBUG: getLocalPort() = 38584
DEBUG: getSoTimeout() = 0
DEBUG: Dump getLocalAddress()
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = 0.0.0.0
DEBUG: getAllByName[0] = 0.0.0.0/0.0.0.0
DEBUG: getByName() = 0.0.0.0/0.0.0.0
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 0.0.0.0
DEBUG: isMulticastAddress() = false
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = localhost
DEBUG: getAllByName[0] = localhost/127.0.0.1
DEBUG: getByName() = localhost/127.0.0.1
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 127.0.0.1
DEBUG: isMulticastAddress() = false
DEBUG: wrote message #1
DEBUG: wrote message #2
DEBUG: wrote message #3
DEBUG: wrote message #4
DEBUG: wrote message #5
DEBUG: before closing datagram socket
SIGBUS 10* bus error
si_signo [10]: SIGBUS 10* bus error
si_errno [0]: Error 0
si_code [1]: BUS_ADRALN [addr: 0x61616161]
stackbase=F0000000, stackpointer=EFFFE148
Full thread dump:
"CachedReference sweeper" (TID:0xee300d78, sys_thread_t:0x108330, state:CW) prio=9
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.Runtime.waitForMemoryAdvice(Runtime.java:569)
at java.lang.ref.CachedReference$Sweeper.run(CachedReference.java:279)
at java.lang.Thread.run(Thread.java:472)
"Finalizer" (TID:0xee300368, sys_thread_t:0xeadb8, state:CW) prio=8
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:85)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:98)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:131)
"Reference handler" (TID:0xee300418, sys_thread_t:0xf1678, state:CW) prio=10
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:197)
"Async Garbage Collector" (TID:0xee3001f8, sys_thread_t:0xa3430, state:R) prio=1
"Idle thread" (TID:0xee300240, sys_thread_t:0xa3328, state:R) prio=0
"Clock" (TID:0xee300088, sys_thread_t:0xf00e0, state:CW) prio=12
"main" (TID:0xee3000b0, sys_thread_t:0x209f8, state:R) prio=5 *current thread*
at java.lang.ClassLoader$NativeLibrary.find(Native Method)
at java.lang.ClassLoader.findNative(ClassLoader.java:695)
at java.net.PlainDatagramSocketImpl.close(PlainDatagramSocketImpl.java:114)
at java.net.DatagramSocket.close(DatagramSocket.java:294)
at udpClient.<init>(udpClient.java:170)
at udpClient.main(udpClient.java:87)
Monitor Cache Dump:
java.util.Vector@EE301DA8/EE36A108: owner "main" (0x209f8, 1 entry)
<unknown key> (0xef5d4228): owner "main" (0x209f8, 1 entry)
Registered Monitor Dump:
utf8 hash table: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class linking lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
"Clock" (0xf00e0)
Sbrk lock: <unowned>
Monitor cache expansion lock: <unowned>
Thread queue lock: <unowned>
Monitor registry: owner "main" (0x209f8, 1 entry)
Thread Alarm Q:
Abort
Here is the datagram socket send() SIGBUS violation I get with datagram packets of 8K.
java udpClient -d -v -b 8 k -l 5
VERBOSE: port number is = 26000
VERBOSE: buffer size is = 8 K
VERBOSE: real buffer size is = 8192
VERBOSE: server name = localhost
VERBOSE: loop count messages is = 5
VERBOSE: data comparison = false
VERBOSE: random buffer sizes = false
DEBUG: DATAGRAM SOCKET INFO
DEBUG: --------------------
DEBUG: getLocalPort() = 38585
DEBUG: getSoTimeout() = 0
DEBUG: Dump getLocalAddress()
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = 0.0.0.0
DEBUG: getAllByName[0] = 0.0.0.0/0.0.0.0
DEBUG: getByName() = 0.0.0.0/0.0.0.0
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 0.0.0.0
DEBUG: isMulticastAddress() = false
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = localhost
DEBUG: getAllByName[0] = localhost/127.0.0.1
DEBUG: getByName() = localhost/127.0.0.1
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 127.0.0.1
DEBUG: isMulticastAddress() = false
DEBUG: wrote message #1
SIGBUS 10* bus error
si_signo [10]: SIGBUS 10* bus error
si_errno [0]: Error 0
si_code [1]: BUS_ADRALN [addr: 0x61616161]
stackbase=F0000000, stackpointer=EFFFE148
Full thread dump:
"CachedReference sweeper" (TID:0xee300d78, sys_thread_t:0x108330, state:CW) prio=9
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.Runtime.waitForMemoryAdvice(Runtime.java:569)
at java.lang.ref.CachedReference$Sweeper.run(CachedReference.java:279)
at java.lang.Thread.run(Thread.java:472)
"Finalizer" (TID:0xee300368, sys_thread_t:0xeadb8, state:CW) prio=8
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:85)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:98)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:131)
"Reference handler" (TID:0xee300418, sys_thread_t:0xf1678, state:CW) prio=10
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:197)
"Async Garbage Collector" (TID:0xee3001f8, sys_thread_t:0xa3430, state:R) prio=1
"Idle thread" (TID:0xee300240, sys_thread_t:0xa3328, state:R) prio=0
"Clock" (TID:0xee300088, sys_thread_t:0xf00e0, state:CW) prio=12
"main" (TID:0xee3000b0, sys_thread_t:0x209f8, state:R) prio=5 *current thread*
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:170)
at udpClient.<init>(udpClient.java:123)
at udpClient.main(udpClient.java:87)
Monitor Cache Dump:
java.net.DatagramPacket@EE303098/EE3716E0: owner "main" (0x209f8, 1 entry)
Registered Monitor Dump:
utf8 hash table: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class linking lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
"Clock" (0xf00e0)
Sbrk lock: <unowned>
Monitor cache expansion lock: <unowned>
Thread queue lock: <unowned>
Monitor registry: owner "main" (0x209f8, 1 entry)
Thread Alarm Q:
Abort
Here is a sucessful run using datagram packets of 1K.
java udpClient -d -v -b 1 k -l 5
VERBOSE: port number is = 26000
VERBOSE: buffer size is = 1 K
VERBOSE: real buffer size is = 1024
VERBOSE: server name = localhost
VERBOSE: loop count messages is = 5
VERBOSE: data comparison = false
VERBOSE: random buffer sizes = false
DEBUG: DATAGRAM SOCKET INFO
DEBUG: --------------------
DEBUG: getLocalPort() = 38586
DEBUG: getSoTimeout() = 0
DEBUG: Dump getLocalAddress()
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = 0.0.0.0
DEBUG: getAllByName[0] = 0.0.0.0/0.0.0.0
DEBUG: getByName() = 0.0.0.0/0.0.0.0
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 0.0.0.0
DEBUG: isMulticastAddress() = false
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = localhost
DEBUG: getAllByName[0] = localhost/127.0.0.1
DEBUG: getByName() = localhost/127.0.0.1
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 127.0.0.1
DEBUG: isMulticastAddress() = false
DEBUG: wrote message #1
DEBUG: wrote message #2
DEBUG: wrote message #3
DEBUG: wrote message #4
DEBUG: wrote message #5
DEBUG: before closing datagram socket
DEBUG: after closing datagram socket
DEBUG: before calling timer.stop()
DEBUG: after calling timer.stop()
DEBUG: in PrintPerformanceStats()
VERBOSE: ---------------------------
VERBOSE: Performance Statistics Are:
VERBOSE: ---------------------------
VERBOSE: Client Running: JDK 1.2beta2 on SunOS 5.5.1
VERBOSE: OS Architecture: sparc
VERBOSE: Java Vendor: Sun Microsystems Inc.
VERBOSE: Number of Messages sent = 5
VERBOSE: Total Bytes Transfered = 5K
VERBOSE: Total Bytes Transfered per session = 1K
VERBOSE: Total Time in Milliseconds = 41
VERBOSE: Total Time in Seconds = 0
VERBOSE: Total Time Formatted = 41 millisecs
FINALSTATS:udpClient:EXIT_PASS:0
I tried this same program on JDK1.1.4 and JDK1.1.5 using datagram packets of 3K and 8K and it passes. This is definitely a regression from JDK1.1.4 and JDK1.1.5.
Here is the datagram socket close() SIGBUS violation I get with datagram packets of size 3K.
java udpClient -d -v -b 3 k -l 5
VERBOSE: port number is = 26000
VERBOSE: buffer size is = 3 K
VERBOSE: real buffer size is = 3072
VERBOSE: server name = localhost
VERBOSE: loop count messages is = 5
VERBOSE: data comparison = false
VERBOSE: random buffer sizes = false
DEBUG: DATAGRAM SOCKET INFO
DEBUG: --------------------
DEBUG: getLocalPort() = 38584
DEBUG: getSoTimeout() = 0
DEBUG: Dump getLocalAddress()
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = 0.0.0.0
DEBUG: getAllByName[0] = 0.0.0.0/0.0.0.0
DEBUG: getByName() = 0.0.0.0/0.0.0.0
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 0.0.0.0
DEBUG: isMulticastAddress() = false
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = localhost
DEBUG: getAllByName[0] = localhost/127.0.0.1
DEBUG: getByName() = localhost/127.0.0.1
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 127.0.0.1
DEBUG: isMulticastAddress() = false
DEBUG: wrote message #1
DEBUG: wrote message #2
DEBUG: wrote message #3
DEBUG: wrote message #4
DEBUG: wrote message #5
DEBUG: before closing datagram socket
SIGBUS 10* bus error
si_signo [10]: SIGBUS 10* bus error
si_errno [0]: Error 0
si_code [1]: BUS_ADRALN [addr: 0x61616161]
stackbase=F0000000, stackpointer=EFFFE148
Full thread dump:
"CachedReference sweeper" (TID:0xee300d78, sys_thread_t:0x108330, state:CW) prio=9
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.Runtime.waitForMemoryAdvice(Runtime.java:569)
at java.lang.ref.CachedReference$Sweeper.run(CachedReference.java:279)
at java.lang.Thread.run(Thread.java:472)
"Finalizer" (TID:0xee300368, sys_thread_t:0xeadb8, state:CW) prio=8
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:85)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:98)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:131)
"Reference handler" (TID:0xee300418, sys_thread_t:0xf1678, state:CW) prio=10
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:197)
"Async Garbage Collector" (TID:0xee3001f8, sys_thread_t:0xa3430, state:R) prio=1
"Idle thread" (TID:0xee300240, sys_thread_t:0xa3328, state:R) prio=0
"Clock" (TID:0xee300088, sys_thread_t:0xf00e0, state:CW) prio=12
"main" (TID:0xee3000b0, sys_thread_t:0x209f8, state:R) prio=5 *current thread*
at java.lang.ClassLoader$NativeLibrary.find(Native Method)
at java.lang.ClassLoader.findNative(ClassLoader.java:695)
at java.net.PlainDatagramSocketImpl.close(PlainDatagramSocketImpl.java:114)
at java.net.DatagramSocket.close(DatagramSocket.java:294)
at udpClient.<init>(udpClient.java:170)
at udpClient.main(udpClient.java:87)
Monitor Cache Dump:
java.util.Vector@EE301DA8/EE36A108: owner "main" (0x209f8, 1 entry)
<unknown key> (0xef5d4228): owner "main" (0x209f8, 1 entry)
Registered Monitor Dump:
utf8 hash table: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class linking lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
"Clock" (0xf00e0)
Sbrk lock: <unowned>
Monitor cache expansion lock: <unowned>
Thread queue lock: <unowned>
Monitor registry: owner "main" (0x209f8, 1 entry)
Thread Alarm Q:
Abort
Here is the datagram socket send() SIGBUS violation I get with datagram packets of 8K.
java udpClient -d -v -b 8 k -l 5
VERBOSE: port number is = 26000
VERBOSE: buffer size is = 8 K
VERBOSE: real buffer size is = 8192
VERBOSE: server name = localhost
VERBOSE: loop count messages is = 5
VERBOSE: data comparison = false
VERBOSE: random buffer sizes = false
DEBUG: DATAGRAM SOCKET INFO
DEBUG: --------------------
DEBUG: getLocalPort() = 38585
DEBUG: getSoTimeout() = 0
DEBUG: Dump getLocalAddress()
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = 0.0.0.0
DEBUG: getAllByName[0] = 0.0.0.0/0.0.0.0
DEBUG: getByName() = 0.0.0.0/0.0.0.0
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 0.0.0.0
DEBUG: isMulticastAddress() = false
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = localhost
DEBUG: getAllByName[0] = localhost/127.0.0.1
DEBUG: getByName() = localhost/127.0.0.1
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 127.0.0.1
DEBUG: isMulticastAddress() = false
DEBUG: wrote message #1
SIGBUS 10* bus error
si_signo [10]: SIGBUS 10* bus error
si_errno [0]: Error 0
si_code [1]: BUS_ADRALN [addr: 0x61616161]
stackbase=F0000000, stackpointer=EFFFE148
Full thread dump:
"CachedReference sweeper" (TID:0xee300d78, sys_thread_t:0x108330, state:CW) prio=9
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.Runtime.waitForMemoryAdvice(Runtime.java:569)
at java.lang.ref.CachedReference$Sweeper.run(CachedReference.java:279)
at java.lang.Thread.run(Thread.java:472)
"Finalizer" (TID:0xee300368, sys_thread_t:0xeadb8, state:CW) prio=8
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:85)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:98)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:131)
"Reference handler" (TID:0xee300418, sys_thread_t:0xf1678, state:CW) prio=10
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:309)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:197)
"Async Garbage Collector" (TID:0xee3001f8, sys_thread_t:0xa3430, state:R) prio=1
"Idle thread" (TID:0xee300240, sys_thread_t:0xa3328, state:R) prio=0
"Clock" (TID:0xee300088, sys_thread_t:0xf00e0, state:CW) prio=12
"main" (TID:0xee3000b0, sys_thread_t:0x209f8, state:R) prio=5 *current thread*
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:170)
at udpClient.<init>(udpClient.java:123)
at udpClient.main(udpClient.java:87)
Monitor Cache Dump:
java.net.DatagramPacket@EE303098/EE3716E0: owner "main" (0x209f8, 1 entry)
Registered Monitor Dump:
utf8 hash table: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class linking lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
"Clock" (0xf00e0)
Sbrk lock: <unowned>
Monitor cache expansion lock: <unowned>
Thread queue lock: <unowned>
Monitor registry: owner "main" (0x209f8, 1 entry)
Thread Alarm Q:
Abort
Here is a sucessful run using datagram packets of 1K.
java udpClient -d -v -b 1 k -l 5
VERBOSE: port number is = 26000
VERBOSE: buffer size is = 1 K
VERBOSE: real buffer size is = 1024
VERBOSE: server name = localhost
VERBOSE: loop count messages is = 5
VERBOSE: data comparison = false
VERBOSE: random buffer sizes = false
DEBUG: DATAGRAM SOCKET INFO
DEBUG: --------------------
DEBUG: getLocalPort() = 38586
DEBUG: getSoTimeout() = 0
DEBUG: Dump getLocalAddress()
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = 0.0.0.0
DEBUG: getAllByName[0] = 0.0.0.0/0.0.0.0
DEBUG: getByName() = 0.0.0.0/0.0.0.0
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 0.0.0.0
DEBUG: isMulticastAddress() = false
DEBUG: INET ADDRESS INFO
DEBUG: -----------------
DEBUG: getHostName() = localhost
DEBUG: getAllByName[0] = localhost/127.0.0.1
DEBUG: getByName() = localhost/127.0.0.1
DEBUG: getLocalHost() = lobo/129.148.27.228
DEBUG: FIX: getAddress() =
DEBUG: getHostAddress() = 127.0.0.1
DEBUG: isMulticastAddress() = false
DEBUG: wrote message #1
DEBUG: wrote message #2
DEBUG: wrote message #3
DEBUG: wrote message #4
DEBUG: wrote message #5
DEBUG: before closing datagram socket
DEBUG: after closing datagram socket
DEBUG: before calling timer.stop()
DEBUG: after calling timer.stop()
DEBUG: in PrintPerformanceStats()
VERBOSE: ---------------------------
VERBOSE: Performance Statistics Are:
VERBOSE: ---------------------------
VERBOSE: Client Running: JDK 1.2beta2 on SunOS 5.5.1
VERBOSE: OS Architecture: sparc
VERBOSE: Java Vendor: Sun Microsystems Inc.
VERBOSE: Number of Messages sent = 5
VERBOSE: Total Bytes Transfered = 5K
VERBOSE: Total Bytes Transfered per session = 1K
VERBOSE: Total Time in Milliseconds = 41
VERBOSE: Total Time in Seconds = 0
VERBOSE: Total Time Formatted = 41 millisecs
FINALSTATS:udpClient:EXIT_PASS:0
I tried this same program on JDK1.1.4 and JDK1.1.5 using datagram packets of 3K and 8K and it passes. This is definitely a regression from JDK1.1.4 and JDK1.1.5.