Bug 1323878

Summary: [GSS] (6.2.z) AsyncWatchService dies when a RuntimeException is thrown from IOWatchServiceExecutorImpl.execute()
Product: [Retired] JBoss BRMS Platform 6 Reporter: Toshiya Kobayashi <tkobayas>
Component: Business CentralAssignee: manstis
Status: CLOSED EOL QA Contact: Jiri Locker <jlocker>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: anstephe, jlocker, manstis, rsynek
Target Milestone: CR1   
Target Release: 6.2.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1323572 Environment:
Last Closed: 2020-03-27 20:04:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1323572    
Bug Blocks: 1327763, 1327765    
Attachments:
Description Flags
throwRuntimeExceptionIOService.rule
none
throwRuntimeExceptionIOServiceOnProjectDeleteBRMS622.rule none

Description Toshiya Kobayashi 2016-04-05 00:45:22 UTC
+++ This bug was initially created as a clone of Bug #1323572 +++

Description of problem:

AsyncWatchService dies when a RuntimeException is thrown from IOWatchServiceExecutorImpl.execute().

So you will see problems like:

- Incremental build is not triggered
- A newly created Data Object is not listed in Guided Rule editor
etc...

1. Start BRMS 6.2.2.
2. Log in to business-central
3. Create a Data Object (e.g. 'Pojo1') in pacakge "org.kie.example.project1" in "project1" in "repository1"
4. Save
5. Confirm ResourceChangeIncrementalBuilder log
====
15:37:55,326 INFO  [org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder] (Thread-101) Incremental build request received for: default://master@repository1/project1/src/main/java/org/kie/example/project1/Pojo1.java (added).
====
6. Create a Guided Rule (e.g. 'gr1') in the same package
7. Click the plus icon in the right side of WHEN.
8. Confirm that 'Pojo1' is listed.
9. Enable the attached Byteman rule "throwRuntimeExceptionIOService.rule"
$ bin/bminstall.sh <PID>
$ bin/bmsubmit.sh -l throwRuntimeExceptionIOService.rule
10. Create a new project (e.g. 'project2')
 -> It throws a RuntimeException by the attached Byteman rule 
11. Disable the Byteman rule
$ bin/bmsubmit.sh -u throwRuntimeExceptionIOService.rule
12. Go back to 'project1'
13. Create a Data Object (e.g. 'Pojo2') in pacakge "org.kie.example.project1" in "project1" in "repository1"
14. Save
15. Create a Guided Rule (e.g. 'gr2') in the same package
16. Click the plus icon in the right side of WHEN.
17. Confirm if 'Pojo2' is listed.

Actual results:

- ResourceChangeIncrementalBuilder log is no longer printed
- 'Pojo2' is not listed in Guided Rule Editor

Expected results:

- ResourceChangeIncrementalBuilder log is printed
- 'Pojo2' is listed in Guided Rule Editor

--- Additional comment from Toshiya Kobayashi on 2016-04-04 03:13:37 EDT ---

Analysis:

Probably try-catch is just missed in the first 'if' block.

https://github.com/uberfire/uberfire/blob/master/uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/watch/IOWatchServiceExecutorImpl.java#L93-L146

Or handling Exceptions in AsyncWatchService.execute() might be robust.

https://github.com/uberfire/uberfire/blob/master/uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/watch/AbstractIOWatchService.java#L149-L170

Comment 2 Toshiya Kobayashi 2016-04-05 00:50:55 UTC
Created attachment 1143546 [details]
throwRuntimeExceptionIOService.rule

Comment 3 Toshiya Kobayashi 2016-04-08 07:21:45 UTC
Created attachment 1145033 [details]
throwRuntimeExceptionIOServiceOnProjectDeleteBRMS622.rule

Comment 4 Toshiya Kobayashi 2016-04-08 07:22:45 UTC
[IMPORTANT]

Here is a new reproduce step which is closer to the real issue. Please use this instead.

1. Start BRMS 6.2.2.
2. Log in to business-central
3. Create a Data Object (e.g. 'Pojo1') in pacakge "org.kie.example.project1" in "project1" in "repository1"
4. Save
5. Confirm ResourceChangeIncrementalBuilder log
====
15:37:55,326 INFO  [org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder] (Thread-101) Incremental build request received for: default://master@repository1/project1/src/main/java/org/kie/example/project1/Pojo1.java (added).
====
6. Create a Guided Rule (e.g. 'gr1') in the same package
7. Click the plus icon in the right side of WHEN.
8. Confirm that 'Pojo1' is listed.
9. Create a new project (e.g. 'project2')
10. Enable the attached Byteman rule "throwRuntimeExceptionIOServiceOnProjectDeleteBRMS622.rule"
$ bin/bminstall.sh <PID>
$ bin/bmsubmit.sh -l throwRuntimeExceptionIOServiceOnProjectDeleteBRMS622.rule
11. Delete the new project
 -> It throws a RuntimeException by the attached Byteman rule 
12. Disable the Byteman rule
$ bin/bmsubmit.sh -u throwRuntimeExceptionIOServiceOnProjectDeleteBRMS622.rule
13. Go back to 'project1'
14. Create a Data Object (e.g. 'Pojo2') in pacakge "org.kie.example.project1" in "project1" in "repository1"
15. Save
16. Create a Guided Rule (e.g. 'gr2') in the same package
17. Click the plus icon in the right side of WHEN.
18. Confirm if 'Pojo2' is listed.

Actual results:

- ResourceChangeIncrementalBuilder log is no longer printed
- 'Pojo2' is not listed in Guided Rule Editor

Expected results:

- ResourceChangeIncrementalBuilder log is printed
- 'Pojo2' is listed in Guided Rule Editor

Comment 7 Jan Hrcek 2016-05-05 08:59:43 UTC
Ok, verified that RuntimeException no longer destroys AsyncWatchService and incremental build etc. continue to work. Verified with BPM Suite 6.2.3 patch.