ZK CE SimpleDesktopCache.getDesktopIfAny condition raise

asked 2022-07-18 20:18:51 +0800

nsaazn gravatar image nsaazn
25 3

updated 2022-07-18 23:17:32 +0800

Method saves old value of AtomicBoolean outside of synchroization block:

public Desktop getDesktopIfAny(String desktopId) {
    final boolean old = _desktops.disableExpunge(true);
    try {
        synchronized (_desktops) {
            return _desktops.get(desktopId);
    } finally {

This may cause condition raise and old value become true. This will cause that dasktop cache never expunged.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-07-20 17:10:07 +0800

MDuchemin gravatar image MDuchemin
2390 1 6
ZK Team

updated 2022-07-20 17:13:32 +0800

The boolean declaration used to be inside of the synchronized block until ZK 7.0.6, and was moved out at that point. This is an intentional change, not a side effect of another change.

Most likely, the previous implementation was causing a dead-lock in serialization / deserialization.

Did you encounter a case desktop cache would fail to expunge (is this a live problem)? or did you see this from review at the moment?

This could be a minor memory leak, potentially. By default, the SessionDesktopCacheProvider will store the desktop cache as a session property. If the cache for a specific user no longer expunge, it will still be destroyed when the session is destroyed.

link publish delete flag offensive edit


Trouble is save an old value that can be true (expungr disabled). In finally block code may restore true value, than expunge never happens. As example to reproduce create the iframe on a page. Posiible fix: if (!old) desableExpunge(old) to prevent enabling expunge if someone else disabled expunge

nsaazn ( 2022-07-20 20:54:04 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2022-07-18 20:18:51 +0800

Seen: 9 times

Last updated: Jul 20 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More