[ 
https://issues.apache.org/jira/browse/PIO-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15959378#comment-15959378
 ] 

Juha Syrjälä commented on PIO-59:
---------------------------------

According this blog post 
https://tersesystems.com/2015/12/17/the-right-way-to-use-securerandom/ it 
should be a single line fix in 
data/src/main/scala/org/apache/predictionio/data/storage/AccessKeys.scala

Change this:
  /** Default implementation of key generation */
  def generateKey: String = {
    val sr = SecureRandom.getInstanceStrong

to this:

  /** Default implementation of key generation */
  def generateKey: String = {
    val sr = new SecureRandom

I can try to a merge request for this, if this kind of change would be accepted.



> "pio app new" sometimes takes long time
> ---------------------------------------
>
>                 Key: PIO-59
>                 URL: https://issues.apache.org/jira/browse/PIO-59
>             Project: PredictionIO
>          Issue Type: Improvement
>            Reporter: Shinsuke Sugaya
>            Priority: Minor
>
> Some users reported this problem in user ML, and I also encountered it.
> Checking stack traces, I think the cause is an entropy shortage for 
> /dev/random.
> {code}
> "main" #1 prio=5 os_prio=0 tid=0x00007fc94803f800 nid=0x49a9 runnable 
> [0x00007fc94fa1b000]
>    java.lang.Thread.State: RUNNABLE
>         at java.io.FileInputStream.readBytes(Native Method)
>         at java.io.FileInputStream.read(FileInputStream.java:255)
>         at 
> sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
>         at 
> sun.security.provider.NativePRNG$RandomIO.ensureBufferValid(NativePRNG.java:525)
>         at 
> sun.security.provider.NativePRNG$RandomIO.implNextBytes(NativePRNG.java:544)
>         - locked <0x00000003d34e8a48> (a java.lang.Object)
>         at 
> sun.security.provider.NativePRNG$RandomIO.access$400(NativePRNG.java:331)
>         at 
> sun.security.provider.NativePRNG$Blocking.engineNextBytes(NativePRNG.java:268)
>         at java.security.SecureRandom.nextBytes(SecureRandom.java:468)
>         at 
> org.apache.predictionio.data.storage.AccessKeys$class.generateKey(AccessKeys.scala:71)
>         at 
> org.apache.predictionio.data.storage.elasticsearch.ESAccessKeys.generateKey(ESAccessKeys.scala:40)
>         at 
> org.apache.predictionio.data.storage.elasticsearch.ESAccessKeys.insert(ESAccessKeys.scala:60)
>         at 
> org.apache.predictionio.tools.commands.App$$anonfun$create$4$$anonfun$apply$5.apply(App.scala:71)
>         at 
> org.apache.predictionio.tools.commands.App$$anonfun$create$4$$anonfun$apply$5.apply(App.scala:62)
>         at scala.Option.map(Option.scala:145)
>         at 
> org.apache.predictionio.tools.commands.App$$anonfun$create$4.apply(App.scala:62)
>         at 
> org.apache.predictionio.tools.commands.App$$anonfun$create$4.apply(App.scala:55)
>         at scala.Option.getOrElse(Option.scala:120)
>         at org.apache.predictionio.tools.commands.App$.create(App.scala:55)
>         at 
> org.apache.predictionio.tools.console.Pio$App$.create(Pio.scala:172)
>         at 
> org.apache.predictionio.tools.console.Console$$anonfun$main$1.apply(Console.scala:683)
>         at 
> org.apache.predictionio.tools.console.Console$$anonfun$main$1.apply(Console.scala:626)
>         at scala.Option.map(Option.scala:145)
>         at 
> org.apache.predictionio.tools.console.Console$.main(Console.scala:626)
>         at org.apache.predictionio.tools.console.Console.main(Console.scala)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to