Derby
  1. Derby
  2. DERBY-3650

internal multiple references from different rows to a single BLOB/CLOB stream leads to various errors when second reference used.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.3.3.0, 10.4.1.3, 10.5.3.0, 10.6.1.0
    • Fix Version/s: 10.6.1.0
    • Component/s: Network Client, SQL, Store
    • Environment:
      Mac OSX 10.4
      JDK 1.5.0_13
      Hibernate EntityManager 3.2.1
    • Urgency:
      Normal
    • Issue & fix info:
      Known fix, Repro attached
    • Bug behavior facts:
      Regression

      Description

      Derby + Hibernate JPA 3.2.1 problem on entity with Blob/Clob

      Hi,

      I'm using Derby in Client - Server mode with Hibernate JPA EJB 3.0.
      When a query on an entity containing a Clob and some joins on other entites is executed, an exception with the following message is thrown:
      XJ073: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, or its connection is closed.

      This problem occurs when the property "hibernate.max_fetch_depth" is greater than 0.
      When hibernate.max_fetch_depth=0, the query works.

      If Derby is configured in embedded mode, the query works independently of the value of hibernate.max_fetch_depth.

      On the Hibernate's documentation, the advised value of hibernate.max_fetch_depth is 3.
      Could you explain me if I made something wrong ?

      Thank you.
      Stephane

      1. ASF.LICENSE.NOT.GRANTED--derby-3650-preliminary_2_reworked-1b.diff
        5 kB
        Kristian Waagan
      2. derby-3650-preliminary_2_reworked.diff
        5 kB
        Kristian Waagan
      3. cloning-methods.html
        5 kB
        Kristian Waagan
      4. derby-3650-preliminary_2_diff.txt
        44 kB
        Mike Matrigali
      5. derby-3650-preliminary_diff.txt
        35 kB
        Mike Matrigali
      6. derby-3650_tests_diff.txt
        8 kB
        Kathey Marsden
      7. Derby3650FullClientRepro.java
        2 kB
        Kathey Marsden
      8. traces_on_FormatIdStream_alloc.txt
        4 kB
        Kathey Marsden
      9. UnionAll.java
        2 kB
        Kathey Marsden
      10. Derby3650FullRepro.java
        2 kB
        Kathey Marsden
      11. Derby3650EmbeddedRepro.java
        1 kB
        Kathey Marsden
      12. testdb.zip
        124 kB
        Kristian Waagan
      13. Derby3650Repro.java
        1 kB
        Kristian Waagan
      14. DerbyHibernateTest.zip
        89 kB
        Golgoth 14

        Issue Links

          Activity

          Gavin made changes -
          Workflow jira [ 12429999 ] Default workflow, editable Closed status [ 12802816 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Kathey Marsden made changes -
          Link This issue is required by DERBY-4994 [ DERBY-4994 ]
          Kathey Marsden made changes -
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Resolved [ 5 ]
          Kathey Marsden made changes -
          Labels derby_backport_reject_10_5
          Kathey Marsden made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Kathey Marsden made changes -
          Link This issue is required by DERBY-4994 [ DERBY-4994 ]
          Kristian Waagan made changes -
          Affects Version/s 10.5.3.0 [ 12314117 ]
          Affects Version/s 10.6.0.0 [ 12313727 ]
          Kristian Waagan made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Issue & fix info [Known fix, Patch Available, Repro attached] [Known fix, Repro attached]
          Assignee Kristian Waagan [ kristwaa ]
          Fix Version/s 10.6.0.0 [ 12313727 ]
          Resolution Fixed [ 1 ]
          Kristian Waagan made changes -
          Kristian Waagan made changes -
          Issue & fix info [Known fix, Repro attached] [Known fix, Patch Available, Repro attached]
          Kristian Waagan made changes -
          Attachment derby-3650-preliminary_2_reworked.diff [ 12436999 ]
          Kristian Waagan made changes -
          Link This issue is related to DERBY-4520 [ DERBY-4520 ]
          Dag H. Wanvik made changes -
          Comment [ Ok, bear with me if I misunderstand issues here, still trying to grok
          this, but I'll weigh in just to get some discussion going.

          I looked at the clone methods, and it seems to me that originally
          there was getClone, and that cloneObject was introduced later to avoid
          always materializing large objects into many copies. The naming is not
          good, the names imply the same behavior, I think. cloneObject is
          shallow in the sense that it does not clone the *value*, nor does it
          clone the *stream state*, if any. (Btw, the implementation of
          SQLChar#cloneObject could be simplified to look the same as
          SQLBinary#cloneObject).

          Now, if I understand correctly, the new method, CopyForRead is slightly
          *less shallow*, in that you now also copy the stream state.

          For non-stream data types, cloneObject defaults to getClone (deep
          copy).

          I would suggest we change the names here to clarify code and APIs, the
          better to reflect the shallowness of the cloning.

                  cloneDeep (old getClone; clones even *value*, share nothing)
                  cloneHalfDeep (new CopyForRead, clones even stream state,
                                      but not value, which is still shared)
                  cloneShallow (old cloneObject, clones just "holder", shares
                                stream/stream state)

          If the code really needs cloneShallow also, after cloneHalfDeep is
          added, I don't know, if not, I'd call cloneHalfDeep cloneShallow
          instead ;)

          Now, for modification, what to use? I guess that depends on what
          semantics are desired/at what level in the code you are..? If the
          change should logically be reflected in other aliases (alias to same
          column value), say after an update of a column, I guess we could
          invalidate/close existing streams to that value if any exists so as to
          avoid inconsistencies? Or maybe we could just do COW semantics?
          I.e. use cloneHalfDeep until update is attempted and only then do
          a full deep clone? (by overloading stream class perhaps) Then the
          updating of the deep copy could proceed until the column is actually
          updated without affecting the other aliases?

          Again, sorry if I badly garbled this.. ;)
          ]
          Kristian Waagan made changes -
          Attachment cloning-methods.html [ 12427194 ]
          Knut Anders Hatlen made changes -
          Link This issue is related to DERBY-2111 [ DERBY-2111 ]
          Knut Anders Hatlen made changes -
          Assignee Mike Matrigali [ mikem ]
          Issue & fix info [Known fix, Repro attached]
          Component/s SQL [ 11408 ]
          Component/s Store [ 11412 ]
          Dag H. Wanvik made changes -
          Bug behavior facts [Regression]
          Mike Matrigali made changes -
          Attachment derby-3650-preliminary_2_diff.txt [ 12385169 ]
          Mike Matrigali made changes -
          Attachment derby-3650-preliminary_diff.txt [ 12385078 ]
          Mike Matrigali made changes -
          Description Hi,

          I'm using Derby in Client - Server mode with Hibernate JPA EJB 3.0.
          When a query on an entity containing a Clob and some joins on other entites is executed, an exception with the following message is thrown:
            XJ073: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, or its connection is closed.

          This problem occurs when the property "hibernate.max_fetch_depth" is greater than 0.
          When hibernate.max_fetch_depth=0, the query works.

          If Derby is configured in embedded mode, the query works independently of the value of hibernate.max_fetch_depth.

          On the Hibernate's documentation, the advised value of hibernate.max_fetch_depth is 3.
          Could you explain me if I made something wrong ?

          Thank you.
          Stephane
          Derby + Hibernate JPA 3.2.1 problem on entity with Blob/Clob

          Hi,

          I'm using Derby in Client - Server mode with Hibernate JPA EJB 3.0.
          When a query on an entity containing a Clob and some joins on other entites is executed, an exception with the following message is thrown:
            XJ073: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, or its connection is closed.

          This problem occurs when the property "hibernate.max_fetch_depth" is greater than 0.
          When hibernate.max_fetch_depth=0, the query works.

          If Derby is configured in embedded mode, the query works independently of the value of hibernate.max_fetch_depth.

          On the Hibernate's documentation, the advised value of hibernate.max_fetch_depth is 3.
          Could you explain me if I made something wrong ?

          Thank you.
          Stephane
          Summary Derby + Hibernate JPA 3.2.1 problem on entity with Blob/Clob internal multiple references from different rows to a single BLOB/CLOB stream leads to various errors when second reference used.
          Mike Matrigali made changes -
          Assignee Mike Matrigali [ mikem ]
          Kathey Marsden made changes -
          Derby Info [Regression, Patch Available] [Regression]
          Kathey Marsden made changes -
          Derby Info [Regression] [Patch Available, Regression]
          Kathey Marsden made changes -
          Attachment derby-3650_tests_diff.txt [ 12382148 ]
          Kathey Marsden made changes -
          Affects Version/s 10.3.2.2 [ 12312885 ]
          Kathey Marsden made changes -
          Affects Version/s 10.3.3.0 [ 12313142 ]
          Affects Version/s 10.3.2.2 [ 12312885 ]
          Kathey Marsden made changes -
          Link This issue is related to DERBY-2892 [ DERBY-2892 ]
          Kathey Marsden made changes -
          Derby Info [Regression]
          Kathey Marsden made changes -
          Attachment Derby3650FullClientRepro.java [ 12382050 ]
          Kathey Marsden made changes -
          Attachment traces_on_FormatIdStream_alloc.txt [ 12381341 ]
          Kathey Marsden made changes -
          Attachment UnionAll.java [ 12381265 ]
          Kathey Marsden made changes -
          Attachment Derby3650FullRepro.java [ 12381258 ]
          Kathey Marsden made changes -
          Attachment Derby3650EmbeddedRepro.java [ 12381211 ]
          Kristian Waagan made changes -
          Attachment testdb.zip [ 12381207 ]
          Attachment Derby3650Repro.java [ 12381206 ]
          Golgoth 14 made changes -
          Field Original Value New Value
          Attachment DerbyHibernateTest.zip [ 12381113 ]
          Golgoth 14 created issue -

            People

            • Assignee:
              Kristian Waagan
              Reporter:
              Golgoth 14
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development