Skip to end of banner
Go to start of banner

How to fix the issue when Custom fields are getting locked

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Problem Statement

When migrating a project from one Server to another, the custom fields that were migrated earlier are being locked.

Error Message 

Log Entries 

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 from the Database.

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

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

  3. You will need to set the managed column to false of any field you want to unlock. For example, the below will unlock 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 Epic Status and Epic Colour:
    UPDATE managedconfigurationitem set managed='true' where item_id in ('customfield_10208','customfield_10209');

These fields will be locked again on startup by automated tasks within plugins.

There is a KB article Atlassian provided 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 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

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

  • No labels