Uploaded image for project: 'Commons - Script'
  1. Commons - Script
  2. SCRIPT-37

ScriptsRegistryImpl caches scripts before they are fully initialized

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: None
    • Labels:
    • Target Version/s:
    • Sprint:
      OpenIDM Sprint 66

      Description

      Discovered that ScriptsRegistryImpl caches scripts before they are fully initialized (not yet compiled), which allows other threads to start using the script and will produce errors, such as the following,

      OpenIDM RECON with 10 concurrent threads
      Property mapping /mail transformation script encountered exception
      javax.script.ScriptException: Script status is 8
      	at org.forgerock.script.registry.ScriptRegistryImpl$LibraryRecord.invoke(ScriptRegistryImpl.java:507)
      	at com.sun.proxy.$Proxy12.eval(Unknown Source)
      	at org.forgerock.script.registry.ScriptRegistryImpl$ScriptImpl.eval(ScriptRegistryImpl.java:741)
      	at org.forgerock.openidm.util.Script.exec(Script.java:56)
      	at org.forgerock.openidm.sync.PropertyMapping.apply(PropertyMapping.java:150)
      	at org.forgerock.openidm.sync.impl.SyncOperation.applyMappings(SyncOperation.java:908)
      	at org.forgerock.openidm.sync.impl.SyncOperation.performAction(SyncOperation.java:446)
      	at org.forgerock.openidm.sync.impl.SourceSyncOperation.sync(SourceSyncOperation.java:89)
      	at org.forgerock.openidm.sync.impl.SourceRecon.recon(SourceRecon.java:76)
      	at org.forgerock.openidm.sync.impl.ReconTask.call(ReconTask.java:62)
      	at org.forgerock.openidm.sync.impl.ReconTask.call(ReconTask.java:32)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

      The fix is going to be not caching a script until it has been fully initialized. This may mean that multiple concurrent threads invoke the script independently, but there will be no real downside to this overall, because the script will be cached by at least one of the threads.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                travis.haagen Travis Haagen
                Reporter:
                travis.haagen Travis Haagen
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: