Bug 1123725 - Deleting a repository in a cluster causes java.lang.IllegalArgumentException:Parameter named 'resource' is not instance of clazz 'RuntimeResource'!
Summary: Deleting a repository in a cluster causes java.lang.IllegalArgumentException:...
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER5
: 6.1.0
Assignee: Alexandre Porcelli
QA Contact: Radovan Synek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-28 06:35 UTC by Toshiya Kobayashi
Modified: 2019-05-20 11:14 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Toshiya Kobayashi 2014-07-28 06:35:17 UTC
Description of problem:

If you delete a repository in clustered business-central, it will causes an invalid OrganizationalUnit state so you will face a broken Project Explorer after BRMS reboot.


Steps to Reproduce:
1. Setup a 2 node cluster in EAP 6 following the docs : https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_BRMS/6.0/html-single/Installation_Guide/index.html#chap-Clustering
2. Start the cluster (Server1 and Server2)
3. Login to Server1 as an admin user 
4. Go to [Administration]
5. Create an Organizational Unit 'example'
6. Create a new Repository 'repo1'
7. Create a new Repository 'repo2'
8. Delete 'repo2'
 -> But 'repo2' doesn't immediately disappear in RepositoryEditor (Because an Exception is thrown internally). You need to refresh a browser to confirm.
9. Stop Server1
10. Start Server1
11. Login to Server1 as an admin user again

Actual results:

An error message pops-up,
~~~
Unable to complete your request. The following exception occurred: java.lang.IllegalArgumentException:Parameter named 'resource' is not instance of clazz 'RuntimeResource'!.
~~~

You can find a debug level stack trace.
~~~
08:44:06,191 DEBUG [org.jboss.errai.bus.server.io.AbstractRPCMethodCallback] (http-/10.232.10.84:8080-1) RPC endpoint threw exception:: java.lang.IllegalArgumentException: Parameter named 'resource' is not instance of clazz 'RuntimeResource'!
	at org.uberfire.security.impl.authz.RuntimeResourceManager.requiresAuthentication(RuntimeResourceManager.java:61) [uberfire-security-api-0.3.3-redhat-4.jar:0.3.3-redhat-4]
	at org.uberfire.security.impl.authz.RuntimeAuthorizationManager.authorize(RuntimeAuthorizationManager.java:49) [uberfire-security-api-0.3.3-redhat-4.jar:0.3.3-redhat-4]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_60]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_60]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_60]
	at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_60]
	at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45) [weld-core-1.1.13.Final-redhat-1.jar:1.1.13.Final-redhat-1]
	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105) [weld-core-1.1.13.Final-redhat-1.jar:1.1.13.Final-redhat-1]
	at org.jboss.weld.proxies.AuthorizationManager$1418655305$Proxy$_$$_WeldClientProxy.authorize(AuthorizationManager$1418655305$Proxy$_$$_WeldClientProxy.java) [weld-core-1.1.13.Final-redhat-1.jar:]
	at org.kie.workbench.common.screens.explorer.backend.server.ExplorerServiceImpl.getRepositories(ExplorerServiceImpl.java:538) [kie-wb-common-project-explorer-backend-6.0.3-redhat-4.jar:6.0.3-redhat-4]
	at org.kie.workbench.common.screens.explorer.backend.server.ExplorerServiceImpl.getContent(ExplorerServiceImpl.java:206) [kie-wb-common-project-explorer-backend-6.0.3-redhat-4.jar:6.0.3-redhat-4]
	at org.kie.workbench.common.screens.explorer.backend.server.ExplorerServiceImpl$Proxy$_$$_WeldClientProxy.getContent(ExplorerServiceImpl$Proxy$_$$_WeldClientProxy.java) [kie-wb-common-project-explorer-backend-6.0.3-redhat-4.jar:6.0.3-redhat-4]
...
~~~

Project Explorer displays nothing.

Expected results:

Users can login without an error.

Comment 1 Toshiya Kobayashi 2014-07-28 06:57:53 UTC
(Analysis)

- When you delete a repo, RepositoryServiceImpl.removeRepository() fails during ioService.delete() with IllegalStateException so the latter part (de-associating the repo from the OrganizationalUnit) is not executed.

https://github.com/uberfire/uberfire/blob/0.3.x/uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/repositories/RepositoryServiceImpl.java#L253

~~~
4:32:50,730 DEBUG [org.jboss.errai.bus.server.io.AbstractRPCMethodCallback] (http-localhost.localdomain/127.0.0.1:8080-1) RPC endpoint threw exception:: java.lang.IllegalStateException: FileSystem is close.
        at org.uberfire.java.nio.fs.jgit.JGitFileSystem.checkClose(JGitFileSystem.java:358) [uberfire-nio2-jgit-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.java.nio.fs.jgit.JGitFileSystem.getRootDirectories(JGitFileSystem.java:156) [uberfire-nio2-jgit-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.io.impl.cluster.FileSystemSyncLock$1.<init>(FileSystemSyncLock.java:37) [uberfire-io-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.io.impl.cluster.FileSystemSyncLock.buildContent(FileSystemSyncLock.java:36) [uberfire-io-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.commons.cluster.LockExecuteNotifyAsyncReleaseTemplate.sendMessage(LockExecuteNotifyAsyncReleaseTemplate.java:7) [uberfire-commons-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.commons.cluster.BaseLockExecuteNotifyReleaseTemplate.execute(BaseLockExecuteNotifyReleaseTemplate.java:22) [uberfire-commons-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.commons.cluster.LockExecuteNotifyAsyncReleaseTemplate.execute(LockExecuteNotifyAsyncReleaseTemplate.java:3) [uberfire-commons-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.io.impl.cluster.IOServiceClusterImpl.delete(IOServiceClusterImpl.java:424) [uberfire-io-0.3.3-redhat-4.jar:0.3.3-redhat-4]
        at org.uberfire.backend.server.repositories.RepositoryServiceImpl.removeRepository(RepositoryServiceImpl.java:253) [uberfire-backend-server-0.3.3-redhat-4.jar:0.3.2-SNAPSHOT]
        at org.uberfire.backend.server.repositories.RepositoryServiceImpl$Proxy$_$$_WeldClientProxy.removeRepository(RepositoryServiceImpl$Proxy$_$$_WeldClientProxy.java) [uberfire-backend-server-0.3.3-redhat-4.jar:0.3.2-SNAPSHOT]
~~~

- So the OrganizationalUnit still retains the deleted repo name and it will results in adding 'null' in OrganizationalUnit.getRepositories() when the OrganizationUnit is loaded.

https://github.com/uberfire/uberfire/blob/0.3.x/uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/organizationalunit/OrganizationalUnitFactoryImpl.java#L25

- If OrganizationalUnit.getRepositories() includes 'null' in the list, it will results in the IllegalArgumentException Parameter named 'resource' is not instance of clazz 'RuntimeResource'!

https://github.com/uberfire/uberfire/blob/0.3.x/uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/RuntimeResourceManager.java#L60

Comment 2 Toshiya Kobayashi 2014-09-26 02:00:22 UTC
Workaround:

- Delete a OrganizationUnit in problem ([Administration]->[Manage Organizational Units]-> "Delete" button in Organizational Unit Manager)
- Create a OrganizationUnit again with the same name ("Add" button in Organizational Unit Manager)
- Associate repositories for the OrganizationUnit (Use list-box in Organizational Unit Manager)

Comment 4 Alexandre Porcelli 2015-01-30 01:05:35 UTC
Fix pushed:

(0.5.x) https://github.com/uberfire/uberfire/commit/09896f064225e9048d1eb692fe53a7cdf3864927

(master) https://github.com/uberfire/uberfire-extensions/commit/78d2a678d07c70023bd777aee025bac9202cd9b1

(master) https://github.com/droolsjbpm/kie-uberfire-extensions/commit/02237b03c
(6.2.x) https://github.com/droolsjbpm/kie-uberfire-extensions/commit/257946c01

(master) https://github.com/droolsjbpm/guvnor/commit/e02c6aa70
(6.2.x) https://github.com/droolsjbpm/guvnor/commit/802a40884

(master) https://github.com/droolsjbpm/kie-wb-common/commit/da0ef923b
(6.2.x) https://github.com/droolsjbpm/kie-wb-common/commit/3774cd7e7

(master) https://github.com/droolsjbpm/kie-wb-distributions/commit/cc5763e5c
(6.2.x) https://github.com/droolsjbpm/kie-wb-distributions/commit/8b96b972c


 Make sure you have the following properties set in your nodes:

<property name="jboss.node.name" value="nodeOne" boot-time="false"/>
<property name="org.uberfire.nio.git.dir" value="/tmp/jbpm/nodeone" boot-time="false"/>
<property name="org.uberfire.cluster.id" value="bpms-lock" boot-time="false"/>
<property name="org.uberfire.cluster.zk" value="localhost:2188" boot-time="false"/>
<property name="org.uberfire.cluster.local.id" value="nodeOne_11" boot-time="false"/>
<property name="org.uberfire.cluster.vfs.lock" value="vfs-lock" boot-time="false"/>
<property name="org.uberfire.nio.git.ssh.port" value="8001" boot-time="false"/>
<property name="org.uberfire.nio.git.ssh.hostport" value="8001" boot-time="false"/>
<property name="org.uberfire.nio.git.daemon.port" value="9418" boot-time="false"/>
<property name="org.uberfire.nio.git.daemon.hostport" value="9418" boot-time="false"/>
<property name="org.uberfire.metadata.index.dir" value="/tmp/jbpm/nodeone" boot-time="false"/>
<property name="org.uberfire.nio.git.ssh.cert.dir" value="/tmp/jbpm/nodeone" boot-time="false"/>
<property name="org.uberfire.cluster.autostart" value="true" boot-time="false"/>


Double check org.uberfire.nio.git.daemon.hostport, org.uberfire.nio.git.ssh.hostport and org.uberfire.cluster.autostart!

Comment 5 Radovan Synek 2015-02-18 16:51:20 UTC
Verified with BPMS-6.1.0.ER5


Note You need to log in before you can comment on or make changes to this bug.