rbeckman-nextgen / test-mc

test-migration
1 stars 0 forks source link

Setting plugin properties can cause NPEs and other problems #3243

Open rbeckman-nextgen opened 4 years ago

rbeckman-nextgen commented 4 years ago

When setting plugin properties, we first remove properties and then re-save them. These two operations are not synchronized at all, so if another thread tried to get plugin properties in the middle of that, some or all properties for a plugin could be null.

This is most apparent with the User Authorization plugin. If you have unsaved changes on the User Authorization settings view and choose to go back to the dashboard and save (save via the prompt dialog, not via the save task), you'll get an exception:

{code}com.mirth.connect.client.core.ClientException: method failed: HTTP/1.1 500 com.mirth.connect.donkey.util.DonkeyElement$DonkeyElementException: java.lang.NullPointerException com.mirth.connect.client.core.ServerConnection.executePostMethodAsync(ServerConnection.java:222) com.mirth.connect.client.core.Client.invokePluginMethodAsync(Client.java:333) com.mirth.connect.plugins.dashboardstatus.DashboardConnectorStatusColumn.tableUpdate(DashboardConnectorStatusColumn.java:108) com.mirth.connect.client.ui.Frame$16.doInBackground(Frame.java:2360) com.mirth.connect.client.ui.Frame$16.doInBackground(Frame.java:2355) com.mirth.connect.client.ui.QueuingSwingWorker.doInBackground(QueuingSwingWorker.java:96) javax.swing.SwingWorker$1.call(SwingWorker.java:296) java.util.concurrent.FutureTask.run(FutureTask.java:262) javax.swing.SwingWorker.run(SwingWorker.java:335) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:744){code}

We don't necessarily need synchronization on the entire method, just on specific plugin group names. So two or more threads should be able to call get/setPluginProperties as long as the group names are different (like "User Authorization" vs. "Data Pruner", etc.).

Imported Issue. Original Details: Reporter: narupley Created: 2014-05-23T10:35:14.000-0700

rbeckman-nextgen commented 4 years ago

I just wanted to report that this is apparently still an issue in the latest version (3.5.0.8232) We just upgraded today and received this error after saving a change in the User Authorization plugin

Imported Comment. Original Details: Author: cdandrews Created: 2017-06-14T06:46:33.000-0700

rbeckman-nextgen commented 4 years ago

Does it only happen when leaving the User Auth tab with unsaved changes, and then saving it in the popup dialog that follows? As far as I know it shouldn't happen if you simply click the Save task while on the User Auth tab.

Imported Comment. Original Details: Author: narupley Created: 2017-06-14T07:05:54.000-0700

rbeckman-nextgen commented 4 years ago

I actually didn't receive the error in my session. There was another user logged in to the Admin console who received it. I thought at first that perhaps she was logged in w/ an account that I had modified roles, but she wasn't. She received the exact error shown in the original attachment, and I saw the error in the Server Log "method failed: HTTP/1.1 500 com.mirth.connect.donkey.util.DonkeyElement$DonkeyElementException: java.lang.NullPointerException"

Imported Comment. Original Details: Author: cdandrews Created: 2017-06-14T07:16:17.000-0700