Deadlock - Thread Dump Included

R

rajatag

Here's a deadlock that our chat server gets into every now and then.
There's no fixed time. Sometimes it runs with 50-60 users for 6 hours
and sometimes it crashes in 2 hours.

Given below is the thread dump. Can anyone figure out what could be
causing this?

Thanks!

------------------------

Full thread dump Java HotSpot(TM) Server VM (1.5.0_04-b05 mixed mode):

"Thread-176" prio=5 tid=0x088b9e00 nid=0x6608 runnable
[0x0575f000..0x0575fa1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at
com.RJSoftwares.ServerSide.Server.NotifyBuddies(Server.java:229)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:195)

"Thread-166" prio=5 tid=0x03ebedc8 nid=0x5d38 runnable
[0x0571f000..0x0571fb1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at
com.RJSoftwares.ServerSide.Server.NotifyBuddies(Server.java:229)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:195)

"Thread-162" prio=5 tid=0x0388f960 nid=0x619c runnable
[0x0464f000..0x0464fd1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:227)

"Thread-161" prio=5 tid=0x03741e18 nid=0x63b4 runnable
[0x0460f000..0x0460fd9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:227)

"Thread-160" prio=5 tid=0x0325ed08 nid=0x55a8 runnable
[0x045cf000..0x045cfa1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-159" prio=5 tid=0x03e11128 nid=0x5f50 runnable
[0x0458f000..0x0458fa9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-156" prio=5 tid=0x03927618 nid=0x6338 runnable
[0x057df000..0x057dfc1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-154" prio=5 tid=0x0330c780 nid=0x66e4 runnable
[0x059df000..0x059dfd1c]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
- locked <0x11f1dad0> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
- locked <0x11f1dad0> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at
com.RJSoftwares.ServerSide.ClientConnection.readline(ClientConnection.java:98)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:127)

"Thread-153" prio=5 tid=0x03f625d8 nid=0x61a4 runnable
[0x0595f000..0x0595fd9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.shout(Server.java:207)
at
com.RJSoftwares.ServerSide.ClientConnection.doSHOUT(ClientConnection.java:696)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:222)

"Thread-151" prio=5 tid=0x00e10310 nid=0x678c runnable
[0x0450f000..0x0450fa9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-150" prio=5 tid=0x038d9da8 nid=0x6744 runnable
[0x03b4f000..0x03b4fb1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-149" prio=5 tid=0x03927c18 nid=0x60d4 runnable
[0x03c0f000..0x03c0fb9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-148" prio=5 tid=0x0390ba50 nid=0x5490 runnable
[0x0599f000..0x0599fc1c]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
- locked <0x11efc9f0> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
- locked <0x11efc9f0> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at
com.RJSoftwares.ServerSide.ClientConnection.readline(ClientConnection.java:98)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:127)

"Thread-145" prio=5 tid=0x032a9780 nid=0x5c0c runnable
[0x0589f000..0x0589fd9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at
com.RJSoftwares.ServerSide.Server.NotifyLogOffBuddies(Server.java:249)
at
com.RJSoftwares.ServerSide.Server.doUserLogoff(Server.java:409)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:617)

"Thread-141" prio=5 tid=0x037b6dd8 nid=0x670c runnable
[0x0569f000..0x0569fb9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.shout(Server.java:207)
at
com.RJSoftwares.ServerSide.ClientConnection.doSHOUT(ClientConnection.java:696)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:222)

"Thread-140" prio=5 tid=0x03ebe480 nid=0x67d4 runnable
[0x03acf000..0x03acfc1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-139" prio=5 tid=0x03f62958 nid=0x6268 runnable
[0x0585f000..0x0585fc9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:395)

"Thread-134" prio=5 tid=0x03927798 nid=0x63c0 runnable
[0x044cf000..0x044cfb1c]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
- locked <0x11ec7fc0> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
- locked <0x11ec7fc0> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at
com.RJSoftwares.ServerSide.ClientConnection.readline(ClientConnection.java:98)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:127)

"Thread-133" prio=5 tid=0x03a391d0 nid=0x60e0 runnable
[0x03c8f000..0x03c8fb9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-130" prio=5 tid=0x03f627d8 nid=0x6160 runnable
[0x03b8f000..0x03b8fd1c]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
- locked <0x11ebae18> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
- locked <0x11ebae18> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at
com.RJSoftwares.ServerSide.ClientConnection.readline(ClientConnection.java:98)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:127)

"Thread-121" prio=5 tid=0x03660da0 nid=0x6700 runnable
[0x0454f000..0x0454fd9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-104" prio=5 tid=0x037fbe28 nid=0x6430 runnable
[0x0591f000..0x0591fa1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.sendToAll(Server.java:311)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:412)

"Thread-103" prio=5 tid=0x0325e998 nid=0x6504 runnable
[0x03bcf000..0x03bcfa9c]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
- locked <0x11e06510> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
- locked <0x11e06510> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at
com.RJSoftwares.ServerSide.ClientConnection.readline(ClientConnection.java:98)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:127)

"Thread-99" prio=5 tid=0x0399ac00 nid=0x6014 runnable
[0x056df000..0x056dfc9c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.shout(Server.java:207)
at
com.RJSoftwares.ServerSide.ClientConnection.doSHOUT(ClientConnection.java:696)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:222)

"Thread-98" prio=5 tid=0x037af790 nid=0x6184 runnable
[0x0581f000..0x0581fd1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at
com.RJSoftwares.ServerSide.Server.NotifyLogOffBuddies(Server.java:249)
at
com.RJSoftwares.ServerSide.Server.doUserLogoff(Server.java:409)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:617)

"Thread-90" prio=5 tid=0x0334be38 nid=0x67cc runnable
[0x03c4f000..0x03c4fd1c]
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
com.RJSoftwares.ServerSide.ClientConnection.write(ClientConnection.java:87)
at com.RJSoftwares.ServerSide.Server.shout(Server.java:207)
at
com.RJSoftwares.ServerSide.ClientConnection.doSHOUT(ClientConnection.java:696)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:222)

"Thread-3" prio=5 tid=0x03663490 nid=0x4e3c runnable
[0x03b0f000..0x03b0fc9c]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at
sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
- locked <0x11d7ef38> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
- locked <0x11d7ef38> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at
com.RJSoftwares.ServerSide.ClientConnection.readline(ClientConnection.java:98)
at
com.RJSoftwares.ServerSide.ClientConnection.run(ClientConnection.java:127)

"Thread-1" prio=5 tid=0x0326e860 nid=0x51e4 runnable
[0x03a8f000..0x03a8fd9c]
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
- locked <0x11d77910> (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at com.RJSoftwares.ServerSide.Server.run(Server.java:266)
at java.lang.Thread.run(Thread.java:595)

"Low Memory Detector" daemon prio=5 tid=0x03207af0 nid=0x54a4 runnable
[0x00000000..0x00000000]

"CompilerThread1" daemon prio=10 tid=0x032066f0 nid=0x5828 waiting on
condition [0x00000000..0x0353f380]

"CompilerThread0" daemon prio=10 tid=0x03205788 nid=0x6634 waiting on
condition [0x00000000..0x034ff3f8]

"AdapterThread" daemon prio=10 tid=0x00e2ad08 nid=0x600c waiting on
condition [0x00000000..0x00000000]

"Signal Dispatcher" daemon prio=10 tid=0x0320c7f8 nid=0x5b60 waiting on
condition [0x00000000..0x00000000]

"YJPAgent-CPUSampler" daemon prio=5 tid=0x00deaaa8 nid=0x6670 runnable
[0x00000000..0x00000000]

"YJPAgent-RequestListener" daemon prio=2 tid=0x032097e0 nid=0x6364
runnable [0x033ff000..0x033ffd9c]
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
- locked <0x11d19640> (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at com.yourkit.runtime.Core$1.run(Core.java:262)
at java.lang.Thread.run(Thread.java:595)

"YJPAgent-Telemetry" daemon prio=2 tid=0x03209210 nid=0x5e20 waiting on
condition [0x033bf000..0x033bfa1c]
at java.lang.Thread.sleep(Native Method)
at
com.yourkit.runtime.telemetry.TelemetryThread.run(TelemetryThread.java:215)

"Finalizer" daemon prio=9 tid=0x00e2a000 nid=0x55e8 in Object.wait()
[0x0317f000..0x0317fa9c]
at java.lang.Object.wait(Native Method)
- waiting on <0x11d19860> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
- locked <0x11d19860> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
at
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x00da9fe8 nid=0x6170 in
Object.wait() [0x0313f000..0x0313fb1c]
at java.lang.Object.wait(Native Method)
- waiting on <0x11d198e0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:474)
at
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
- locked <0x11d198e0> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0x00037770 nid=0x62a4 in Object.wait()
[0x0007f000..0x0007fc00]
at java.lang.Object.wait(Native Method)
- waiting on <0x11d19a18> (a java.lang.Thread)
at java.lang.Thread.join(Thread.java:1095)
- locked <0x11d19a18> (a java.lang.Thread)
at java.lang.Thread.join(Thread.java:1148)
at com.RJSoftwares.ServerSide.Server.main(Server.java:72)

"VM Thread" prio=10 tid=0x00e262e8 nid=0x55dc runnable

"VM Periodic Task Thread" prio=10 tid=0x0320d2b8 nid=0x58f8 waiting on
condition
 
S

Stephen Kellett

In message said:
Here's a deadlock that our chat server gets into every now and then.
There's no fixed time. Sometimes it runs with 50-60 users for 6 hours
and sometimes it crashes in 2 hours.

Given below is the thread dump. Can anyone figure out what could be
causing this?

Sorry I don't have the time to work that out. Much better (and a lot
easier) to use a software tool to do it for you.

If you are running your application on Windows NT/2K/XP then you can try
Java Thread Validator on your application. JTV is an automatic deadlock
and threading error detector for Java. Its currently in beta at Software
Verification's website.

http://www.softwareverify.com

Stephen
 
C

Cy

Of course I can't debug a damn thing without the code, however it looks
like you are performing a BLOCKING read/write of the socket while you
have a shared buffer locked.

On this type of applicaiton I wouldn't use such high-level IO (buffered
reader/writer) Go low level and manage the buffering yourself.

Sometimes you just need to write stuff in "C".

And of course I could be full of sh*t. ;-)
 
T

Thomas Hawtin

rajatag said:
Here's a deadlock that our chat server gets into every now and then.
There's no fixed time. Sometimes it runs with 50-60 users for 6 hours
and sometimes it crashes in 2 hours.

Given below is the thread dump. Can anyone figure out what could be
causing this?

It isn't deadlocked. If it was deadlocked (on simple Java monitors) the
thread dump would mention it.

You might have a threading problem elsewhere. Adding -Xcomp to the
command line may make it show up earlier (it switches off the interpreter).

Tom Hawtin
 
R

rajatag

Thank you for your reply.

Do you suggest using the NIO features of Java against what we are
already using?

Under what instance would a shared buffer lock occur?

Thanks,
 
R

Roedy Green

Here's a deadlock that our chat server gets into every now and then.
There's no fixed time. Sometimes it runs with 50-60 users for 6 hours
and sometimes it crashes in 2 hours.

The following is quoted from
http://mindprod.com/jgloss/thread.html#DEBUGGING



If your threads don't interact, there are two main errors you are
likely to make:

1. Tying up the main event processing thread either by putting it to
sleep or giving it some onerous task. You should do those things on
some other thread or user a Timer.

2. Poking a Swing widget's methods with something other than the main
event processing thread. Swing is not thread-safe. You must use
SwingUtilities. invokeLater for all your manipulations from some other
thread. There are a few exceptions.

So how do you catch yourself when you have accidentally made one of
these two errors?

If you have an Applet, convert it into a hybrid that can also be run
as an application. For details how see Applet. When a GUI is running,
most of the time it should be idle, just waiting for the next event.
If you hit crtl-Break (Ctrl-\ in Linux?) in the console window, it
will interrupt and tell you what all the threads were doing. If the
event thread is busy running application code something is amiss. Also
monitor some known well-behaved GUI apps so you get an idea the sort
of behaviour you should find. You will be surprised just how many
threads are in there.

To catch yourself pestering Swing from the wrong thread try the
ThreadCheckingRepaintManager. It checks that all repaint events came
from the event thread. This won't catch all your blunders, but it will
catch most of them.

If your threads do interact, writing bug free code is extremely
difficult. Your code will work most of time and then unexpectedly
freeze during the big demo. You have to write the code using pure
logic and paranoia, not just trying things and testing. As much as
possible, use packages to handle your thread interaction problems. The
authors of these packages specialise in the arcane art. Further there
are thousands of eyes checking the package for flaws. Java 1.5+ has a
rich set of thread handling classes. Wherever possible, use them in
preference to your own code. Keep in mind that things that could only
happen once in a billion times will happen twice a second in a
computer.

Let me repeat that for emphasis, the practical solution to bugs is to
throw out as much of your home-brew Thread logic as possible and
replace it with standard library code from the java.util.concurrent
package.

This code will be much higher quality than anything you will be able
to write because:

1. It is being exercised in thousands of other applications. There are
thus thousands of eyes peeled for bugs besides yours.

2. It was written by the world's acknowledged best thread expert, Doug
Lea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top