FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.2.9200] (Azure)
EXTRA RELEVANT SYSTEM CONFIGURATION :
No network interfaces are available, i.e. "ipconfig" gives "Access denied"
A DESCRIPTION OF THE PROBLEM :
When running a Java website on Azure you don't have access to the network interfaces. Since http://hg.openjdk.java.net/jdk8u/jdk8u20/jdk/rev/c6836440c427 the way SecureRandom works is to add the network addresses to the seed hash which causes the application to not work when deployed on Azure. Because no a lot of applications use the SecureRandom class they cannot be used as an Azure web site with the current JDK version.
Stack trace:
Exception in thread "main"
java.lang.Error: IP Helper Library GetIfTable function failed
at java.net.NetworkInterface.getAll(Native Method)
at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:343)
at sun.security.provider.SeedGenerator.addNetworkAdapterInfo(SeedGenerator.java:233)
at sun.security.provider.SeedGenerator.access$000(SeedGenerator.java:80)
at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:183)
at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:168)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.provider.SeedGenerator.getSystemEntropy(SeedGenerator.java:168)
at sun.security.provider.SecureRandom$SeederHolder.<clinit>(SecureRandom.java:201)
at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:221)
at java.security.SecureRandom.nextBytes(SecureRandom.java:457)
at java.security.SecureRandom.next(SecureRandom.java:480)
at java.util.Random.nextInt(Random.java:329)
at com.example.Main.main(Main.java:9)
REGRESSION. Last worked in version 7u51
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The following application throws an exception on 8u25 but not 7u51:
package com.example;
import java.security.SecureRandom;
public class Main {
public static void main(String[] args) {
SecureRandom random = new SecureRandom();
System.out.println("Random: " + random.nextInt());
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should see a result "Random: 12345"
ACTUAL -
Exception in thread "main"
java.lang.Error: IP Helper Library GetIfTable function failed
at java.net.NetworkInterface.getAll(Native Method)
at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:343)
at sun.security.provider.SeedGenerator.addNetworkAdapterInfo(SeedGenerator.java:233)
at sun.security.provider.SeedGenerator.access$000(SeedGenerator.java:80)
at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:183)
at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:168)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.provider.SeedGenerator.getSystemEntropy(SeedGenerator.java:168)
at sun.security.provider.SecureRandom$SeederHolder.<clinit>(SecureRandom.java:201)
at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:221)
at java.security.SecureRandom.nextBytes(SecureRandom.java:457)
at java.security.SecureRandom.next(SecureRandom.java:480)
at java.util.Random.nextInt(Random.java:329)
at com.example.Main.main(Main.java:9)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package com.example;
import java.security.SecureRandom;
public class Main {
public static void main(String[] args) {
SecureRandom random = new SecureRandom();
System.out.println("Random: " + random.nextInt());
}
}
---------- END SOURCE ----------