Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1238

Thrift JS client cannot read map of structures

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      Apparently we have a problem reading map of structures, only one item is been read and the other come as undefined in the result map on the client side.

      I was having this with some complex maps and notice that the test case 'testInsanity' was quite similar to my case but was actually been tested at all. Then checking its result I could see that's it actually a general problem.

      The server sends 2 elements:

      {
          "1":{
              "3":{
                  "userMap":{
                      "8":8,
                      "5":5
                  },
                  "xtructs":[{
                          "string_thing":"Goodbye4",
                          "byte_thing":4,
                          "i32_thing":4,
                          "i64_thing":4
                      },
                      {
                          "string_thing":"Hello2",
                          "byte_thing":2,
                          "i32_thing":2,
                          "i64_thing":2
                      }
                  ]
              },
              "2":{
                  "userMap":{
                      "8":8,
                      "5":5
                  },
                  "xtructs":[{
                          "string_thing":"Goodbye4",
                          "byte_thing":4,
                          "i32_thing":4,
                          "i64_thing":4
                      },
                      {
                          "string_thing":"Hello2",
                          "byte_thing":2,
                          "i32_thing":2,
                          "i64_thing":2
                      }
                  ]
              }
          },
          "2":{
              "6":{
                  "userMap":null,
                  "xtructs":null
              }
          }
      }
      

      but we can only read 1:

      {
          "1":{
              "2":{
                  "userMap":{
                      "8":8,
                      "5":5
                  },
                  "xtructs":[{
                          "string_thing":"Goodbye4",
                          "byte_thing":4,
                          "i32_thing":4,
                          "i64_thing":4
                      },
                      {
                          "string_thing":"Hello2",
                          "byte_thing":2,
                          "i32_thing":2,
                          "i64_thing":2
                      }
                  ]
              },
              "undefined":{
                  "userMap":null,
                  "xtructs":null
              }
          },
          "2":{
              "6":{
                  "userMap":null,
                  "xtructs":null
              }
          }
      }
      

      on my code it also happens with 3 or more structures, only the first one is read, the second is "undefined" and the rest is gone!

      ps.: I'm submitting the patch for the unit test. I had a quick look on the code but could find anything yet and won't have time in the next weeks...

      Attachments

        1. THRIFT-1238-fix-maps+qunit.patch
          4 kB
          Henrique Mendonca
        2. THRIFT-1238-qunit-insanity.patch
          3 kB
          Henrique Mendonca

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            henrique Henrique Mendonca
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment