Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-16062

Support binary HANLDEs: Unable read object array twice.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • Docs Required, Release Notes Required

    Description

      "Looks like this commit introduce a blocker.
      Second read of array field fail and read some garbage.
      This happen because when object read with handle stream position don't move to the end of already deserialized object.
      So second array element is just random bytes from the middle of the stream."

       

      Reproducer:

          /** */
          @Test
          public void testArrayFieldSeveralRead() throws Exception {
              try (Ignite ignite = startGrid(1)) {
                  TestClass1[] expArr = new TestClass1[] {new TestClass1(), new TestClass1()};
      
                  BinaryObject arrObj = ignite.binary().toBinary(new TestClsWithArray(expArr));
      
                  for (int i = 0; i < 10; i++)
                      Assert.assertArrayEquals(i + " iteration", expArr, PlatformUtils.unwrapBinariesInArray(arrObj.field("arr")));
      
                  arrObj = ignite.binary().builder(TestClsWithArray.class.getName()).setField("arr", expArr).build();
      
                  for (int i = 0; i < 10; i++)
                      Assert.assertArrayEquals(i + " iteration", expArr, PlatformUtils.unwrapBinariesInArray(arrObj.field("arr")));
              }
              finally {
                  clearBinaryMeta();
              }
          }
      
          /** Test class with array. */
          public static class TestClsWithArray {
              /** */
              private final Object[] arr;
      
              /** */
              public TestClsWithArray(TestClass1[] arr) {
                  this.arr = arr;
              }
          } 

      Attachments

        Issue Links

          Activity

            People

              vermakov Vladimir Ermakov
              vermakov Vladimir Ermakov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m