Ticket #25 (new defect)
Opened 1 year ago
FIND_PRE REQUEST message type
| Reported by: | jordi | Owned by: | nobody |
|---|---|---|---|
| Priority: | major | Milestone: | 3.1 |
| Component: | planetsim | Version: | PlanetSim 3 |
| Keywords: | Chord protocol message | Cc: |
Description
Reported by Filipe in the planetsim-devel list:
Effects: put full the node's message queue (possibly an infinite loop).
I think that the problem is deeper than that. I still didn't understand the entire ChordNode? implementation, but I think that the problem results from a FIND_PRE REQUEST message being sent over and over again from a node to itself (each message fires a new one), when the node is fixing the finger tables. More precisely, from
findPredecessor
message goes to the function
dispatcher
(of the same node) and to the following lines in the case FIND_PRE
} else {
//next node
NodeHandle aux = closestPrecedingFinger(idMesg);
sendMessage(msg,msg.getKey(),msg.getSource(),aux,aux,msg.getType(),msg.getMode(),msg.getMessage());
}
the sendMessage() will end up invoking dispatcher() of the same node again.
To remedy this situation I changed the function findPredecessor() to the following. The only difference is the if() after // added by Filipe:
protected NodeHandle findPredecessor(int pos) {
if (start[pos].equals(this.id)) {
return this.nodeHandle;
} else if (finger[0] != null && start[pos].betweenE(this.id, finger[0].getId())) {
return finger[0];
} else {
temp[1] = closestPrecedingFinger(start[pos]);
//added by Filipe
if (temp[1].getId().equals(this.id))
return this.nodeHandle;
String key = GenericFactory.generateKey();
sendMessage(key,nodeHandle,temp[1],FIND_PRE,REQUEST,new IdMessage(start[pos]));
addMessageListener(key, new FindPredListener(this, pos));
}
return finger[pos];
}
This prevents the node from sending to itself... In my early tests this seems to work, but I am not 100% sure.
