Uploaded image for project: 'Giraph (Retired)'
  1. Giraph (Retired)
  2. GIRAPH-125

Bug in LongDoubleFloatDoubleVertex.sendMsgToAllEdges()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.1.0
    • 0.1.0
    • graph

    Description

      I just found a bug in the sendMsgToAllEdges() function of the LongDoubleFloatDoubleVertex class. The segment of the code that contains the bug is:

      final LongWritable destVertex = new LongWritable();
      final MutableVertex<LongWritable, DoubleWritable, FloatWritable,
      DoubleWritable> vertex = this;
      verticesWithEdgeValues.forEachKey(new LongProcedure() {
      @Override
      public boolean apply(long destVertexId)

      { destVertex.set(destVertexId); vertex.sendMsg(destVertex, msg); return true; }

      });

      Here destVertex is a final object, but this single object is reused in the forEachKey function many times. Each time its actual value is changed but the same object is put to the underlying message list (a hashmap) through vertex.sendMsg. Because the single destVertex object has been put into the underlying hashmap again and again, destVertex.set(destVertexId) will change the existing keys in the hashmap. Eventually, every keys added to the hash map will have the same value as the last key.

      A simple fix is as follows:

      final MutableVertex<LongWritable, DoubleWritable, FloatWritable,
      DoubleWritable> vertex = this;
      verticesWithEdgeValues.forEachKey(new LongProcedure() {
      @Override
      public boolean apply(long destVertexId)

      { vertex.sendMsg(new LongWritable(destVertexId), msg); return true; }

      });

      Attachments

        Activity

          People

            humming80 Yuanyuan Tian
            humming80 Yuanyuan Tian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified