Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-12836

Large allocations in EJBContextImpl#isCallerInRole

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 18.0.1.Final
    • EJB, Security
    • None

    Description

      In our application we have the need to know the roles of the current user. We would like to do this using Java / Jakarta EE APIs rather than rely on WildFly implementation classes. We do this by iterating over all roles, which we know statically, and calling EJBContext#isCallerInRole for each one. This seem to be a common technique, see How to get user roles in a JSP / Servlet.
      That's about 100 roles for us. We were expecting that would be a lookup into a HashMap or similar with O(1) complexity and almost no allocations.
      This however does not seem to be case as EJBContextImpl#isCallerInRole seems to do the role mapping for every call. This results in a large amount of allocations. In our case this completely dominates our allocation profile. See attached screenshot from JFR.

      Attachments

        Activity

          People

            tadamski@redhat.com Tomasz Adamski
            pmarscha Philippe Marschall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: