Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: cocoon-pipeline
    • Labels:
      None

      Description

      After startup, any pipeline/matcher ending in an xml-serializer will
      produce the output of the first request after server startup, regardless of the url, let alone parameters.
      So the first xml pipe that is activated produces the expected output.
      All subsequent calls will echo that output, whatever the url or parameters.
      It takes a server restart to make a pipeline ending in an xml serializer work again.

        Activity

        Hide
        Jos Snellings added a comment -
        The observed problem was due to using a SimpleCacheKey.
        It remains a strange fact that this is only observed when the end point is an XMLSerializer.
        Show
        Jos Snellings added a comment - The observed problem was due to using a SimpleCacheKey. It remains a strange fact that this is only observed when the end point is an XMLSerializer.
        Hide
        Jos Snellings added a comment -
        ParameterCacheKey, constructed with the request parameters effectively cures the problem.
        This issue is closed!

        Suggestion:
        Developers starting out with cocoon 3 are very much likely to leave the routine "constructCacheKey()"
        as they find it. It would be good to provide a lightly annotated example in the samples! I will post one.
        Show
        Jos Snellings added a comment - ParameterCacheKey, constructed with the request parameters effectively cures the problem. This issue is closed! Suggestion: Developers starting out with cocoon 3 are very much likely to leave the routine "constructCacheKey()" as they find it. It would be good to provide a lightly annotated example in the samples! I will post one.
        Hide
        Reinhard Poetz added a comment -
        The cache key has to contain everything that influences the output produced by the generator.

        I have no idea why HTML serialization makes a difference, but again, the logs should give you some hints.
        Show
        Reinhard Poetz added a comment - The cache key has to contain everything that influences the output produced by the generator. I have no idea why HTML serialization makes a difference, but again, the logs should give you some hints.
        Hide
        Jos Snellings added a comment -
        Yes, I thought about that, SimpleCacheKey is all too Simple. I kept it mainly because it was in the samples:
        it is not expected that a generator produces the same result.
        but why do pipelines with the same Starters (Termgenerator or WorkspaceProvider) are perfectly OK with the cache when they end in html serialization?
        Anyway, I will use a parameter cache and verify the cache behaviour is correct. If it does, I close this issue.
        Show
        Jos Snellings added a comment - Yes, I thought about that, SimpleCacheKey is all too Simple. I kept it mainly because it was in the samples: it is not expected that a generator produces the same result. but why do pipelines with the same Starters (Termgenerator or WorkspaceProvider) are perfectly OK with the cache when they end in html serialization? Anyway, I will use a parameter cache and verify the cache behaviour is correct. If it does, I close this issue.
        Hide
        Reinhard Poetz added a comment -
        Both generators (TermGenerator and WorkspaceProvider) create a SimpleCacheKey. A SimpleCacheKey is always valid and the equals method only checks the passed object is of type SimpleCacheKey. It is used for components that always create the same result if the passed events are the same (i.e. there are no external influences)

        You should use some other cache key implementation: Have a look at ParameterCacheKey or TimestampCacheKey.
        Show
        Reinhard Poetz added a comment - Both generators (TermGenerator and WorkspaceProvider) create a SimpleCacheKey. A SimpleCacheKey is always valid and the equals method only checks the passed object is of type SimpleCacheKey. It is used for components that always create the same result if the passed events are the same (i.e. there are no external influences) You should use some other cache key implementation: Have a look at ParameterCacheKey or TimestampCacheKey.
        Hide
        Jos Snellings added a comment -
        Cocoon 3, checked out from SVN on 5 march, and built with eclipse.
        Detail: three urls, activating a pipe ending with an xml serializer. (Note: all other pipes work correctly as far as I could verify)

        http://localhost:8080/thesaurus/hierarchies?language=el, result = the greek hierarchies in the thesaurus
        http://localhost:8080/thesaurus/showterm.xml?id=1004, visualize a term
        http://localhost:8080/thesaurus/editor/workspace.xml?random=23948783
        Here is what happens:
        SETUP, manufacturing cacheKey:
          ~ adding SimpleCacheKey(hashCode=3116185) for component ToptermsGenerator(hashCode=21535750)
          ~ adding org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 for component XMLSerializer(hashCode=10730286)
        Creating CompoundCacheKey(hashCode=22406408 key=[SimpleCacheKey(hashCode=3116185), org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142]) for pipeline CachingPipeline(hashCode=33258683 components=[ToptermsGenerator(hashCode=21535750), XMLSerializer(hashCode=10730286)])

        SETTING CACHE: org.apache.cocoon.pipeline.caching.SimpleCache (CachingPipeline.setCache() called)

        SETUP, manufacturing cacheKey for 2nd:
          ~ adding SimpleCacheKey(hashCode=4540490) for component TermGenerator(hashCode=16199287)
          ~ adding org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 for component XMLSerializer(hashCode=23533966)
        Creating CompoundCacheKey(hashCode=16471030 key=[SimpleCacheKey(hashCode=4540490), org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142]) for pipeline CachingPipeline(hashCode=772032 components=[TermGenerator(hashCode=16199287), XMLSerializer(hashCode=23533966)])
        The value is "FOUND" in cache!!!, Here is the xml for: cacheValue.writeTo(System.out):
        JDB: CachingPipeline Write cache value to output stream:
        <?xml version="1.0" encoding="UTF-8"?><page><searchform/><classlist><class name="Ομάδα 1 - Οργανισμοί και Φορείς"><top id="9001">κυβέρνηση / διοίκηση</top><top id="9029">οργανισμοί</top><top id="9056">φορείς</top></class><class name="Ομάδα 2 - Κατηγορίες Πολιτιστικής Κληρονομιάς"><top id="9085">πολιτιστικό αγαθό</top><top id="9115">περιοχές</top><top id="9149">ενδιαφέρον πολιτιστικής κληρονομιάς</top><top id="9166">κληρονομιά</top></class><class name="Ομάδα 3 - Συστήματα Αρχειοθέτησης"><top id="9194">καταγραφή και τεκμηρίωση</top><top id="9215">αρχεία καταγραφής</top><top id="9222">κατάλογος προστατευόμενων αγαθών</top></class><class name="Ομάδα 4 - Νομικά συστήματα"><top id="9225">νομικά μέσα</top><top id="9250">πολεοδομικό σύστημα</top><top id="9273">διαχείριση κληρονομιάς</top><top id="9327">ιδιοκτησία</top><top id="9355">παράνομες ενέργειες</top></class><class name="Ομάδα 5 - Επεμβάσεις"><top id="9362">τύποι επεμβάσεων</top><top id="9413">πολιτική επεμβάσεων</top><top id="9416">προγράμματα επεμβάσεων</top><top id="9421">εργαλεία επέμβασης</top></class><class name="Ομάδα 6 - Επαγγέλματα, δεξιότητες και αρμοδιότητες"><top id="9430">επαγγέλματα</top><top id="9432">δεξιότητες</top><top id="9437">εκπαίδευση / επιμόρφωση</top></class><class name="Ομάδα 7 - Πρόσβαση και ερμηνεία"><top id="9449">πρόσβαση και ερμηνεία</top></class><class name="Ομάδα 8 - Χρηματο-οικονομικά συστήματα"><top id="9491">χρηματο-οικονομικά συστήματα</top></class><class name="Ομάδα 9 - Γενικές έννοιες"><top id="9521">γενικές έννοιες</top></class></classlist></page>SETTING CACHE: org.apache.cocoon.pipeline.caching.SimpleCache

        Surprise! The Greek hierarchies!

        SETUP, now the call of "workspace":
          ~ adding SimpleCacheKey(hashCode=30181678) for component WorkspaceProvider(hashCode=27011377)
          ~ adding org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 for component XMLSerializer(hashCode=28014118)
        Creating CompoundCacheKey(hashCode=31048679 key=[SimpleCacheKey(hashCode=30181678), org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142]) for pipeline CachingPipeline(hashCode=22316052 components=[WorkspaceProvider(hashCode=27011377), XMLSerializer(hashCode=28014118)])
        JDB: CachingPipeline Write cache value to output stream:
        <?xml version="1.0" encoding="UTF-8"?><page><searchform/><classlist><class name="Ομάδα 1 - Οργανισμοί και Φορείς"><top id="9001">κυβέρνηση / διοίκηση</top><top id="9029">οργανισμοί</top><top id="9056">φορείς</top></class><class name="Ομάδα 2 - Κατηγορίες Πολιτιστικής Κληρονομιάς"><top id="9085">πολιτιστικό αγαθό</top><top id="9115">περιοχές</top><top id="9149">ενδιαφέρον πολιτιστικής κληρονομιάς</top><top id="9166">κληρονομιά</top></class><class name="Ομάδα 3 - Συστήματα Αρχειοθέτησης"><top id="9194">καταγραφή και τεκμηρίωση</top><top id="9215">αρχεία καταγραφής</top><top id="9222">κατάλογος προστατευόμενων αγαθών</top></class><class name="Ομάδα 4 - Νομικά συστήματα"><top id="9225">νομικά μέσα</top><top id="9250">πολεοδομικό σύστημα</top><top id="9273">διαχείριση κληρονομιάς</top><top id="9327">ιδιοκτησία</top><top id="9355">παράνομες ενέργειες</top></class><class name="Ομάδα 5 - Επεμβάσεις"><top id="9362">τύποι επεμβάσεων</top><top id="9413">πολιτική επεμβάσεων</top><top id="9416">προγράμματα επεμβάσεων</top><top id="9421">εργαλεία επέμβασης</top></class><class name="Ομάδα 6 - Επαγγέλματα, δεξιότητες και αρμοδιότητες"><top id="9430">επαγγέλματα</top><top id="9432">δεξιότητες</top><top id="9437">εκπαίδευση / επιμόρφωση</top></class><class name="Ομάδα 7 - Πρόσβαση και ερμηνεία"><top id="9449">πρόσβαση και ερμηνεία</top></class><class name="Ομάδα 8 - Χρηματο-οικονομικά συστήματα"><top id="9491">χρηματο-οικονομικά συστήματα</top></class><class name="Ομάδα 9 - Γενικές έννοιες"><top id="9521">γενικές έννοιες</top></class></classlist></page>

        Surprise: the Greek hierarchies come again! Although the cache key is different in all three cases.
        So the thing to do is here to make the cache break news about its members and keys, and how equality is decided.

        By the way:
        1. jmx-group-name plays no role herein as expected
        2. should the url not be included in a key hash?




        Show
        Jos Snellings added a comment - Cocoon 3, checked out from SVN on 5 march, and built with eclipse. Detail: three urls, activating a pipe ending with an xml serializer. (Note: all other pipes work correctly as far as I could verify) http://localhost:8080/thesaurus/hierarchies?language=el, result = the greek hierarchies in the thesaurus http://localhost:8080/thesaurus/showterm.xml?id=1004, visualize a term http://localhost:8080/thesaurus/editor/workspace.xml?random=23948783 Here is what happens: SETUP, manufacturing cacheKey:   ~ adding SimpleCacheKey(hashCode=3116185) for component ToptermsGenerator(hashCode=21535750)   ~ adding org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 for component XMLSerializer(hashCode=10730286) Creating CompoundCacheKey(hashCode=22406408 key=[SimpleCacheKey(hashCode=3116185), org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 ]) for pipeline CachingPipeline(hashCode=33258683 components=[ToptermsGenerator(hashCode=21535750), XMLSerializer(hashCode=10730286)]) SETTING CACHE: org.apache.cocoon.pipeline.caching.SimpleCache (CachingPipeline.setCache() called) SETUP, manufacturing cacheKey for 2nd:   ~ adding SimpleCacheKey(hashCode=4540490) for component TermGenerator(hashCode=16199287)   ~ adding org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 for component XMLSerializer(hashCode=23533966) Creating CompoundCacheKey(hashCode=16471030 key=[SimpleCacheKey(hashCode=4540490), org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 ]) for pipeline CachingPipeline(hashCode=772032 components=[TermGenerator(hashCode=16199287), XMLSerializer(hashCode=23533966)]) The value is "FOUND" in cache!!!, Here is the xml for: cacheValue.writeTo(System.out): JDB: CachingPipeline Write cache value to output stream: <?xml version="1.0" encoding="UTF-8"?><page><searchform/><classlist><class name="Ομάδα 1 - Οργανισμοί και Φορείς"><top id="9001">κυβέρνηση / διοίκηση</top><top id="9029">οργανισμοί</top><top id="9056">φορείς</top></class><class name="Ομάδα 2 - Κατηγορίες Πολιτιστικής Κληρονομιάς"><top id="9085">πολιτιστικό αγαθό</top><top id="9115">περιοχές</top><top id="9149">ενδιαφέρον πολιτιστικής κληρονομιάς</top><top id="9166">κληρονομιά</top></class><class name="Ομάδα 3 - Συστήματα Αρχειοθέτησης"><top id="9194">καταγραφή και τεκμηρίωση</top><top id="9215">αρχεία καταγραφής</top><top id="9222">κατάλογος προστατευόμενων αγαθών</top></class><class name="Ομάδα 4 - Νομικά συστήματα"><top id="9225">νομικά μέσα</top><top id="9250">πολεοδομικό σύστημα</top><top id="9273">διαχείριση κληρονομιάς</top><top id="9327">ιδιοκτησία</top><top id="9355">παράνομες ενέργειες</top></class><class name="Ομάδα 5 - Επεμβάσεις"><top id="9362">τύποι επεμβάσεων</top><top id="9413">πολιτική επεμβάσεων</top><top id="9416">προγράμματα επεμβάσεων</top><top id="9421">εργαλεία επέμβασης</top></class><class name="Ομάδα 6 - Επαγγέλματα, δεξιότητες και αρμοδιότητες"><top id="9430">επαγγέλματα</top><top id="9432">δεξιότητες</top><top id="9437">εκπαίδευση / επιμόρφωση</top></class><class name="Ομάδα 7 - Πρόσβαση και ερμηνεία"><top id="9449">πρόσβαση και ερμηνεία</top></class><class name="Ομάδα 8 - Χρηματο-οικονομικά συστήματα"><top id="9491">χρηματο-οικονομικά συστήματα</top></class><class name="Ομάδα 9 - Γενικές έννοιες"><top id="9521">γενικές έννοιες</top></class></classlist></page>SETTING CACHE: org.apache.cocoon.pipeline.caching.SimpleCache Surprise! The Greek hierarchies! SETUP, now the call of "workspace":   ~ adding SimpleCacheKey(hashCode=30181678) for component WorkspaceProvider(hashCode=27011377)   ~ adding org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 for component XMLSerializer(hashCode=28014118) Creating CompoundCacheKey(hashCode=31048679 key=[SimpleCacheKey(hashCode=30181678), org.apache.cocoon.pipeline.caching.ParameterCacheKey@f91f7142 ]) for pipeline CachingPipeline(hashCode=22316052 components=[WorkspaceProvider(hashCode=27011377), XMLSerializer(hashCode=28014118)]) JDB: CachingPipeline Write cache value to output stream: <?xml version="1.0" encoding="UTF-8"?><page><searchform/><classlist><class name="Ομάδα 1 - Οργανισμοί και Φορείς"><top id="9001">κυβέρνηση / διοίκηση</top><top id="9029">οργανισμοί</top><top id="9056">φορείς</top></class><class name="Ομάδα 2 - Κατηγορίες Πολιτιστικής Κληρονομιάς"><top id="9085">πολιτιστικό αγαθό</top><top id="9115">περιοχές</top><top id="9149">ενδιαφέρον πολιτιστικής κληρονομιάς</top><top id="9166">κληρονομιά</top></class><class name="Ομάδα 3 - Συστήματα Αρχειοθέτησης"><top id="9194">καταγραφή και τεκμηρίωση</top><top id="9215">αρχεία καταγραφής</top><top id="9222">κατάλογος προστατευόμενων αγαθών</top></class><class name="Ομάδα 4 - Νομικά συστήματα"><top id="9225">νομικά μέσα</top><top id="9250">πολεοδομικό σύστημα</top><top id="9273">διαχείριση κληρονομιάς</top><top id="9327">ιδιοκτησία</top><top id="9355">παράνομες ενέργειες</top></class><class name="Ομάδα 5 - Επεμβάσεις"><top id="9362">τύποι επεμβάσεων</top><top id="9413">πολιτική επεμβάσεων</top><top id="9416">προγράμματα επεμβάσεων</top><top id="9421">εργαλεία επέμβασης</top></class><class name="Ομάδα 6 - Επαγγέλματα, δεξιότητες και αρμοδιότητες"><top id="9430">επαγγέλματα</top><top id="9432">δεξιότητες</top><top id="9437">εκπαίδευση / επιμόρφωση</top></class><class name="Ομάδα 7 - Πρόσβαση και ερμηνεία"><top id="9449">πρόσβαση και ερμηνεία</top></class><class name="Ομάδα 8 - Χρηματο-οικονομικά συστήματα"><top id="9491">χρηματο-οικονομικά συστήματα</top></class><class name="Ομάδα 9 - Γενικές έννοιες"><top id="9521">γενικές έννοιες</top></class></classlist></page> Surprise: the Greek hierarchies come again! Although the cache key is different in all three cases. So the thing to do is here to make the cache break news about its members and keys, and how equality is decided. By the way: 1. jmx-group-name plays no role herein as expected 2. should the url not be included in a key hash?
        Hide
        Jos Snellings added a comment -
        - No, I cannot say your test is wrong. The test clearly shows that the right response is returned from the cache
        - It must be somehow 'subtle'
        - Yesterday I looked into CachingPipeline and I found everything sound
        - Yet my test case on a browser stands. If you want I can describe it in detail
        ==> the next candidate to look at is simplecache. It is hard to imagine what can go wrong here, as it is based upon a map.
        The only thing I can imagine:
        - could it be that there is a situation where different cache keys map onto the same content?
        - my pipes have no jmxname. Can that be a problem? I think not.
        ==> the thing to do is probably: I try put a finger on the problem at my side and deliver a very specific test case, for I believe
          the problem is quite specific.
         I will keep this group posted.
        Show
        Jos Snellings added a comment - - No, I cannot say your test is wrong. The test clearly shows that the right response is returned from the cache - It must be somehow 'subtle' - Yesterday I looked into CachingPipeline and I found everything sound - Yet my test case on a browser stands. If you want I can describe it in detail ==> the next candidate to look at is simplecache. It is hard to imagine what can go wrong here, as it is based upon a map. The only thing I can imagine: - could it be that there is a situation where different cache keys map onto the same content? - my pipes have no jmxname. Can that be a problem? I think not. ==> the thing to do is probably: I try put a finger on the problem at my side and deliver a very specific test case, for I believe   the problem is quite specific.  I will keep this group posted.
        Show
        Reinhard Poetz added a comment - I can't reproduce your problem: see #testCachingOfDifferentPipelines() http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/CachingOfPipelinesTest.java The pipeline can be found at http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/sitemap.xmap, lines 50 - 56. Is my test wrong?
        Hide
        Jos Snellings added a comment -
        This is only true for CachingPipeline!
        AsyncCachingPipeline is not affected.
        Show
        Jos Snellings added a comment - This is only true for CachingPipeline! AsyncCachingPipeline is not affected.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jos Snellings
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development