1. Derby
  2. DERBY-5514

SecureServerTest (and others) don't play nice with EMMA: AccessControlException


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s:
    • Fix Version/s:
    • Component/s: Test
    • Labels:


      When running SecureServerTest with jars instrumented with EMMA using the ant emma-all target, I see:

      [junit] (net)derbynet.SecureServerTest.testServerStartup used 8475 ms junit.framework.TestListener: endTest(testServerStartup)
      [junit] START-SPAWNED:SpawnedNetworkServer ERROR OUTPUT:
      [junit] error adding Entry:
      [junit] no protocol: /export/home/dag/java/sb/sb1/tools/java/emma.jar
      [junit] access denied ( read)
      [junit] at
      [junit] at
      [junit] at java.lang.SecurityManager.checkPermission(
      [junit] at java.lang.SecurityManager.checkRead(
      [junit] at
      [junit] at
      [junit] at
      [junit] at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(
      [junit] at
      [junit] at
      [junit] Exception in thread "EMMA shutdown handler thread" java.lang.RuntimeException: EMMA failed to dump coverage data: access denied ( read)
      [junit] at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(
      [junit] at
      [junit] at
      [junit] END-SPAWNED :SpawnedNetworkServer ERROR OUTPUT:

      This is presumably because the test spawns a server which runs with the default server policy.

      Another thing is that is seems dangerous to let the spawned process write to EMMA's "", since we don't know when the parent process will write to it. This behavior could be what's been causing our corrutions in the EMMA runs earlier. The missing permissions just highlight what's happening.

      In this case the spawned process was started with this command line (I instrumented the code):

      XXX server startup command = /usr/jdk/instances/jdk1.6.0/jre/bin/java -classpath /<my sandbox>/tools/java/emma.jar:/<my sandbox>/jars/sane/derbyTesting.jar:/<my sandbox>/jars/emma/lib/derbyclient.jar:/<my sandbox>/jars/emma/lib/derbynet.jar:/<my sandbox>/jars/emma/lib/derby.jar:/<my sandbox>/jars/emma/lib/derbytools.jar:/<my sandbox>/jars/emma/lib/derbyrun.jar:/<my sandbox>/tools/java/junit.jar:/usr/share/lib/ant/ant-launcher.jar:/usr/share/lib/ant/ant.jar:/usr/share/lib/ant/ant-junit.jar org.apache.derby.drda.NetworkServerControl start -h localhost -p 1527

      Possible approaches:
      run the spawned VMs with plain jars (downside: we won't get coverage for those)
      run the spawned with a special default policy file when we run with EMMA ++
      run the spawned VM with -noSecurityManager if with EMMA jars

      1. d5514-emma-permissions-to-all.diff
        30 kB
        Knut Anders Hatlen
      2. derby-5514-1.diff
        2 kB
        Dag H. Wanvik
      3. derby-5514-1.stat
        0.2 kB
        Dag H. Wanvik
      4. derby-5514-2.diff
        4 kB
        Dag H. Wanvik
      5. derby-5514-2.stat
        0.3 kB
        Dag H. Wanvik

        Issue Links


          No work has yet been logged on this issue.


            • Assignee:
              Dag H. Wanvik
              Dag H. Wanvik
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: