Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-111522

Organization segment contributor with condition as parent organization does not work if there are more numbers of child organization

    Details

    • Fix Priority:
      4
    • Databases:
      MySQL 5.7
    • Device Type:
      Desktop
    • Sprint:
      TANGO | SP_37 | May26 - Jun09
    • What problem did the customer find?:
      Parent Organization segment with many sub-organizations causes StackOverflowError.
    • What do you think is the root cause? (if known):
      Hide
      When using the Parent Organization segment, the generated search filter contains a clause for each sub-organizations. Instead of placing the clauses on the same level, they are nested deeply into each other. For many sub-organizations this means too deeply nested clauses in search filter. Translating this generic search filter into an Elasticsearch filter means calling the same methods again and again while going more and more deeply in the processing of nested clauses. For each method call a stack frame is created in the stack memory to store the data related to the method (parameters, local variables, etc.). The stack frame is removed once the execution of the method finished. Going more and more deeply in the processing of the clauses just makes the stack bigger and we run out of stack memory before reaching the most deeply nested clause.
      Show
      When using the Parent Organization segment, the generated search filter contains a clause for each sub-organizations. Instead of placing the clauses on the same level, they are nested deeply into each other. For many sub-organizations this means too deeply nested clauses in search filter. Translating this generic search filter into an Elasticsearch filter means calling the same methods again and again while going more and more deeply in the processing of nested clauses. For each method call a stack frame is created in the stack memory to store the data related to the method (parameters, local variables, etc.). The stack frame is removed once the execution of the method finished. Going more and more deeply in the processing of the clauses just makes the stack bigger and we run out of stack memory before reaching the most deeply nested clause.
    • Proposed solution (if any):
      Show
      Tango Team came up with a resolution plan: https://issues.liferay.com/browse/PTR-1673?focusedCommentId=2159063&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2159063

      Description

      My setup having thousands of organizations under parent organization.

      I tried creating a segment with default Organization criteria contributor and selected parent organization in the Condition section. Segment fails to retrieve the number of members matching condition and Elastic search server (Remote) stops abruptly with stack trace:

      Caused by: java.lang.StackOverflowError    at org.elasticsearch.common.io.stream.StreamInput.readVInt(StreamInput.java:214) ~[elasticsearch-6.8.0.jar:6.8.0]        at org.elasticsearch.common.io.stream.StreamInput.readArraySize(StreamInput.java:1047) ~[elasticsearch-6.8.0.jar:6.8.0]        at org.elasticsearch.common.io.stream.StreamInput.readString(StreamInput.java:374) ~[elasticsearch-6.8.0.jar:6.8.0]        at org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput.readNamedWriteable(NamedWriteableAwareStreamInput.java:38)
      

       

      And portal complains about NoNodeAvailable.
      I observed if the number of child organizations is less (600-700), things were working fine. 

      It seems the issue is related to Elastic search huge query:

      https://github.com/elastic/elasticsearch/issues/46477

       

      Steps to reproduce:

      1. Create 1 parent organization and 1500-2000 child organizations for parent org.
      2. Go to Product menu> Site> People > Segments and create a segment using "Organization" criteria and add a condition with parent org (created in 1st point).
      3. Analyze logs and status of Elastic Search Server.

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ankit.srivastava Ankit Srivastava
              Reporter:
              ankitsrivastava37@gmail.com Ankit Srivastava
              Participants of an Issue:
              Recent user:
              Jason Pince
              Engineering Assignee:
              Istvan Sajtos
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 5 weeks, 2 days ago

                  Packages

                  Version Package
                  7.3.3 CE GA4
                  7.3.10 DXP GA1
                  Master