[jira] [Resolved] (SLING-12239) Create string representation of processing component configuration only once

2024-01-23 Thread Carsten Ziegeler (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-12239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler resolved SLING-12239.
--
Resolution: Fixed

https://github.com/apache/sling-org-apache-sling-rewriter/commit/7bbf8a52db191f2d59bc6c00fc86bf0a8235bf20

> Create string representation of processing component configuration only once
> 
>
> Key: SLING-12239
> URL: https://issues.apache.org/jira/browse/SLING-12239
> Project: Sling
>  Issue Type: Improvement
>  Components: General
>Affects Versions: Rewriter 1.3.8
>Reporter: Carsten Ziegeler
>Assignee: Carsten Ziegeler
>Priority: Major
> Fix For: Rewriter 1.3.10
>
>
> With SLING-12227 the "caching" of the processing component configuration got 
> accidentally removed. As this one is printed out with each and every html 
> request, we should only create it once.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[VOTE] Release Apache Sling Rewriter 1.3.10

2024-01-23 Thread Carsten Ziegeler

Hi,

We solved 2 issues in this release
https://issues.apache.org/jira/projects/SLING/versions/12354138


Staging repository: 
https://repository.apache.org/content/repositories/orgapachesling-2833/


You can use this UNIX script to download the release and verify the 
signatures:

https://gitbox.apache.org/repos/asf?p=sling-tooling-release.git;a=blob;f=check_staged_release.sh;hb=HEAD

Usage:
sh check_staged_release.sh 2833 /tmp/sling-staging

Please vote to approve this release:

  [ ] +1 Approve the release
  [ ]  0 Don't care
  [ ] -1 Don't release, because ...

This majority vote is open for at least 72 hours.

Regards
Carsten
--
Carsten Ziegeler
Adobe
cziege...@apache.org


[jira] [Created] (SLING-12238) Prevent NullPointerException if global transformer returns null

2024-01-23 Thread Carsten Ziegeler (Jira)
Carsten Ziegeler created SLING-12238:


 Summary: Prevent NullPointerException if global transformer 
returns null
 Key: SLING-12238
 URL: https://issues.apache.org/jira/browse/SLING-12238
 Project: Sling
  Issue Type: Improvement
  Components: General
Affects Versions: Rewriter 1.3.8
Reporter: Carsten Ziegeler
Assignee: Carsten Ziegeler
 Fix For: Rewriter 1.3.10


A TransformerFactory for a global transformer might return null for the 
Transformer, similar the factory might already be gone. Both result in a null 
value inserted into the array of global transformers.
Later on, when that array is processed, there is no null check anymore. 
Potentially resulting in a NullPointerException
This should be guarded with a null check, as this might happen in a dynamic 
system



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (SLING-12239) Create string representation of processing component configuration only once

2024-01-23 Thread Carsten Ziegeler (Jira)
Carsten Ziegeler created SLING-12239:


 Summary: Create string representation of processing component 
configuration only once
 Key: SLING-12239
 URL: https://issues.apache.org/jira/browse/SLING-12239
 Project: Sling
  Issue Type: Improvement
  Components: General
Affects Versions: Rewriter 1.3.8
Reporter: Carsten Ziegeler
Assignee: Carsten Ziegeler
 Fix For: Rewriter 1.3.10


With SLING-12227 the "caching" of the processing component configuration got 
accidentally removed. As this one is printed out with each and every html 
request, we should only create it once.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Resolved] (SLING-12238) Prevent NullPointerException if global transformer returns null

2024-01-23 Thread Carsten Ziegeler (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-12238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler resolved SLING-12238.
--
Resolution: Fixed

https://github.com/apache/sling-org-apache-sling-rewriter/commit/bd45e2145a438899c487184ce388a579270495f0

> Prevent NullPointerException if global transformer returns null
> ---
>
> Key: SLING-12238
> URL: https://issues.apache.org/jira/browse/SLING-12238
> Project: Sling
>  Issue Type: Improvement
>  Components: General
>Affects Versions: Rewriter 1.3.8
>Reporter: Carsten Ziegeler
>Assignee: Carsten Ziegeler
>Priority: Major
> Fix For: Rewriter 1.3.10
>
>
> A TransformerFactory for a global transformer might return null for the 
> Transformer, similar the factory might already be gone. Both result in a null 
> value inserted into the array of global transformers.
> Later on, when that array is processed, there is no null check anymore. 
> Potentially resulting in a NullPointerException
> This should be guarded with a null check, as this might happen in a dynamic 
> system



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (SLING-12211) Update Parent to 52 and make build compatible with Java 17 and above

2024-01-23 Thread Carsten Ziegeler (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-12211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler updated SLING-12211:
-
Fix Version/s: Rewriter 1.3.12
   (was: Rewriter 1.3.10)

> Update Parent to 52 and make build compatible with Java 17 and above
> 
>
> Key: SLING-12211
> URL: https://issues.apache.org/jira/browse/SLING-12211
> Project: Sling
>  Issue Type: Improvement
>Reporter: Konrad Windszus
>Assignee: Konrad Windszus
>Priority: Major
> Fix For: Rewriter 1.3.12
>
>
> Updating to Parent 52 allows reproducible builds 
> (https://issues.apache.org/jira/browse/SLING-11907).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] chore(deps): update dependency org.apache.sling:org.apache.sling.resourceresolver to v1.11.6 [sling-org-apache-sling-starter]

2024-01-23 Thread via GitHub


rombert merged PR #298:
URL: https://github.com/apache/sling-org-apache-sling-starter/pull/298


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] chore(deps): update dependency com.fasterxml.woodstox:woodstox-core to v6.6.0 [sling-org-apache-sling-starter]

2024-01-23 Thread via GitHub


rombert merged PR #299:
URL: https://github.com/apache/sling-org-apache-sling-starter/pull/299


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] chore(deps): update dependency org.apache.sling:org.apache.sling.resourceresolver to v1.11.6 [sling-site]

2024-01-23 Thread via GitHub


reschke closed pull request #153: chore(deps): update dependency 
org.apache.sling:org.apache.sling.resourceresolver to v1.11.6
URL: https://github.com/apache/sling-site/pull/153


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Resolved] (SLING-12226) Support continuous incoming distributions in subscriber readiness

