Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Problem Statement

When migrating a project from one Server server to another using the Configuration Manager for Jira app, the custom fields that were migrated earlier are being getting locked.

Error Message 

...

Log Entries 

Code Block
2023-03-03 17:45:39,716+0000 HealthCheck:thread-1 ERROR ServiceRunner     [c.a.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.applinks.analytics.ApplinksRequestExecutionEvent@fd213e0] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.webhooks.plugin.WebHookEventsProcessor.onEvent(java.lang.Object), listener=com.atlassian.webhooks.plugin.WebHookEventsProcessor@ea2a378}]
java.lang.RuntimeException: attempt to unlock read lock, not locked by current thread. Listener: com.atlassian.webhooks.plugin.WebHookEventsProcessor event: com.atlassian.applinks.analytics.ApplinksRequestExecutionEvent
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalMonitorStateException: attempt to unlock read lock, not locked by current thread

Environment

Application

Jira

Platform

Server

Cause

The issue occurs if the property configuration item access level of the custom fields is set to ADMIN on target and LOCKED on source. This difference is displayed in the deployment wizard i.e. target custom fields' configuration item access level and will be modified to LOCKED.

Solution

Steps to unlock the customfield custom field from the Databasedatabase.

  1. Run the following query via the database to determine the JIRA Jira Software custom field IDs:
    select * from customfield;

  2. You will have to match Match the id of the field you want to unlock that needs to be unlocked with the according relevant entry in the managedconfigurationitem table's item_id column.
    select * from managedconfigurationitem;

  3. You will need to set Set the managed column to false of for any field you want to unlockthat needs to be unlocked. For example, the below will unlock query unlocks Epic Status and Epic Colour:
    UPDATE managedconfigurationitem set managed='false' where item_id in ('customfield_10208','customfield_10209');

  4. Note: After the above change, the 'access_level' column will remain with the 'LOCKED' value, but the custom fields will be unlocked from the UI.

  5. Make the required changes to the fields.

  6. Lock the fields that were unlocked by setting the managed column to true. For example, the below will lock query locks Epic Status and Epic Colour:
    UPDATE managedconfigurationitem set managed='true' where item_id in ('customfield_10208','customfield_10209');

Info

These fields will be are locked again on startup by automated tasks within pluginsthe apps.

There is a an Atlassian KB article Atlassian provided that talks about changing and checking custom fields' configuration item access level i.e. locked status.

https://confluence.atlassian.com/jirakb/unlock-a-locked-jira-software-custom-field-779158866.html

ADMIN option is similar to LOCKED option i.e., custom field is locked for all others except for admins.

https://docs.atlassian.com/software/jira/docs/api/7.2.1/com/atlassian/jira/config/managedconfiguration/ConfigurationItemAccessLevel.html

Note

Always back up your the data before performing any modifications to the database. If possible, test Test any alter, insert, update, or delete SQL commands on a staging server first.