New and Improved 3.13 Beta. Highlights: Shareable filters and dashboards and lots of other goodies. Any feedback can be raised as JIRA issues in the JIRA project.
Issue Details (XML | Word | Printable)

Key: JRA-10978
Type: Improvement Improvement
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: Dylan Etkin [Atlassian]
Votes: 3
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JIRA

Fix the CustomFieldManager so that it is alerted when a plugin type of customfield is registered/deregisted and fix its cache so that it will not be out-of-date at startup

Created: 28/Aug/06 06:06 PM   Updated: 06/Dec/07 08:00 PM
Component/s: Custom Fields
Affects Version/s: 3.6.4
Fix Version/s: 3.13.x

Time Tracking:
Original Estimate: 1 week, 1 day
Original Estimate - 1 week, 1 day
Remaining Estimate: 1 week, 1 day
Remaining Estimate - 1 week, 1 day
Time Spent: Not Specified
Remaining Estimate - 1 week, 1 day

File Attachments: 1. File ProgAye1.tif (211 kB)
2. File ProgAye2.tif (209 kB)

Image Attachments:

1. screenshot-1.jpg
(234 kB)

2. screenshot-1.jpg
(234 kB)

3. screenshot-1.jpg
(234 kB)

4. screenshot-1.jpg
(234 kB)

5. screenshot-1.jpg
(234 kB)
Issue Links:
Cause
 
Duplicate
 

Participants: Dylan Etkin [Atlassian] and Jed Wesley-Smith [Atlassian]
Since last comment: 37 weeks, 6 days ago
To be done by: Pair of developers
Labels:


 Description  « Hide
We need to change the way that the CustomFieldManager discovers the registered plugins of customfield type. The reason is that we may run into a situation where a plugin has a dependancy on the CustomFieldManager which will force the manager to be created and initialized before all plugins have had a chance to register themselves. In the case of the CustomFieldManager it assumes that all custom field types have been registered and it eagerly instatiates its cache, which is incorrect since not all custom field types have been registered. So at the moment we refresh the managers AFTER we know that all has been setup within the ComponentManager.start() method, when this issue is fixed we should remove this quick fix.

The problem is not as simple as changing the eager cache to a lazy cache. If we did this we would still find that if a plugin tried to access a custom field when it is initialized then we would be back in the same situation. There are a few options to solving this:
1. Add a lifecycle interface to our managers so you could then have a "postStartup" method and in the component manager you could get all managers that implement the lifecycle interface and alert them that they are now at postStartup
2. Remove the custom field managers cache and force it to query the pluginManager everytime it is looking for custom fields. This would need to have some profiling done before we could decide if this is feasable (it could be the case that performance would take a nose-dive by removing this cache).
3. The best option is probably to include an event system in JIRA and to make certain that events are fired on plugin enable/disable/registration. We would want to include enough information about which plugin is the object of the event so that the CustomFieldManager could look for these events and keep itself in the correct state based on the events its receives. This would allow us to keep a cache (which should propbably be reworked, take a look at it...), but it would allow the manager to be kept abreast of the change state of the system. This will become even more important when we start allowing plugins to be dynamically added to a running JIRA instance. This would also allow use to clean up nasty places like the resetCaches method in the JiraPluginManager.
4. Another option which was discussed was to make the CustomFieldManager not ever talk to the PluginManager but instead to have the CustomFieldModuleDescriptor know about the CustomFIeldManager and on enable/disable/registration the descriptor can register/deregister custom field types with the Manager. In essence we turn the communication around. The only draw back of this is that we would need to come up with some mechanism to "reset" the CustomFieldManager and this could be difficult since it is the PluginManager who will know the current state of the plugins in the system.

When we fix this please remember to take out the hack in ComponentManager.start()



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dylan Etkin [Atlassian] added a comment - 28/Aug/06 06:15 PM
As an extra note, for those who may fix this bug. The way that the CustomFieldManager is being created is that the SearchRequestViewModuleDescriptor (which controls the issue navigator view types), has a dep on a SearchRequestURLHandler which has a dep on a SearchRequestManager which has a dep on the CustomFieldManager.

Dylan Etkin [Atlassian] added a comment - 15/Oct/06 07:32 PM
Another note for those who fix this bug. I have changed the SearchRequestURLHandler so that it does not get injected with the SearchRequestManager which eventually has a dep on CustomFieldManager. Instead it will now get the manager lazily, this is a hack around the real problem but it should work for now. Please revert the SearchRequestURLHandler when this issue is fixed properly.

Dylan Etkin [Atlassian] added a comment - 08/Nov/06 06:51 PM
We have removed the explicit cache refresh in ComponentManager.start() so we don't report missing custom fields multiple times. See JRA-11459. This should not be a problem because our system module descriptors do not have a dep on the CustomFieldManager, thus causing it to be instantiated early. We may still have a problem if a user defined module descriptor has a dep on the CustomFieldManager.

Dylan Etkin [Atlassian] added a comment - 08/Nov/06 06:54 PM
PLEASE NOTE: A symptom of this problem is that you will have custom fields added to your JIRA instance that are not viewable or accessible via the custom field manager or the UI. Adding/Removing custom field will put the systems cache back into the proper state.

Jed Wesley-Smith [Atlassian] added a comment - 06/Dec/07 08:00 PM
The fix for this issue has not been able to make it into JIRA v3.12. We are hoping to incorporate it into v3.12.1. As of writing however, there are 163 items scheduled as Fix For v3.12.1. We will not be able to include all of them.