Alfresco
  1. Alfresco
  2. ALF-12771

Groups names with line feeds ('\n') cause JSON errors for SOLR and other remote calls

    Details

    • Resource:
      External

      Description

      Using LDAP group sync, create group names with line feeds '\n' in the name.

      Index tracking fails because JSON encoding does not handle the line feed.

      SEVERE: Tracking failed
      org.json.JSONException: Unterminated string at character 1306290
      at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
      ...
      at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)

      Attempting to delete the group fails as well because the group name is not escaped:
      Exception from executeScript - redirecting to status template error: 01170003 Script url /api/groups/fihel-SQL-Reporting admins <NOTE: \n here>
      CNF:e4759fd0-2ad0-44ab-bca1-1c8e888ea2d3 does not map to a Web Script.

      Expected:
      Either disallow the line feeds, fix the JSON encoding or both

      1. ALF-12771.patch
        11 kB
        Viachaslau Tikhanovich
      2. error.json
        1.80 MB
        Vladimir Kulev
      3. stderr.log
        141 kB
        Vladimir Kulev
      1. browse-groups.jpg
        27 kB

        Issue Links

          Activity

          Derek Hulley made changes -
          Field Original Value New Value
          Status New [ 10001 ] Open [ 1 ]
          Fix Version/s 4.0.1 [ 11020 ]
          Derek Hulley made changes -
          Status Open [ 1 ] Need Info [ 10002 ]
          Assignee Repo Team Unassigned [ repoteam ] Vladimir Kulev [ lightoze ]
          Derek Hulley made changes -
          Link This issue relates to ALF-12657 [ ALF-12657 ]
          Vladimir Kulev made changes -
          Status Need Info [ 10002 ] Open [ 1 ]
          Derek Hulley made changes -
          Assignee Vladimir Kulev [ lightoze ] Andrew Hind [ ahind ]
          Environment Tomcat
          Andrew Hind made changes -
          Status Open [ 1 ] Need Info [ 10002 ]
          Assignee Andrew Hind [ ahind ] Vladimir Kulev [ lightoze ]
          Vladimir Kulev made changes -
          Status Need Info [ 10002 ] Open [ 1 ]
          Vladimir Kulev made changes -
          Attachment stderr.log [ 29012 ]
          Vladimir Kulev made changes -
          Attachment error.json [ 29169 ]
          Derek Hulley made changes -
          Summary Solr tracker JSON parser error - index stops working Groups names with line feeds ('\n') cause JSON errors for SOLR and other remote calls
          Assignee Vladimir Kulev [ lightoze ]
          Fix Version/s Odin [ 10785 ]
          Fix Version/s 4.0.1 [ 11020 ]
          Description I have this error on the first start of Alfresco, the only configuration is AD integration, which creates 6527 groups and 3845 users right after bootstrap. Because of indexing failure it's even not possible to use Node Browser - root node cannot be found by "/" path.

          9.2.2012 15:23:58 org.apache.solr.core.SolrCore initIndex
          WARNING: [alfresco] Solr index directory 'D:\Alfresco\alf_data\solr\workspace\SpacesStore\index' doesn't exist. Creating new index...
          9.2.2012 15:23:59 org.apache.solr.handler.component.SpellCheckComponent inform
          WARNING: No queryConverter defined, using default converter
          9.2.2012 15:24:00 org.apache.solr.core.SolrCore initIndex
          WARNING: [archive] Solr index directory 'D:\Alfresco\alf_data\solr\archive\SpacesStore\index' doesn't exist. Creating new index...
          9.2.2012 15:24:00 org.apache.solr.handler.component.SpellCheckComponent inform
          WARNING: No queryConverter defined, using default converter
          9.2.2012 15:40:18 org.alfresco.solr.tracker.CoreTracker trackRepository
          SEVERE: Tracking failed
          org.json.JSONException: Unterminated string at character 1306290
          at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
          at org.json.JSONTokener.nextString(JSONTokener.java:244)
          at org.json.JSONTokener.nextValue(JSONTokener.java:344)
          at org.json.JSONArray.<init>(JSONArray.java:125)
          at org.json.JSONTokener.nextValue(JSONTokener.java:351)
          at org.json.JSONObject.<init>(JSONObject.java:206)
          at org.json.JSONTokener.nextValue(JSONTokener.java:347)
          at org.json.JSONArray.<init>(JSONArray.java:125)
          at org.json.JSONTokener.nextValue(JSONTokener.java:351)
          at org.json.JSONObject.<init>(JSONObject.java:206)
          at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)
          at org.alfresco.solr.tracker.CoreTracker.indexNode(CoreTracker.java:1879)
          at org.alfresco.solr.tracker.CoreTracker.trackRepository(CoreTracker.java:1410)
          at org.alfresco.solr.tracker.CoreTracker.updateIndex(CoreTracker.java:491)
          at org.alfresco.solr.tracker.CoreTrackerJob.execute(CoreTrackerJob.java:45)
          at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
          at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)

          Then the same error repeats every 15-20 seconds.
          I suppose more debug info may be needed, please tell me how to get it (e.g. print data received by Solr from Alfresco).
          Using LDAP group sync, create group names with line feeds '\n' in the name.

          Index tracking fails because JSON encoding does not handle the line feed.

          SEVERE: Tracking failed
          org.json.JSONException: Unterminated string at character 1306290
          at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
          at org.json.JSONTokener.nextString(JSONTokener.java:244)
          at org.json.JSONTokener.nextValue(JSONTokener.java:344)
          at org.json.JSONArray.<init>(JSONArray.java:125)
          at org.json.JSONTokener.nextValue(JSONTokener.java:351)
          at org.json.JSONObject.<init>(JSONObject.java:206)
          at org.json.JSONTokener.nextValue(JSONTokener.java:347)
          at org.json.JSONArray.<init>(JSONArray.java:125)
          at org.json.JSONTokener.nextValue(JSONTokener.java:351)
          at org.json.JSONObject.<init>(JSONObject.java:206)
          at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)
          at org.alfresco.solr.tracker.CoreTracker.indexNode(CoreTracker.java:1879)
          at org.alfresco.solr.tracker.CoreTracker.trackRepository(CoreTracker.java:1410)
          at org.alfresco.solr.tracker.CoreTracker.updateIndex(CoreTracker.java:491)
          at org.alfresco.solr.tracker.CoreTrackerJob.execute(CoreTrackerJob.java:45)
          at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
          at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)

          Expected:
          Either disallow the line feeds, fix the JSON encoding or both
          Component/s Authentication and Permissions [ 10582 ]
          Derek Hulley made changes -
          Description Using LDAP group sync, create group names with line feeds '\n' in the name.

          Index tracking fails because JSON encoding does not handle the line feed.

          SEVERE: Tracking failed
          org.json.JSONException: Unterminated string at character 1306290
          at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
          at org.json.JSONTokener.nextString(JSONTokener.java:244)
          at org.json.JSONTokener.nextValue(JSONTokener.java:344)
          at org.json.JSONArray.<init>(JSONArray.java:125)
          at org.json.JSONTokener.nextValue(JSONTokener.java:351)
          at org.json.JSONObject.<init>(JSONObject.java:206)
          at org.json.JSONTokener.nextValue(JSONTokener.java:347)
          at org.json.JSONArray.<init>(JSONArray.java:125)
          at org.json.JSONTokener.nextValue(JSONTokener.java:351)
          at org.json.JSONObject.<init>(JSONObject.java:206)
          at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)
          at org.alfresco.solr.tracker.CoreTracker.indexNode(CoreTracker.java:1879)
          at org.alfresco.solr.tracker.CoreTracker.trackRepository(CoreTracker.java:1410)
          at org.alfresco.solr.tracker.CoreTracker.updateIndex(CoreTracker.java:491)
          at org.alfresco.solr.tracker.CoreTrackerJob.execute(CoreTrackerJob.java:45)
          at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
          at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)

          Expected:
          Either disallow the line feeds, fix the JSON encoding or both
          Using LDAP group sync, create group names with line feeds '\n' in the name.

          Index tracking fails because JSON encoding does not handle the line feed.

          SEVERE: Tracking failed
          org.json.JSONException: Unterminated string at character 1306290
          at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
          ...
          at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)

          Expected:
          Either disallow the line feeds, fix the JSON encoding or both
          Derek Hulley made changes -
          Comment [ Please fill in the environment field.
          Take a look at ALF-12657. Does this fix it for you? ]
          Derek Hulley made changes -
          Comment [ Unfortunately this didn't help, I've tried to add maxPostSize="-1" maxSavePostSize="-1" to both HTTP and HTTPS connectors. Also, after restart it starts giving "Initial transaction not found with correct timestamp" error until I clean Solr index, then it starts over again.

          P.S. About environment field - I'm unable to edit the issue, I can only comment. ]
          Derek Hulley made changes -
          Comment [ Andy
          Could you give some direction so that Vladimir can attempt to diagnose this further? ]
          Derek Hulley made changes -
          Comment [ A comment with security level 'Alfresco' was removed. ]
          Derek Hulley made changes -
          Comment [ There have been bug fixes to do with residual properties and unknown namespaces.
          They were a while ago. ]
          Derek Hulley made changes -
          Description Using LDAP group sync, create group names with line feeds '\n' in the name.

          Index tracking fails because JSON encoding does not handle the line feed.

          SEVERE: Tracking failed
          org.json.JSONException: Unterminated string at character 1306290
          at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
          ...
          at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)

          Expected:
          Either disallow the line feeds, fix the JSON encoding or both
          Using LDAP group sync, create group names with line feeds '\n' in the name.

          Index tracking fails because JSON encoding does not handle the line feed.

          SEVERE: Tracking failed
             org.json.JSONException: Unterminated string at character 1306290
              at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
             ...
              at org.alfresco.solr.client.SOLRAPIClient.getNodesMetaData(SOLRAPIClient.java:725)

          Attempting to delete the group fails as well because the group name is not escaped:
             Exception from executeScript - redirecting to status template error: 01170003 Script url /api/groups/fihel-SQL-Reporting admins <NOTE: \n here>
             CNF:e4759fd0-2ad0-44ab-bca1-1c8e888ea2d3 does not map to a Web Script.

          Expected:
          Either disallow the line feeds, fix the JSON encoding or both
          Derek Hulley made changes -
          Assignee Repo Team Unassigned [ repoteam ]
          Derek Hulley made changes -
          Comment [ I've attached an error.json file with response on which JSON parser fails. The root of the problem is a carriage return character inside child association QName, which is equal to that node's name. This node is a user group "fihel-SQL-Reporting admins\n CNF:....." which came from AD synchronization. Also I can't delete this group manually because of the following error:

          2012-02-17 20:00:20,578 ERROR [extensions.webscripts.AbstractRuntime] [http-80-1] Exception from executeScript - redirecting to status template error: 01170003 Script url /api/groups/fihel-SQL-Reporting admins
          CNF:e4759fd0-2ad0-44ab-bca1-1c8e888ea2d3 does not map to a Web Script.
           org.springframework.extensions.webscripts.WebScriptException: 01170003 Script url /api/groups/fihel-SQL-Reporting admins
          CNF:e4759fd0-2ad0-44ab-bca1-1c8e888ea2d3 does not map to a Web Script.
          at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:173)
          at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
          at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
          at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
          at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
          at java.lang.Thread.run(Thread.java:662)

          I think it may be safer to forbid illegal characters on NodeService level, and ensure proper escaping in synchronization subsystem. Can you make it to the next bugfix release? ]
          Steven Glover made changes -
          Assignee Repo Team Unassigned [ repoteam ] Steven Glover [ sglover ]
          Steven Glover made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Steven Glover [ sglover ] QA Backlog Unassigned [ qabacklog ]
          Resolution Fixed [ 1 ]
          Vladimir Kulev made changes -
          Link This issue is clone of ALF-14473 [ ALF-14473 ]
          Will Taylor made changes -
          Assignee QA Backlog Unassigned [ qabacklog ] Alfresco QA Team [ alfrescoqa ]
          Alan Davis made changes -
          Workflow Alfjira_II_PM [ 139303 ] Alfjira_II_PM 3 [ 197413 ]
          Alfresco QA Team made changes -
          Attachment browse-groups.jpg [ 43622 ]
          Alfresco QA Team made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Alfresco QA Team [ alfrescoqa ] UI Team Unassigned [ uiteam ]
          Kevin Roast made changes -
          Status Reopened [ 4 ] Open [ 1 ]
          Kevin Roast made changes -
          Resource External [ 10060 ]
          Assignee UI Team Unassigned [ uiteam ] Investigation Queue [ investigation ]
          Status Open [ 1 ] Investigate [ 10004 ]
          Fix Version/s 4.2 Enterprise [ 12807 ]
          Fix Version/s Future [ 10785 ]
          Viachaslau Tikhanovich made changes -
          Status Investigate [ 10004 ] Investigating [ 10006 ]
          Assignee Investigation Queue [ investigation ] Viachaslau Tikhanovich [ vtikhanovich ]
          Viachaslau Tikhanovich made changes -
          Remaining Estimate 0 minutes [ 0 ]
          Time Spent 3 hours [ 10800 ]
          Worklog Id 30105 [ 30105 ]
          Viachaslau Tikhanovich made changes -
          Time Spent 3 hours [ 10800 ] 4 hours, 30 minutes [ 16200 ]
          Worklog Id 30129 [ 30129 ]
          Alan Davis made changes -
          Rank Ranked higher
          Viachaslau Tikhanovich made changes -
          Time Spent 4 hours, 30 minutes [ 16200 ] 5 hours, 30 minutes [ 19800 ]
          Worklog Id 30164 [ 30164 ]
          Viachaslau Tikhanovich made changes -
          Attachment ALF-12771.patch [ 43951 ]
          Viachaslau Tikhanovich made changes -
          Time Spent 5 hours, 30 minutes [ 19800 ] 1 day, 1 hour [ 32400 ]
          Worklog Id 30177 [ 30177 ]
          Viachaslau Tikhanovich made changes -
          Date_Investigated 13-Aug-13
          Status Investigating [ 10006 ] Investigated [ 10008 ]
          Kevin Roast made changes -
          Status Investigated [ 10008 ] Resolved [ 5 ]
          Assignee UI Team Unassigned [ uiteam ] QA Backlog Unassigned [ qabacklog ]
          Resolution Won't Fix [ 2 ]
          Kevin Roast made changes -
          Assignee QA Backlog Unassigned [ qabacklog ] Mike Farman [ mfarman ]
          Ravi Manthena made changes -
          Resolution Won't Fix [ 2 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Mike Farman [ mfarman ] UI Team Unassigned [ uiteam ]
          Ravi Manthena made changes -
          Assignee UI Team Unassigned [ uiteam ] Mike Farman [ mfarman ]
          Mike Farman made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Assignee Mike Farman [ mfarman ] Closed Issues [ closedissues ]
          Resolution Won't Fix [ 2 ]
          Alan Davis made changes -
          Workflow Alfjira_II_PM 3 [ 197413 ] Alfresco Triage 4 [ 246979 ]

            People

            • Assignee:
              Closed Issues
              Reporter:
              Vladimir Kulev
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour
                1d 1h