Hi there,
I got a VM abort while running my application that uses
HttpsConnection.
The error log is attached below:
12-15 21:26:37.149 E/dalvikvm(26605): HeapWorker is wedged:
11625ms spent inside
Lorg/apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl;.finalize()
V
12-15 21:26:37.249 I/dalvikvm(26605): "Thread-10" prio=5 tid=19 NATIVE
12-15 21:26:37.249 I/dalvikvm(26605): | group="main" sCount=1
dsCount=0 s=N obj=0x2e980bd0 self=0x20f9b0
12-15 21:26:37.249 I/dalvikvm(26605): | sysTid=26614 nice=10
sched=0/0 handle=2178088
12-15 21:26:37.249 I/dalvikvm(26605): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeconne
ct(Native Method)
12-15 21:26:37.249 I/dalvikvm(26605): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandsh
ake(OpenSSLSocketImpl.java:305)
12-15 21:26:37.249 I/dalvikvm(26605): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputSt
ream.<init>(OpenSSLSocketImpl.java:505)
12-15 21:26:37.259 I/dalvikvm(26605): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStre
am(OpenSSLSocketImpl.java:446)
I found the problem was caused by finalize() occupying more than 10
seconds, and therefore the HeapWorker abort the VM.
The "finalize()" of OpenSSLSessionImpl.java is as below:
protected void finalize() {
synchronized (OpenSSLSocketImpl.class) {
nativefree(session);
}
}
Dose the "synchronized" really necessary?
Because I found the "nativefree()" of
org_apache_harmony_xnet_provider_jsse_OpenSSLSessionImpl.cpp would
call "SSL_SESSION_free()" of ssl_sess.c, which would use CRYPTO_add()
to lock the reference count of SSL_SESSION object.
It should be quite safe if we try to free the native SSL_SESSION
object while someone is still using it, because the free operation
would fail in such situatuion.
Therefore, I think the "synchronized" could be removed.
Does anybody have suggestion on this?
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en