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

Jira custom field context broken after upgrade to 9.7.0+

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 9.10.0, 9.9.1
    • 9.7.0, 9.8.0, 9.9.0, 9.8.1
    • Custom fields
    • 9.07
    • 10
    • Severity 2 - Major
    • 48
    • Hide
      Atlassian Update – 03 July 2023

      Thank you for reporting this issue. In the last weeks we have been working hard on fixing it.

      Summary of the problem:

      Pre-existing custom fields' contexts created prior to Jira 9.7 would break and be virtually impossible to modify after attempting to edit any of them using the new UI.

      New behaviour after the change:

      Editing pre-existing custom fields' contexts created before Jira 9.7 will not break them, and allow to successfully modify them using the new UI.

      Status of the fix and Fix Version:

      The fix is ready, and we’re moving the status of this ticket to Waiting for release with Fix Version 9.9.1 and 9.10.

      Best regards,

      Artur Falborski,
      Jira DC Software Engineer

      Show
      Atlassian Update – 03 July 2023 Thank you for reporting this issue. In the last weeks we have been working hard on fixing it. Summary of the problem: Pre-existing custom fields' contexts created prior to Jira 9.7 would break and be virtually impossible to modify after attempting to edit any of them using the new UI. New behaviour after the change: Editing pre-existing custom fields' contexts created before Jira 9.7 will not break them, and allow to successfully modify them using the new UI. Status of the fix and Fix Version: The fix is ready, and we’re moving the status of this ticket to Waiting for release with Fix Version 9.9.1 and 9.10 . Best regards, Artur Falborski, Jira DC Software Engineer

      Issue Summary

      Upgrading to Jira 9.7.0+ causes the Custom Field context edit page to break.

      Steps to Reproduce

      1. Upgrade Jira to 9.7.0 or later
      2. On the Custom Field page, go into "Configure contexts" for a field

      Expected Results

      The contexts page is loaded fine and you can edit those settings.

      Actual Results

      The page throws an error 500. The "Edit options" button missing. The below exception is thrown in the atlassian-jira.log file:

      /secure/admin/ConfigureCustomField!default.jspa [webwork.util.ValueStack] METHOD: "viewHtml", exception: 
      com.atlassian.jira.exception.DataAccessException: No custom field for issuetype. This should not happen. Data is likely to be corrupt.
      	at com.atlassian.jira.issue.fields.config.FieldConfigImpl.getCustomField(FieldConfigImpl.java:61)
      	at com.atlassian.jira.issue.customfields.config.item.DefaultValueConfigItem.getViewHtml(DefaultValueConfigItem.java:23)
      	at com.atlassian.jira.issue.fields.config.FieldConfigItemImpl.getViewHtml(FieldConfigItemImpl.java:24)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      	at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70)
      	at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56)
      	at webwork.util.ValueStack.findValue(ValueStack.java:517)
      	at webwork.util.ValueStack.findValue(ValueStack.java:216)
      	at webwork.view.taglib.WebWorkBodyTagSupport.findValue(WebWorkBodyTagSupport.java:62)
      	at webwork.view.taglib.BasicPropertyTag.doStartTag(BasicPropertyTag.java:54)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspx_meth_ww_005fproperty_005f13(configurecustomfield_jsp.java:2138)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspx_meth_ww_005fiterator_005f2(configurecustomfield_jsp.java:2047)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspx_meth_ww_005fiterator_005f1(configurecustomfield_jsp.java:1998)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspx_meth_ww_005fif_005f6(configurecustomfield_jsp.java:1961)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspx_meth_page_005fapplyDecorator_005f1(configurecustomfield_jsp.java:1112)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspx_meth_ww_005fiterator_005f0(configurecustomfield_jsp.java:1019)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspx_meth_page_005fapplyDecorator_005f0(configurecustomfield_jsp.java:261)
      	at jsp.secure.admin.views.customfields.configurecustomfield_jsp._jspService(configurecustomfield_jsp.java:112)
      	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
      
      2023-06-21 16:22:50,814+0200 http-nio-127.0.0.1-8443-exec-33 ERROR      [c.a.j.web.servlet.InternalServerErrorServlet] {errorId=be4e91c0-e1b1-48f1-8824-76ed5a6733a8, interpretedMsg=, cause=java.lang.NullPointerException, stacktrace=java.lang.NullPointerException
          	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) [?:?]
          	at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(Unknown Source) [?:?]
          	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:?]
          	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:?]
          	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:?]
          	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:?]
          	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:?]
          	at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:?]
          	at com.atlassian.jira.issue.fields.config.persistence.CachedFieldConfigSchemePersister.removeFieldConfigsFromCache(CachedFieldConfigSchemePersister.java:202) [classes/:?]
          	at com.atlassian.jira.issue.fields.config.persistence.CachedFieldConfigSchemePersister.removeRelatedConfigsForUpdate(CachedFieldConfigSchemePersister.java:167) [classes/:?]
          	at com.atlassian.jira.issue.fields.config.persistence.FieldConfigSchemePersisterImpl.update(FieldConfigSchemePersisterImpl.java:156) [classes/:?]
          	at com.atlassian.jira.issue.fields.config.persistence.CachedFieldConfigSchemePersister.update(CachedFieldConfigSchemePersister.java:142) [classes/:?]
          	at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.updateFieldConfigScheme(FieldConfigSchemeManagerImpl.java:227) [classes/:?]
          	at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.updateFieldConfigScheme(FieldConfigSchemeManagerImpl.java:191) [classes/:?]
          	at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.updateFieldConfigScheme(FieldConfigSchemeManagerImpl.java:175) [classes/:?]
          	at com.atlassian.jira.web.action.admin.customfields.ManageConfigurationScheme.doExecute(ManageConfigurationScheme.java:235) [classes/:?]
          	...
          	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.73]
          	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-util.jar:9.0.73]
          	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-util.jar:9.0.73]
          	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.73]
          	at java.base/java.lang.Thread.run(Unknown Source) [?:?]
          , referer=https://jiraurl/secure/admin/ManageConfigurationScheme!default.jspa?atl_token=AH6Q-KL18-9RGH-QHN9_1d895ab97e60552adbfa02e6f8765e05cabb991c_lin&fieldConfigSchemeId=32984&fieldId=customfield_22517&returnUrl=ConfigureCustomField%21default.jspa%3FfieldId%3Dcustomfield_22517, servletErrorMessage=}
      

      The following queries can be run to scan affected fields:

      Query 1: Get the affected field IDs

      SELECT customfield FROM configurationcontext
      WHERE fieldconfigscheme IN
            (SELECT fieldconfigscheme FROM fieldconfigschemeissuetype WHERE fieldconfigscheme != fieldconfiguration);
      

      Query 2

      SELECT id FROM customfield WHERE customfieldtypekey = 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect'
        AND id IN (<IDs retrived from Query 1>);
      

      You can run this additional check, and if nothing is returned, then you are affected by this Bug.

      SELECT id, configname, fieldid FROM fieldconfiguration WHERE fieldid = 'customfield_xxxxx';
      
      SELECT id, configname FROM fieldconfigscheme WHERE fieldid = 'customfield_xxxxx';
      
      SELECT * FROM fieldconfigschemeissuetype WHERE fieldconfiguration IN (SELECT id FROM fieldconfiguration WHERE fieldid = 'customfield_xxxxx');
      
      SELECT * FROM fieldconfigschemeissuetype
      WHERE fieldconfigscheme IN (SELECT id FROM fieldconfigscheme WHERE fieldid = 'customfield_xxxxx');
      
      SELECT id, customfieldconfig, sequence, customvalue FROM customfieldoption WHERE customfield = xxxxx;
      
      SELECT * FROM configurationcontext WHERE customfield = 'customfield_xxxxx';
      

      Workaround

      • Take a database BACKUP before proceeding further.
      • Go to the https://your_jira_instance/jira/secure/admin/SiteDarkFeatures!default.jspa
      • Add the given feature flag to disable the feature: jira.customfields.dual.list.box.disabled
      • For each known customfield that you know is affected identify the current fieldconfigscheme id and fieldconfiguration id by running the queries:
        identify the current fieldconfigscheme id and fieldconfiguration id
        select id, configname from fieldconfigscheme  where fieldid = 'customfield_XXXXX';
        select id, configname, fieldid from fieldconfiguration where fieldid = 'customfield_XXXXX';
        
        Update the fieldconfigschemeissuetype accordingly
        insert into fieldconfigschemeissuetype (id, fieldconfigscheme, fieldconfiguration)
        values
        ((select max(id)+1 from fieldconfigschemeissuetype), retrieved_fieldconfigscheme_id, retrieved_fieldconfiguration_id);
        
        -- Since MySQL doesn't allow to insert into a table and select from the same table in a subquery you will need to get value "select max(id)+1 from fieldconfigschemeissuetype" first and then use it explicitly in INSERT query
        select max(id)+1 from fieldconfigschemeissuetype;
        insert into fieldconfigschemeissuetype (id, fieldconfigscheme, fieldconfiguration)
        values
        (retrieved_maxid+1, retrieved_fieldconfigscheme_id, retrieved_fieldconfiguration_id);
        
      • Restart all nodes in order to flush all the caches.

            d996197e70d9 Artur Falborski
            bpicarelli Benito Picarelli
            Votes:
            10 Vote for this issue
            Watchers:
            32 Start watching this issue

              Created:
              Updated:
              Resolved: