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

repeated runs of compiler produce different binary output at plugin interface



    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.12.0
    • Component/s: Compiler (General)
    • Labels:
    • Environment:

      Ubuntu 16.04, Linux amd64, but generally applicable


      TL;DR the plugin interface produces serialized thrift objects containing integers derived from addresses; this results in repeated runs producing differing output, and that's unpleasant. This is easy to test and easy to fix.

      Longer: The plugin interface is really nice, and I'd like to use it for more things. One problem with it, is that from run-to-run, the data given to the plugin can and does change, b/c there are "ids" (e.g. "t_type_id") that are derived from pointer-addresses inside the compiler. It'd be nice to replace those with generated integers starting at a fixed base. In short, instead of random integers scattered thru the plugin, we'd get (say) numbers starting at 1000000 and consecutively increasing. Each different kind of ID would start at that same base, and the assignment would be based on how the "converter" from internal types to thrift types walked the data-structure. Which should be deterministic. So that would give a determinsitic output to the plugin.

      This is easy to unit-test: just use /bin/cat as a plugin and compare subsequent runs.

      I'll write a unit-test and then a patch.




            • Assignee:
              jking3 James E. King III
              chetmurthy Chet Murthy
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: