Name: sgC58550 Date: 03/14/97
I have run into this bug on several occasions, and it seems to be deep in the im
plementation of InetAddress.getHostName(). Here is the thread dump and associate
d code.
SunOS wham 5.5.1 Generic_103640-05 sun4u sparc SUNW,Ultra-2
java version "1.1_Final"
"Thread-7" (TID:0xeb004ea0, sys_thread_t:0xeaf01de0, state:MW) prio=5
java.net.InetAddress.getHostName(InetAddress.java)
java.net.InetAddress.toString(InetAddress.java)
eweb.chat.server.ConsoleAgentServer.run(ConsoleAgentServer.java:73)
java.lang.Thread.run(Thread.java)
"MsgServer" (TID:0xeb004e08, sys_thread_t:0xeaf31de0, state:MW) prio=5
java.net.InetAddress.getHostName(InetAddress.java)
java.net.InetAddress.toString(InetAddress.java)
eweb.msg.ServerMsgConnection.<init>(ServerMsgConnection.java:86)
eweb.msg.MsgServer.run(MsgServer.java:84)
unknown key (key=0xeaea1698): monitor owner eaf01de0: "Thread-7"
Waiting to enter:
"MsgServer"
unknown key (key=0xef5f42c0): monitor owner eaf31de0: "MsgServer"
Waiting to enter:
"Thread-7"
------------------------------------------------------------------
deadlock occurs when a connection is made to this port, and
InetAddress.getHostName is invoked. I haven't been able to pin down where
this lock occurs, as the monitor key is unknown, and I suspect that the
problem may be in libnet.so via the InetAddressImpl calls
Thread-7: eweb.chat.server.ConsoleAgentServer.run(ConsoleAgentServer.java:73)
Socket s = ss.accept();
InputStream in = s.getInputStream();
OutputStream out = s.getOutputStream();
InetAddress addr = s.getInetAddress(); |||||||||||||||
if (checkAddress( addr )) { VVVVVVVVVVVVVVV
--> ConsoleAgent ca = new ConsoleAgent( this, server, addr.toString(),
in, out );
------------------------------------------------------------------
creation of a different type of connection established on a different
port than above.
MsgServer: eweb.msg.ServerMsgConnection.<init>(ServerMsgConnection.java:86)
public ServerMsgConnection( Socket socket, ... ) {
this.socket = socket;
...
inetAddr = socket.getInetAddress();
--> iaString = inetAddr.toString();
company - EarthWeb , email - ###@###.###
======================================================================
Sue Palmer (3/18/97) More info from customer:
The problem has been seen only on Solaris.
The customer (EarthWeb) was able to work around the deadlock in this particular case because one of the calls to getHostName() was being made for debugging output.
elizabeth.mezias@Eng 1998-08-18
import java.net.*;
public class hostBugDemo {
public InetAddress host;
public hostBugDemo() {
try { host = InetAddress.getLocalHost();
System.out.println("Address:" + host); }
catch(Exception e)
{ System.err.println("Addressing error:" + e); }
hostThread t1 = new hostThread();
hostThread t2 = new hostThread();
hostThread t3 = new hostThread();
hostThread t4 = new hostThread();
t1.run();
t2.run();
t3.run();
t4.run();
}
class hostThread extends Thread {
public hostThread() { super(); }
public void run() {
String hn = host.getHostName();
System.out.println("Host: " + hn);
while(true) {
try {
Thread.sleep(2000);
}
catch(InterruptedException exp) {}
}
}
}
public static void main(String args[]) {
hostBugDemo test = new hostBugDemo();
}
}