Bug in the ReplicationDHTService

Home Forums PeerfactSim Forum Bug in the ReplicationDHTService

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #957
    Dennis
    Guest

    Within the class ReplicationOperation the list of peers that are used
    to store replicates is send to other peers. But sadly the list is not
    cloned/copied.
    I’m talking about the replicatorNodes list in the ReplicationOperation
    class. At line 108/109 this list put into a StoreReplicationMessage.
    From there on the list is passed to the method
    handleStoreReplicationMessage of ReplicationDHTService class. This
    method puts the list into a ReplicationDHTObject. When a new root for
    a file has to be selected, the list from this ReplicationDHTObject is
    altered by the the method handleNewRootMessage of the
    ReplicationDHTSerivce class. Because the list is not cloned/copied at
    any point, all variables along the way point to the same list. Since
    only the reference is copied.
    During the handleNewRootMessage method an item of the list is deleted.
    Because the recipient list of the RelationOperation class is in some
    cases equal to the replicatorNodes list, it can come to a
    IndexOfOutBounceException in the method sendMessageSucceeded and
    sendMessageFailed of the ReplicationOperation class. Because the
    message number of recipients is no longer equal to the number of
    messages that were sent.
    I think I solved the problem by creating copies of the list every time
    it is send.
    If needed I could post a description how to recreate this problem/the
    exception

    #958
    Dennis
    Guest

    To be more precise how I solved the problem:
    In the constructor of the classes ReplicationOperation,
    StoreReplicationMessage, ReplicationDHTObject and
    KeepReplicationMessage I created a copy of the list of duplicate
    holders.
    Since StoreReplicationMessage and KeepReplicationMessage are message
    classes it is obvious why the list should be copied. The list that is
    passed to the ReplicationOperation upon creation needs to be copied
    because otherwise it could be the same list as in a
    ReplicationDHTObject (see handleNewRootMessage in the
    ReplicationDHTService class). I although created a copy of the list in
    the ReplicationDHTObject because the list should not be equal to the
    list of the message. It is possible that the list of the message is
    only passed on to the ReplicationDHTObject and therefore not copy
    needs to be created, but I did not check this case.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Comments are closed.