2024-01-23 Thread Christian Schneider (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-12226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Schneider resolved SLING-12226.
-
Resolution: Fixed

> Support continuous incoming distributions in subscriber readiness
> -
>
> Key: SLING-12226
> URL: https://issues.apache.org/jira/browse/SLING-12226
> Project: Sling
>  Issue Type: Improvement
>Reporter: Christian Schneider
>Assignee: Christian Schneider
>Priority: Major
> Fix For: Content Distribution Journal Core 0.3.0
>
>
> Refine readiness check for subscriber to also cover case of continuous 
> incoming distributions.
> If there are continuous incoming distributions then the readiness checks will 
> only report ready after the fallback time of 5 minutes.
> Jörg proposed to also have a check how old distribution messages are. If they 
> are new enough we should report ready.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [VOTE] Release Apache Sling Testing JCR Mock 1.6.14, OSGi Mock 3.4.2, ResourceResolver Mock 1.4.6, Sling Mock 3.4.18

2024-01-23 Thread Jörg Hoh
+1

Am Mo., 22. Jan. 2024 um 15:56 Uhr schrieb Stefan Seifert
:

> Hi,
>
> Testing JCR Mock 1.6.14  (1 issue)
>
> https://issues.apache.org/jira/secure/ReleaseNote.jspa?version=12354068=Text=12310710
>
> Testing OSGi Mock 3.4.2  (1 issue)
>
> https://issues.apache.org/jira/secure/ReleaseNote.jspa?version=12353872=Text=12310710
>
> Testing ResourceResolver Mock 1.4.6  (1 issue)
>
> https://issues.apache.org/jira/secure/ReleaseNote.jspa?version=12353544=Text=12310710
>
> Testing Sling Mock 3.4.18  (1 issue)
>
> https://issues.apache.org/jira/secure/ReleaseNote.jspa?version=12354009=Text=12310710
>
> Staging repository:
> https://repository.apache.org/content/repositories/orgapachesling-2832/
>
> You can use this UNIX script to download the release and verify the
> signatures:
>
> https://raw.githubusercontent.com/apache/sling-tooling-release/master/check_staged_release.sh
>
> Usage:
> sh check_staged_release.sh 2832 /tmp/sling-staging
>
> Please vote to approve this release:
>
>   [ ] +1 Approve the release
>   [ ]  0 Don't care
>   [ ] -1 Don't release, because ...
>
> This majority vote is open for at least 72 hours.
>
> stefan
>


-- 
https://cqdump.joerghoh.de


[PR] chore(deps): update dependency org.apache.felix:org.apache.felix.scr to v2.2.10 [sling-org-apache-sling-starter]

2024-01-23 Thread via GitHub


renovate-bot opened a new pull request, #297:
URL: https://github.com/apache/sling-org-apache-sling-starter/pull/297

   [![Mend 
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
   
   This PR contains the following updates:
   
   | Package | Change | Age | Adoption | Passing | Confidence |
   |---|---|---|---|---|---|
   | [org.apache.felix:org.apache.felix.scr](https://felix.apache.org/) 
([source](https://gitbox.apache.org/repos/asf?p=felix-dev.git)) | `2.2.6` -> 
`2.2.10` | 
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.apache.felix:org.apache.felix.scr/2.2.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.apache.felix:org.apache.felix.scr/2.2.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.apache.felix:org.apache.felix.scr/2.2.6/2.2.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.apache.felix:org.apache.felix.scr/2.2.6/2.2.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 |
   
   ---
   
   ### Configuration
   
    **Schedule**: Branch creation - At any time (no schedule defined), 
Automerge - At any time (no schedule defined).
   
    **Automerge**: Disabled by config. Please merge this manually once you are 
satisfied.
   
   ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry 
checkbox.
   
    **Ignore**: Close this PR and you won't be reminded about this update 
again.
   
   ---
   
- [ ] If you want to rebase/retry this PR, check this 
box
   
   ---
   
   This PR has been generated by [Mend 
Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository 
job log 
[here](https://developer.mend.io/github/apache/sling-org-apache-sling-starter).
   

   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] chore(deps): update dependency org.apache.sling:org.apache.sling.resourceresolver to v1.11.6 [sling-org-apache-sling-starter]

2024-01-23 Thread via GitHub


renovate-bot opened a new pull request, #298:
URL: https://github.com/apache/sling-org-apache-sling-starter/pull/298

   [![Mend 
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
   
   This PR contains the following updates:
   
   | Package | Change | Age | Adoption | Passing | Confidence |
   |---|---|---|---|---|---|
   | 
[org.apache.sling:org.apache.sling.resourceresolver](https://sling.apache.org) 
([source](https://togithub.com/apache/sling-org-apache-sling-resourceresolver)) 
| `1.11.4` -> `1.11.6` | 
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.apache.sling:org.apache.sling.resourceresolver/1.11.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.apache.sling:org.apache.sling.resourceresolver/1.11.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.apache.sling:org.apache.sling.resourceresolver/1.11.4/1.11.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.apache.sling:org.apache.sling.resourceresolver/1.11.4/1.11.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 |
   
   ---
   
   ### Configuration
   
    **Schedule**: Branch creation - At any time (no schedule defined), 
Automerge - At any time (no schedule defined).
   
    **Automerge**: Disabled by config. Please merge this manually once you are 
satisfied.
   
   ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry 
checkbox.
   
    **Ignore**: Close this PR and you won't be reminded about this update 
again.
   
   ---
   
- [ ] If you want to rebase/retry this PR, check this 
box
   
   ---
   
   This PR has been generated by [Mend 
Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository 
job log 
[here](https://developer.mend.io/github/apache/sling-org-apache-sling-starter).
   

   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] chore(deps): update dependency com.fasterxml.woodstox:woodstox-core to v6.6.0 [sling-org-apache-sling-starter]

2024-01-23 Thread via GitHub


renovate-bot opened a new pull request, #299:
URL: https://github.com/apache/sling-org-apache-sling-starter/pull/299

   [![Mend 
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
   
   This PR contains the following updates:
   
   | Package | Change | Age | Adoption | Passing | Confidence |
   |---|---|---|---|---|---|
   | 
[com.fasterxml.woodstox:woodstox-core](https://togithub.com/FasterXML/woodstox) 
| `6.5.1` -> `6.6.0` | 
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.fasterxml.woodstox:woodstox-core/6.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.fasterxml.woodstox:woodstox-core/6.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.fasterxml.woodstox:woodstox-core/6.5.1/6.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.fasterxml.woodstox:woodstox-core/6.5.1/6.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 |
   
   ---
   
   ### Configuration
   
    **Schedule**: Branch creation - At any time (no schedule defined), 
Automerge - At any time (no schedule defined).
   
    **Automerge**: Disabled by config. Please merge this manually once you are 
satisfied.
   
   ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry 
checkbox.
   
    **Ignore**: Close this PR and you won't be reminded about this update 
again.
   
   ---
   
- [ ] If you want to rebase/retry this PR, check this 
box
   
   ---
   
   This PR has been generated by [Mend 
Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository 
job log 
[here](https://developer.mend.io/github/apache/sling-org-apache-sling-starter).
   

   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] chore(deps): update dependency org.apache.sling:org.apache.sling.installer.core to v3.14.0 [sling-org-apache-sling-starter]

2024-01-23 Thread via GitHub


renovate-bot opened a new pull request, #300:
URL: https://github.com/apache/sling-org-apache-sling-starter/pull/300

   [![Mend 
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
   
   This PR contains the following updates:
   
   | Package | Change | Age | Adoption | Passing | Confidence |
   |---|---|---|---|---|---|
   | 
[org.apache.sling:org.apache.sling.installer.core](https://sling.apache.org) 
([source](https://togithub.com/apache/sling-org-apache-sling-installer-core)) | 
`3.12.0` -> `3.14.0` | 
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.apache.sling:org.apache.sling.installer.core/3.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.apache.sling:org.apache.sling.installer.core/3.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.apache.sling:org.apache.sling.installer.core/3.12.0/3.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 | 
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.apache.sling:org.apache.sling.installer.core/3.12.0/3.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
 |
   
   ---
   
   ### Configuration
   
    **Schedule**: Branch creation - At any time (no schedule defined), 
Automerge - At any time (no schedule defined).
   
    **Automerge**: Disabled by config. Please merge this manually once you are 
satisfied.
   
   ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry 
checkbox.
   
    **Ignore**: Close this PR and you won't be reminded about this update 
again.
   
   ---
   
- [ ] If you want to rebase/retry this PR, check this 
box
   
   ---
   
   This PR has been generated by [Mend 
Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository 
job log 
[here](https://developer.mend.io/github/apache/sling-org-apache-sling-starter).
   

   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [RESULT] [VOTE] Release Apache Resource Resolver 1.11.6

2024-01-23 Thread Julian Reschke

On 22.01.2024 17:25, Julian Reschke wrote:

On 22.01.2024 10:20, Julian Reschke wrote:

On 17.01.2024 07:51, Julian Reschke wrote:

...


Hi,

The vote has passed with the following result :

+1 (binding): Bertrand Delacretaz , Julian
Reschke , Konrad Windszus ,
Robert Munteanu 

I will copy this release to the Sling dist directory and
promote the artifacts to the central Maven repository.

Best regards, Julian


OK, I will need help with promoting the release (I'm committer but not
PMC member, thus have no write access to the SVN repo).

Best regards, Julian


Hi,

FYI: Konrad has volunteered to do the release promotion; thanks for that.

Best regards, Julian


Re: [RESULT] [VOTE] Release Apache Resource Resolver 1.11.6

2024-01-23 Thread Konrad Windszus
Done, please update the site accordingly.
Thanks,
Konrad

> On 23. Jan 2024, at 11:23, Julian Reschke  wrote:
> 
> On 22.01.2024 17:25, Julian Reschke wrote:
>> On 22.01.2024 10:20, Julian Reschke wrote:
>>> On 17.01.2024 07:51, Julian Reschke wrote:
 ...
>>> 
>>> Hi,
>>> 
>>> The vote has passed with the following result :
>>> 
>>> +1 (binding): Bertrand Delacretaz , Julian
>>> Reschke , Konrad Windszus ,
>>> Robert Munteanu 
>>> 
>>> I will copy this release to the Sling dist directory and
>>> promote the artifacts to the central Maven repository.
>>> 
>>> Best regards, Julian
>> 
>> OK, I will need help with promoting the release (I'm committer but not
>> PMC member, thus have no write access to the SVN repo).
>> 
>> Best regards, Julian
> 
> Hi,
> 
> FYI: Konrad has volunteered to do the release promotion; thanks for that.
> 
> Best regards, Julian



Re: [RESULT] [VOTE] Release Apache Resource Resolver 1.11.6

2024-01-23 Thread Julian Reschke

On 23.01.2024 13:05, Konrad Windszus wrote:

Done, please update the site accordingly.
Thanks,
Konrad


Thanks Konrad,

-> 

Best regards, Julian



Sling Model Caching & GC problems

2024-01-23 Thread Jörg Hoh
Hi Sling community,

I want to share a recent experience I had with Sling Models, Sling Model
caching and Garbage Collection problems.

I had a case, where an AEM instance had massive garbage collection
problems, but no memory problems. We saw the regular sawtooth pattern in
the heap consumption, but heavy GC activity (in a stop-the-world manner)
almost constantly. But no OutOfMemory situation, there it's not a memory
leak.

I manually captured a heapdump and found a lot of Sling models being
referenced by the Sling ModelAdapterFactory cache, and rechecking these
model classes in detail I found them to specify "cache=true" in their
@Model annotation.When these statements were removed, the situation looks
completely different, and the garbage collection was normal again.

I don't have a full explanation for this behavior yet. The Sling Models had
a reference to a ResourceResolver (which was properly closed), but I assume
that this reference somehow "disabled" the cleaning of the cache on major
GCs (as its a WeakHashMap), but tied the collection of these models to the
collection of the ResourceResolver objects, which have finalizers
registered. And finalizers are only executed under memory pressure. Having
this connetion might have led to the situation that the SlingModel objects
were not disposed eagerly, but only alongside the finalizers in situation
of high memory pressure in a "stop-the-world" situation.

I try to get some more examples for that behavior; but I am not sure of the
caching of Sling Models as-is is something we should continue to use. This
case was quite hard to crack, and I don't know if/how we can avoid such a
situation by design.

Jörg

-- 
https://cqdump.joerghoh.de


Re: [VOTE] Release Apache Sling Testing JCR Mock 1.6.14, OSGi Mock 3.4.2, ResourceResolver Mock 1.4.6, Sling Mock 3.4.18

2024-01-23 Thread Robert Munteanu
On Mon, 2024-01-22 at 14:56 +, Stefan Seifert wrote:
> Please vote to approve this release:

+1
Robert


signature.asc
Description: This is a digitally signed message part


Re: Sling Model Caching & GC problems

2024-01-23 Thread Paul Bjorkstrand
Hi Jörg,

My guess is that you are running up against the problem where the Model is
referencing its adaptable, directly or indirectly. In that situation, the
model would not be collectable because it is referenced more strongly than
by weak reference. The reference path of these might look like this:

Model Cache Holder (the Model Adapter Factory
(strong reference)
Model Cache
(soft reference)
Model
(strong reference)
Resource Resolver
(strong reference, maybe indirectly)
Resource [the adaptable]


The resource is strongly or softly referenced, possibly indirectly, making
it ineligible for collection on normal GC cycles. The resource & resolver,
will not be collected until after the model is collected. Since the model
is not collected until there is memory pressure, that would explain why you
are seeing this (expensive) GC behavior.

When memory pressure occurs, first the models (soft references) are
collected prior to the OOM, which releases both resolver (no longer
referenced via field in the model) and resource.

The quickest fix is to release the resource resolver at the end of the
model’s constructor or @PostConstruct [2]. Alternatively, you can eliminate
the cache=true, provided it does not negatively impact your application
performance.
Another option, though more involved, is that the entire caching impl could
be changed to better handle these kinds of reference loops, by putting the
cache in the adaptable itself (Resolver, Resource, Request, etc). Possible
good candidates of these are [4] or request attributes. [4] seems to be the
overall best candidate, especially since you can hook into it using
Closeable ([5]) improving the cache eviction even more.

As long as the object holding the cache is not referenced strongly outside
that reference loop (cache holder > cache > model > ... > cache holder),
then the loop's objects would be eligible for GC as soon as the cache
holder is eligible.

[1]:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ref/SoftReference.html
[2]:
https://sling.apache.org/documentation/bundles/models.html#a-note-about-cache-true-and-using-the-self-injector
[3]: https://github.com/apache/sling-org-apache-sling-models-impl/pull/18
[4]:
https://github.com/apache/sling-org-apache-sling-api/blob/master/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L888
[5]:
https://github.com/apache/sling-org-apache-sling-api/blob/master/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L610

// Paul


On Tue, Jan 23, 2024 at 6:48 AM Jörg Hoh 
wrote:

> Hi Sling community,
>
> I want to share a recent experience I had with Sling Models, Sling Model
> caching and Garbage Collection problems.
>
> I had a case, where an AEM instance had massive garbage collection
> problems, but no memory problems. We saw the regular sawtooth pattern in
> the heap consumption, but heavy GC activity (in a stop-the-world manner)
> almost constantly. But no OutOfMemory situation, there it's not a memory
> leak.
>
> I manually captured a heapdump and found a lot of Sling models being
> referenced by the Sling ModelAdapterFactory cache, and rechecking these
> model classes in detail I found them to specify "cache=true" in their
> @Model annotation.When these statements were removed, the situation looks
> completely different, and the garbage collection was normal again.
>
> I don't have a full explanation for this behavior yet. The Sling Models had
> a reference to a ResourceResolver (which was properly closed), but I assume
> that this reference somehow "disabled" the cleaning of the cache on major
> GCs (as its a WeakHashMap), but tied the collection of these models to the
> collection of the ResourceResolver objects, which have finalizers
> registered. And finalizers are only executed under memory pressure. Having
> this connetion might have led to the situation that the SlingModel objects
> were not disposed eagerly, but only alongside the finalizers in situation
> of high memory pressure in a "stop-the-world" situation.
>
> I try to get some more examples for that behavior; but I am not sure of the
> caching of Sling Models as-is is something we should continue to use. This
> case was quite hard to crack, and I don't know if/how we can avoid such a
> situation by design.
>
> Jörg
>
> --
> https://cqdump.joerghoh.de
>