You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2004/02/07 06:36:00 UTC

DO NOT REPLY [Bug 26747] New: - Threads are being locked at org.apache.axis.client.Service

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26747>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26747

Threads are being locked at org.apache.axis.client.Service

           Summary: Threads are being locked at
                    org.apache.axis.client.Service
           Product: Axis
           Version: 1.1
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Basic Architecture
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: alp.gumus@verizon.com


Note: This bug is valid for both version 1.0 and 1.1


At org.apache.axis.client.Service.java:
Methods registerTransportForURL and getTransportForURL manages the 
Hashtable "transportImpls" where the keys are URL objects and values are the 
corresponding Transport objects.

Putting URL object as the key in the hashtable is causing the invocation of 
URL.hashCode while attempting to get a Transport from that hashtable.

URL.hashCode() call is a heavy call. If you look at Java java.net.URL 
documentation, it indicates:
---------------------
     * The host's IP address, used in equals and hashCode.
     * Computed on demand. An uninitialized or unknown hostAddress is null.
     */
    transient InetAddress hostAddress;
---------------------

This call (used by Axis to get from Transport hashtable) is causing all the 
threads wait at a synchronized method. See the stack trace below 
(getHostAddress is synchronized):

"Thread-34285" daemon prio=5 tid=0x1431bc0 nid=0xa6cc waiting for monitor 
entry [0x61481000..0x614819d8]
	at java.net.URLStreamHandler.getHostAddress(URLStreamHandler.java:314)
	at java.net.URLStreamHandler.hashCode(URLStreamHandler.java:244)
	at java.net.URL.hashCode(URL.java:708)
	at java.util.Hashtable.get(Hashtable.java:315)
	at org.apache.axis.client.Service.getTransportForURL(Service.java:769)
	at org.apache.axis.client.Call.setTargetEndpointAddress(Call.java:654)



So all the threads are waiting on this method until the first thread is done 
with:

"Thread-33179" daemon prio=5 tid=0x70fd68 nid=0xa0f6 runnable 
[0x48a80000..0x48a819d8]
	at java.net.InetAddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress.getAddressFromNameService(InetAddress.java:614)
	at java.net.InetAddress.getAllByName0(InetAddress.java:563)
	at java.net.InetAddress.getAllByName0(InetAddress.java:535)
	at java.net.InetAddress.getByName(InetAddress.java:444)
	at java.net.Socket.<init>(Socket.java:95)
	at org.apache.axis.components.net.DefaultSocketFactory.create
(DefaultSocketFactory.java:131)
	at org.apache.axis.transport.http.HTTPSender.getSocket
(HTTPSender.java:175)
	at org.apache.axis.transport.http.HTTPSender.invoke
(HTTPSender.java:118)
	at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrategy.java:71)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:182)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2113)
	at org.apache.axis.client.Call.invoke(Call.java:2102)
	at org.apache.axis.client.Call.invoke(Call.java:1851)
	at org.apache.axis.client.Call.invoke(Call.java:1777)
	at org.apache.axis.client.Call.invoke(Call.java:1315)


This is slowing down the system and sometimes all the threads are being 
blocked on this.
For other UnknownHostException related issues, in our system we don't have any 
hostname-IP caching (sun.net.inetaddr.ttl=0). This make the issue worse since 
each call to URL.hashCode will wait more. And a small down time in network 
makes things dramatic by blocking all the threads.


Conclusion: Storing the Transport values in the hashtable "transportImpls" 
within org.apache.axis.client.Service.java using "URL" Objects as KEY values 
is heavy. Instead, storing and retrieving by using URL.toString KEY values 
(not URL objects) would solve this issue. Sample:

    void registerTransportForURL(URL url, Transport transport) {
        transportImpls.put(url.toString(), transport);
    }

    Transport getTransportForURL(URL url) {
        return (Transport) transportImpls.get(url.toString());
    }


Sincerely,
Alp Gumus