cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Fiol (JIRA)" <>
Subject [jira] Commented: (COCOON-1681) Generator "directory": Caching too much
Date Thu, 26 Jan 2006 06:40:10 GMT
    [ ] 

Antonio Fiol commented on COCOON-1681:

No, I am not  disabling the expiry check. This was a temporary workaround.

The code in isValid says something like:

if not yet expired (current time < expiry time) return VALID
expiry time = current time      <---- OFFENDING LINE
check filesystem and return INVALID if it really is INVALID
(as it is not invalid, and FS was already checked)
expiry time = current time
return VALID

What happens is that if it is called twice on an expired directory, the first time will return
INVALID, but will (incorrectly) update the expiry time.
So the second call will incorrectly return VALID, because it is not expired.

I agree that a single call to isValid() would be much better, but isValid should anyway be
implemented in a secure (consistent) manner. With our patch, if the cached version is invalid,
the FS is checked twice instead of the ideal "once". But if it is not expired, no FS check
is done, so it's quite different from disabling the expiry checks.

In any case, I liked your suggestion, and will try to provide the two stack frames, and I
will also post the patch today (we finished testing yesterday, and it works like a charm).

> Generator "directory": Caching too much
> ---------------------------------------
>          Key: COCOON-1681
>          URL:
>      Project: Cocoon
>         Type: Bug
>   Components: * Cocoon Core
>     Versions: 2.1.8, 2.1.7
>     Reporter: Antonio Fiol
>     Assignee: Jean-Baptiste Quenot

> In some cases, an update to the directory is not detected by the DirectoryGenerator.
> Debugging the issue, I discovered that isValid() is called twice on the same DirValidity,
but it returns different values (-1 the first time, 1 the second time).
> Apparently, the reason for the inconsistency would be solved by removing the first of
the two lines that update the expiry time in the isValid() method in DirValidity, but I am
not sure whether this could cause problems in other places.
> A possibility would be that a DirValidity stores the fact that it already detected it
is invalid, and is changed so that it always return -1. But... Are DirValidity objects reused?
Could this change cause problems? I have not tested, so I don't know.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message