Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-70333

Failure in issue creation can save issue in corrupted state despite message saying it couldn't be created

    XMLWordPrintable

Details

    Description

      Issue Summary

      Corrupted or wrong data in custom field can lead to situation where the user is informed that the issue hasn't been created, but the corrupted issue is in fact saved and rollback doesn't happen.

      Process of creation of Jira issue consists of 3 steps:

      1. Issue is created,
      2. Custom field is filled by data,
      3. Issue is indexed.

      If the second step fails the issue persist in the database with corrupted state and the third step will not happen.

      There are 3 problems when the situation mentioned above occurs:

      1. User is informed about issue not being created, although the issue exist
      2. User is able to repeatedly click the create button. This creates another corrupted issue, because the form with error message stays open
      3. Issue is not indexed, which causes it to not show up until next reindex, making it even harder to understand that the issue was created

      Steps to Reproduce

      1. Use steps to create issue from JRASERVER-70398 (click the "Create" button multiple times)
      2. Cancel the creation operation and go to the project to find out how many issues are in it
      3. Reindex project
      4. Find out that there are new duplicated issues in the project

      Other triggers of this issue:

      Expected Results

      Message returned by Jira correctly describes the result of issue creation operation.
      User is not allowed to create multiple issue with the same form without selecting the "Create another" checkbox.

      Actual Results

      1. Error message presented to the user reads as follows:
        We can't create this issue for you right now, it could be due to unsupported content you've entered into one or more of the issue fields. If this situation persists, contact your administrator as they'll be able to access more specific information in the log file.
        

        Issue with corrupted data is created and will not show up in the issue search nor it will be possible to transition it to other status. The form used to create the corrupted issue can be used to create another issue without any warning.

      1. In the log files you can find out stack trace:
        2019-11-28 18:00:57,957 http-nio-8080-exec-1 ERROR admin 1080x778x1 1t82g3q 0:0:0:0:0:0:0:1 /secure/QuickCreateIssue.jspa [c.a.j.bc.issue.DefaultIssueService] Error creating issue:
        com.atlassian.jira.exception.CreateException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10101][issue,10135][stringvalue,aa][id,10141][updated,1574960457955] (SQL Exception while executing the following:INSERT INTO public.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00))
        	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:592)
        	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:498)
        	at com.atlassian.jira.issue.managers.RequestCachingIssueManager.createIssue(RequestCachingIssueManager.java:192)
        	at com.atlassian.jira.bc.issue.DefaultIssueService.create(DefaultIssueService.java:238)
        	at com.atlassian.jira.bc.issue.DefaultIssueService.create(DefaultIssueService.java:207)
        	... 2 filtered
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
        	at com.sun.proxy.$Proxy220.create(Unknown Source)
        	... 2 filtered
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:136)
        	at com.sun.proxy.$Proxy220.create(Unknown Source)
        	at com.atlassian.jira.quickedit.action.QuickCreateIssue.doExecute(QuickCreateIssue.java:308)
        	... 1 filtered
        	at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
        	... 7 filtered
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        	... 48 filtered
        	at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:62)
        	... 12 filtered
        	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
        	... 58 filtered
        	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
        	... 1 filtered
        	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
        	... 39 filtered
        	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
        	... 10 filtered
        	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
        	... 4 filtered
        	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
        	... 26 filtered
        	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
        	... 24 filtered
        	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        	at java.lang.Thread.run(Thread.java:748)
        Caused by: com.atlassian.jira.workflow.WorkflowException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10101][issue,10135][stringvalue,aa][id,10141][updated,1574960457955] (SQL Exception while executing the following:INSERT INTO public.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00))
        	at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:768)
        	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:584)
        	... 259 more
        Caused by: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10101][issue,10135][stringvalue,aa][id,10141][updated,1574960457955] (SQL Exception while executing the following:INSERT INTO public.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00))
        	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
        	at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.createValuesInt(OfBizCustomFieldValuePersister.java:129)
        	at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.updateValues(OfBizCustomFieldValuePersister.java:154)
        	at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.updateValues(EagerLoadingOfBizCustomFieldPersister.java:54)
        	at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.createValues(OfBizCustomFieldValuePersister.java:109)
        	at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.createValues(EagerLoadingOfBizCustomFieldPersister.java:42)
        	at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.createValues(OfBizCustomFieldValuePersister.java:102)
        	at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.createValues(EagerLoadingOfBizCustomFieldPersister.java:36)
        	at com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType.createValue(AbstractSingleFieldType.java:143)
        	at com.atlassian.jira.issue.fields.ImmutableCustomField.createValue(ImmutableCustomField.java:693)
        	at com.atlassian.jira.workflow.function.issue.IssueCreateFunction.execute(IssueCreateFunction.java:81)
        	at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1014)
        	at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1407)
        	at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:606)
        	at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:742)
        	... 260 more
        Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10101][issue,10135][stringvalue,aa][id,10141][updated,1574960457955] (SQL Exception while executing the following:INSERT INTO public.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00))
        	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:206)
        	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:171)
        	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:89)
        	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:562)
        	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:548)
        	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296)
        	... 275 more
        Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO public.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00)
        	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:570)
        	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:198)
        	... 281 more
        Caused by: org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
        	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
        	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
        	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
        	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
        	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:168)
        	at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:135)
        	at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
        	at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
        	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:562)
        	... 282 more
        

      Workaround

      The root cause of the problem has no known workaround currently, however it is possible to prevent the problem from being triggered by properly validating the input.

      You can check workaround of JRASERVER-70398 if you are affected by null character being passed to PostgreSQL database.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ddudziak Stasiu
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated: