Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-29403

Deleting roles takes too long with large number of users.


    • Notability:


      With a large number of users (even if the roles that are created and deleted are not associated with any user) it takes a very long time when attempting to delete a role.

      Steps to reproduce the issue

      1 Used Maven Hosted repo "test"

      2 Role is created - 'test' - with permission - 'nx-repository-view-maven2-test-*'

      3. 2000 - users are created (with ids and names 1 to 2000) with role 'test' assigned to them all

      4. Then 5 roles are created slowRoleDeleteTest.sh with ids and names 1 to 5 - with permission - 'nx-repository-view-maven2-test-*'

      5. Try deleting those 5 roles with ids and names 1 to 5

      Notice that the the 5 roles that are created and deleted are not associated with any user.

      Log shows it takes very long time to delete these roles.

      Attached test script can be used to reproduce the issue: "slowRoleDeleteTest.sh"

      request.log output showing long time for processing.

      # rg 'DELETE /service/rest/v1/security/roles/' request.log - admin [27/Oct/2021:17:26:41 +1100] "DELETE /service/rest/v1/security/roles/1 HTTP/1.1" 204 - 0 18386 "curl/7.68.0" [qtp967267993-98] - admin [27/Oct/2021:17:26:59 +1100] "DELETE /service/rest/v1/security/roles/2 HTTP/1.1" 204 - 0 18158 "curl/7.68.0" [qtp967267993-453] - admin [27/Oct/2021:17:27:19 +1100] "DELETE /service/rest/v1/security/roles/3 HTTP/1.1" 204 - 0 19432 "curl/7.68.0" [qtp967267993-92] - admin [27/Oct/2021:17:27:37 +1100] "DELETE /service/rest/v1/security/roles/4 HTTP/1.1" 204 - 0 17894 "curl/7.68.0" [qtp967267993-450] - admin [27/Oct/2021:17:27:55 +1100] "DELETE /service/rest/v1/security/roles/5 HTTP/1.1" 204 - 0 18115 "curl/7.68.0" [qtp967267993-98]

      nexus.log entry for a different test attempt:

      16:27:44,688+1000 DEBUG [qtp59513597-564]  admin org.sonatype.nexus.security.internal.SecurityConfigurationCleanerImpl - Cleaning role id role5 from users and roles.
      16:28:18,066+1000 DEBUG [qtp59513597-564 <query>SELECT FROM user_role_mapping WHERE userId.toLowerCase() = ? AND source = ?</query>]  admin com.orientechnologies.common.collection.closabledictionary.OClosableLinkedContainer - $ANSI{green {db=security}} Reached maximum of opened files 513 (max=512), closed 1 files. Consider to raise this limit by increasing the global setting 'storage.openFiles.limit' and the OS limit on opened files per processor
      16:29:08,254+1000 INFO  [qtp59513597-564]  admin org.sonatype.nexus.security.internal.AuthorizationManagerImpl - Removed role role5


      • Deletion of role should be done with better performance




            Unassigned Unassigned
            jsensharma Jay Kumar SenSharma
            Last Updated By:
            Hajime Osako Hajime Osako
            2 Vote for this issue
            6 Start watching this issue


              Date of First Response: