[ 
https://issues.apache.org/jira/browse/SLING-10912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17441093#comment-17441093
 ] 

Dirk Rudolph edited comment on SLING-10912 at 11/9/21, 10:58 AM:
-----------------------------------------------------------------

I was able to reproduce this occasionally and found that when I log the 
invocations, I sometimes even get 2 log messages but the verification says 3. 
There seem to be multiple issues here:

1) getResourceBundle() is called a second time already before reloadBundle() is 
called by the test
2) invocation counter increased by powermock before the actual method is called 
(interrupted by terminating the test JVM)
3) scheduled executor is not shut down so the test calls to getResourceBundle 
continue even after reloadBundle completed

Waiting for the reloadBundle() to completed showed that the assertSame() 
assertion in the scheduled runnable actually throws but so far the result was 
simply ignored.

I refactored the test and out of 100 invocations of the test (with preload=true 
and preload=false) I was not able to reproduce the issue again. Let me know 
what you think.

https://github.com/apache/sling-org-apache-sling-i18n/pull/8


was (Author: diru):
I was able to reproduce this occasionally and found that when I log the 
invocations sometimes even get 2 log messages by the verification says 3. There 
seem to be multiple issues here:

1) getResourceBundle() is called a second time already before reloadBundle() is 
called by the test
2) invocation counter increased by powermock before the actual method is called 
(interrupted by terminating the test JVM)
3) scheduled executor is not shut down so the test calls to getResourceBundle 
continue even after reloadBundle completed

Waiting for the reloadBundle() to completed showed that the assertSame() 
assertion in the scheduled runnable actually throws but so far the result was 
simply ignored.

I refactored the test and out of 100 invocations of the test (with preload=true 
and preload=false) I was not able to reproduce the issue again. Let me know 
what you think.

https://github.com/apache/sling-org-apache-sling-i18n/pull/8

> ConcurrentJcrResourceBundleLoadingTest fails with 
> newBundleReplacesOldBundleAfterReload
> ---------------------------------------------------------------------------------------
>
>                 Key: SLING-10912
>                 URL: https://issues.apache.org/jira/browse/SLING-10912
>             Project: Sling
>          Issue Type: Bug
>          Components: i18n
>    Affects Versions: i18n 2.5.18
>            Reporter: Oliver Lietz
>            Assignee: Dirk Rudolph
>            Priority: Major
>             Fix For: i18n 2.6.0
>
>
> {noformat}
> [INFO] 
> [INFO] Results:
> [INFO] 
> [ERROR] Failures: 
> [ERROR]   
> ConcurrentJcrResourceBundleLoadingTest.newBundleReplacesOldBundleAfterReload:230
>  
> jcrResourceBundleProvider.getResourceBundleInternal(
>     or(<any org.apache.sling.api.resource.ResourceResolver>, isNull()),
>     null,
>     en,
>     <any boolean>
> );
> Wanted 2 times but was 3 times.
> [INFO] 
> [ERROR] Tests run: 44, Failures: 1, Errors: 0, Skipped: 0
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to