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

Creating an issue with invalid date format causes data inconsistency in MS SQL Server due to datetime2 conversion out-of-range error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 8.16.1, 8.21.0, 8.22.3
    • Environment - Database
    • None

    Description

      Issue Summary

      When an invalid date format is entered into a Date Picker field during issue creation, Jira configured to MS SQL Server returns datetime2 conversion out-of-range error in the logs and the GUI prompts user that issue failed to be created. However, issue data has already been created / stored in the database; the error happens when creating / storing Date Picker field data. As a result, issue is not re-indexed, causes the issue to be "hidden" until a project, background or full re-index is executed.

      This is reproducible on Data Center:

      Steps to Reproduce

      1. Navigate to '⚙ > System > General configuration > Advanced Settings'
      2. Update the jira.date.picker.java.format to d/MMM/yyyy
      3. Create a new issue and populate the date picker field, for example Due Date system field. This can be done either by:
        • Using the date picker pop-up box
        • Manually enter the date 30/May/22
      4. Observe the error in the UI

      Expected Results

      Jira prevents issue creation due to out-of-range date value.

      Actual Results

      Issue creation failed halfway. From a user's perspective, issue has not been created. However, on the data perspective, issue data has been added into jiraissue table but date picker field data fails due to datetime2 conversion out-of-range error. This causes data integrity issue.

      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.

      Your request could not be created. Please check the fields have been correctly filled in. 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.

      Database entries:

      SELECT id, pkey, issuenum, project, reporter, summary, description, issuestatus, created, updated from jiraissue where id = 10500;
        id   | pkey | issuenum | project |   reporter    | summary | description | issuestatus |        created          |        updated
      -------+------+----------+---------+---------------+---------+-------------+-------------+-------------------------+-------------------------
       10500 |      |        4 |   10100 | JIRAUSER10000 | test    |             | 10101       | 2022-05-30 02:05:59.580 | 2022-05-30 02:05:59.580 
      select * from customfieldvalue where issue = 10500;
       id | issue | customfield | updated | parentkey | stringvalue | numbervalue | textvalue | datevalue | valuetype
      ----+-------+-------------+---------+-----------+-------------+-------------+-----------+-----------+-----------
      (0 rows)
      

      The below exception is thrown in the atlassian-jira.log file:

      2022-05-30 02:05:59,622+0000 http-nio-8080-exec-8 ERROR admin 125x491x1 30w8fc 172.29.203.160 /servicedesk/customer/portal/1/create/1 [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,10310][issue,10500][datevalue,0022-05-11 00:00:00.0][id,10600][updated,1653876359610] (SQL Exception while executing the following:INSERT INTO dbo.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.))
      	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:586)
      	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:487)
      	at com.atlassian.jira.issue.managers.RequestCachingIssueManager.createIssue(RequestCachingIssueManager.java:195)
      	at com.atlassian.jira.bc.issue.DefaultIssueService.create(DefaultIssueService.java:256)
      	at com.atlassian.jira.bc.issue.DefaultIssueService.create(DefaultIssueService.java:224)
      	...
      Caused by: com.atlassian.jira.workflow.WorkflowException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10310][issue,10500][datevalue,0022-05-11 00:00:00.0][id,10600][updated,1653876359610] (SQL Exception while executing the following:INSERT INTO dbo.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.))
      	at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:780)
      	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:578)
      	... 433 more
      Caused by: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10310][issue,10500][datevalue,0022-05-11 00:00:00.0][id,10600][updated,1653876359610] (SQL Exception while executing the following:INSERT INTO dbo.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.))
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
      	...
      Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10310][issue,10500][datevalue,0022-05-11 00:00:00.0][id,10600][updated,1653876359610] (SQL Exception while executing the following:INSERT INTO dbo.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.))
      	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:210)
      	...
      Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO dbo.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.)
      	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:570)
      	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:202)
      	... 455 more
      Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
      	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:602)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:524)
      

      Workaround

      Currently there is no known workaround for this behavior.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cchan Chung Park Chan
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: