Hi VIFF guys, I've implemented a VIFF application involving two binary searches. A typical trace from one of the players during excecution looks like this:
search for p1 search for p1: [-1, 4000] search for p2 search for p2: [0, 4001] search for p1: [-1, 4000] search for p2: [0, 4001] search for p1: [-1, 1999] search for p2: [0, 2000] search for p1: [999, 1999] search for p2: [1000, 2000] search for p1: [1499, 1999] search for p2: [1500, 2000] search for p1: [1499, 1749] search for p2: [1500, 1750] search for p1: [1499, 1624] search for p2: [1500, 1625] search for p1: [1499, 1561] search for p2: [1500, 1562] search for p1: [1530, 1561] search for p2: [1531, 1562] search for p1: [1530, 1545] search for p2: [1531, 1546] search for p1: [1537, 1545] search for p2: [1538, 1546] search for p1: [1541, 1545] search for p2: [1542, 1546] search for p1: [1541, 1543] search for p2: [1542, 1544] The two searches are independend of each other and they are hence correctly scheduled to run in parallel by VIFF as indicated by the trace. This works all fine with VIFF version e89fb02c5e3d. However, if I update VIFF to the current tip (8ec45943c12a), strange things start to happen: Player 1: search for p1 search for p1: [-1, 4000] search for p2 search for p2: [0, 4001] search for p1: [-1, 4000] search for p2: [0, 4001] search for p1: [-1, 1999] search for p2: [0, 2000] search for p1: [999, 1999] search for p2: [1000, 2000] search for p1: [1499, 1999] search for p2: [1500, 2000] search for p1: [1749, 1999] search for p2: [1750, 2000] search for p1: [1874, 1999] search for p2: [1750, 1875] search for p1: [1936, 1999] Player 2: search for p1 search for p1: [-1, 4000] search for p2 search for p2: [0, 4001] search for p1: [-1, 4000] search for p2: [0, 4001] search for p1: [-1, 1999] search for p2: [0, 2000] search for p1: [999, 1999] search for p2: [1000, 2000] search for p1: [1499, 1999] search for p1: [1749, 1999] search for p1: [1874, 1999] search for p1: [1936, 1999] search for p1: [1936, 1967] search for p1: [1951, 1967] search for p1: [1951, 1959] Player 3: search for p1 search for p1: [-1, 4000] search for p2 search for p2: [0, 4001] search for p1: [-1, 4000] search for p2: [0, 4001] search for p2: [0, 2000] search for p2: [1000, 2000] search for p2: [1500, 2000] search for p2: [1750, 2000] search for p2: [1875, 2000] search for p2: [1937, 2000] search for p2: [1968, 2000] search for p2: [1984, 2000] search for p2: [1984, 1992] search for p2: [1988, 1992] search for p2: [1988, 1990] It seems from the above that one of the players continue with one of the searches (search for p1) while another player continues with the other search (search for p2). This doesn't make sense since each step in the binary search is synchronized, e.g. the players have to engage in a comparison of a secret share in each step. The above trace is just an example; it varies for each time I run the program. Also, after the above trace, the players now deadlock where they used to continue with other parts of the program. It seems that the new code causes the two independent callback chains for each binary search to somehow mingle in a wrong way. Note also that I haven't enabled the new reactor, just installed the new VIFF tip code. If I enable the new reactor, e.g. by including import viff.reactor viff.reactor.install() in the code, I get the following exception: Traceback (most recent call last): File "C:\Python25\Lib\site-packages\viff\runtime.py", line 401, in inc_pc_wrapper return method(self, *args, **kwargs) File "C:\Python25\Lib\site-packages\viff\passive.py", line 109, in open self.activate_reactor() File "C:\Python25\Lib\site-packages\viff\runtime.py", line 838, in activate_reactor reactor.doIteration(0) File "C:\Python25\Lib\site-packages\viff\reactor.py", line 42, in doIteration self.runUntilCurrent() --- <exception caught here> --- File "C:\Python25\Lib\site-packages\twisted\internet\base.py", line 729, in runUntilCurrent f(*a, **kw) File "C:\Python25\lib\site-packages\twisted\internet\defer.py", line 243, in callback self._startRunCallbacks(result) File "C:\Python25\lib\site-packages\twisted\internet\defer.py", line 298, in _startRunCallbacks raise AlreadyCalledError twisted.internet.defer.AlreadyCalledError: whereafter the players continue with the strange search as shown in the above traces. Since the only change between the right and the wrong behaviour of my binary search algorithm described above was the VIFF update - my own code remained unchanged - I guess that this is caused by a bug in the new VIFF code. Do anyone have similar experiences? Anyone having a clue of this bug? Best regards, Thomas _______________________________________________ viff-devel mailing list (http://viff.dk/) viff-devel@viff.dk http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk