Project

General

Profile

Bug #7227

OpenJDK issue: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_STATE_UNSAVEABLE

Added by Alexander Pyhalov over 3 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Category:
OI-Userland
Target version:
Start date:
2016-07-26
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

While running with openjdk 8, netbeans issues the following exception:

sun.security.pkcs11.wrapper.PKCS11Exception: CKR_STATE_UNSAVEABLE
    at sun.security.pkcs11.wrapper.PKCS11.C_GetOperationState(Native Method)
    at sun.security.pkcs11.P11Digest.clone(P11Digest.java:311)
Caused: java.lang.CloneNotSupportedException: SHA-256
    at sun.security.pkcs11.P11Digest.clone(P11Digest.java:316)
    at java.security.MessageDigest$Delegate.clone(MessageDigest.java:560)
    at sun.security.ssl.HandshakeHash.cloneDigest(HandshakeHash.java:191)
Caused: java.lang.RuntimeException: Could not clone digest
    at sun.security.ssl.HandshakeHash.cloneDigest(HandshakeHash.java:194)
    at sun.security.ssl.HandshakeHash.getFinishedHash(HandshakeHash.java:247)
Caused: java.lang.Error: Error during hash calculation
    at sun.security.ssl.HandshakeHash.getFinishedHash(HandshakeHash.java:249)
    at sun.security.ssl.HandshakeMessage$Finished.getFinished(HandshakeMessage.java:1945)
    at sun.security.ssl.HandshakeMessage$Finished.<init>(HandshakeMessage.java:1892)
    at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1214)
    at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1134)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:348)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
    at org.netbeans.modules.welcome.content.RSSFeed.findInputSource(RSSFeed.java:231)
    at org.netbeans.modules.welcome.content.RSSFeed.findInputSource(RSSFeed.java:248)
    at org.netbeans.modules.welcome.content.CombinationRSSFeed.buildItemList(CombinationRSSFeed.java:94)
[catch] at org.netbeans.modules.welcome.content.RSSFeed$Reload.run(RSSFeed.java:308)

It can be related to https://bugs.openjdk.java.net/browse/JDK-6414899, but seems to be different


Files

Captura de Tela 2016-08-26 às 14.44.49.png (237 KB) Captura de Tela 2016-08-26 às 14.44.49.png Franklin Ronald, 2016-08-26 05:45 PM
java_test.tar.gz (18.6 KB) java_test.tar.gz Franklin Ronald, 2016-08-26 05:58 PM

History

#1

Updated by Peter Tribble over 3 years ago

Some additional observations:

I see exactly the same error on Tribblix, using the Tribblix openjdk8 build. That's a different build - on Tribblix I use unpatched sources and build with Studio; OI compiles with gcc and the openjdk8 source is patched in order to do so. So that makes it unlikely that it's something to do with the patches used by OI, or the gcc build, that's at fault.

The error does not appear when using the Oracle JDK8 - either on Tribblix or OI. Which would argue against it being an eror in our PKCS11 implementation.

Furthermore, I see the same error running maven builds using openjdk8.

#2

Updated by Franklin Ronald over 3 years ago

I'm running NetBeans 8.1 with OpenJDK 8 on OpenIndiana Hipster "SunOS 5.11 illumos-7df3bea i86pc i386 i86pc Solaris" and none exception raised for me.

Can send more details to reproduce?

Alexander Pyhalov wrote:

While running with openjdk 8, netbeans issues the following exception:
[...]

It can be related to https://bugs.openjdk.java.net/browse/JDK-6414899, but seems to be different

#3

Updated by Franklin Ronald over 3 years ago

The problem has been reproduced. To reproduce is needed to "force" any communication with NetBeans.org. Like verify updates.

#4

Updated by Franklin Ronald over 3 years ago

Follow an project to problem isolated.

Unpack and run on netbeans to see output:

Beginning test run org.openindiana.bugs.issue7277.TestCloning...
Running test with provider SunPKCS11-Solaris...
Testing against provider SunPKCS11-Solaris
MD2 is not supported, skipping
Testing MD5 of SunPKCS11-Solaris
Testing SHA1 of SunPKCS11-Solaris
SHA-224 is not supported, skipping
Testing SHA-256 of SunPKCS11-Solaris
Exception in thread "main" java.lang.CloneNotSupportedException: SHA-256
at sun.security.pkcs11.P11Digest.clone(P11Digest.java:316)
at java.security.MessageDigest$Delegate.clone(MessageDigest.java:560)
at org.openindiana.bugs.issue7277.TestCloning.testCloning(TestCloning.java:94)
at org.openindiana.bugs.issue7277.TestCloning.main(TestCloning.java:67)
at org.openindiana.bugs.issue7277.PKCS11Test.premain(PKCS11Test.java:88)
at org.openindiana.bugs.issue7277.PKCS11Test.testDefault(PKCS11Test.java:149)
at org.openindiana.bugs.issue7277.PKCS11Test.main(PKCS11Test.java:97)
at org.openindiana.bugs.issue7277.TestCloning.main(TestCloning.java:45)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_STATE_UNSAVEABLE
at sun.security.pkcs11.wrapper.PKCS11.C_GetOperationState(Native Method)
at sun.security.pkcs11.P11Digest.clone(P11Digest.java:311)
... 7 more

#5

Updated by Franklin Ronald over 3 years ago

Fixed. I'm preparing the patch for JDK.

But, to solve your problem now, just add the JVM property on NetBeans configuration or any another software that have same issue:

sun.security.pkcs11.enable-solaris=false

In netbeans, edit file etc/netbeans.conf and add this property in netbeans_default_options key. Like:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dsun.security.pkcs11.enable-solaris=false"

I'll preparing the JDK Patch.

Alexander Pyhalov wrote:

While running with openjdk 8, netbeans issues the following exception:
[...]

It can be related to https://bugs.openjdk.java.net/browse/JDK-6414899, but seems to be different

#6

Updated by Franklin Ronald over 3 years ago

Hi,

I have already send the fix pull request.

Follow the diff in oi-userland:

https://github.com/Wiselabs/oi-userland/commit/34990b17965a8d4f9da1ebd7a1117cfcb039a900

Thanks.

Franklin Ronald wrote:

Fixed. I'm preparing the patch for JDK.

But, to solve your problem now, just add the JVM property on NetBeans configuration or any another software that have same issue:

sun.security.pkcs11.enable-solaris=false

In netbeans, edit file etc/netbeans.conf and add this property in netbeans_default_options key. Like:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dsun.security.pkcs11.enable-solaris=false"

I'll preparing the JDK Patch.

Alexander Pyhalov wrote:

While running with openjdk 8, netbeans issues the following exception:
[...]

It can be related to https://bugs.openjdk.java.net/browse/JDK-6414899, but seems to be different

#7

Updated by Alexander Pyhalov over 3 years ago

  • Category set to OI-Userland
  • Status changed from New to Resolved
  • Assignee set to Franklin Ronald
  • Target version set to Hipster

Also available in: Atom PDF