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.
Run the following query via the database to determine the JIRA Software custom field IDs
select * from customfield;
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;
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');
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.
Make the required changes to the fields.
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.
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.