Major bug
Status: Beta
Brought to you by:
hibbert
First I want to say that is a great program, that worked very well in my tests until... I found this bug that completely blocks it and keeps the processor at 100%.
In a Binary Market, without a Market Maker:
If you place a buying order and, before someone accept it, you spend your money, then, when someone finally accepts your order, the program enters in an infinite loop and stop responding - because you don't have money anymore to buy.
The only way to exit from this loop is by stopping the Zocalo server.
I am also attach the error report file, with the bug triggered in the original (unmodified) version of the program (as installed by zocalo-PM-Setup-2011-1.exe)
This seems surprising. There are tests verifying behavior very similar to this. I'd expect it to work.
I added a test in BookTest where traderA enters an order that she can afford, and then gives away her money before TraderB accepts the trade. As I expected, the trade doesn't take place, and the order is removed.
Can you give me more details about how you set up the situation? How many traders? How many markets? How was the market created? Are you using the setup for experiments, or general markets?
I found this bug in version zocalo-PM-2011-2 and I tested it many times - the same result.
I also asked a friend (from another town - who works as games developer) to install zocalo on his computer and test this scenario - he also hit this bug.
On his suggestion, I started to try older versions and test the same scenario.
2011-1 the same bug
2010.1 something different - an error screen apear when I try to make any trade
Finally, in 2009.3a things seems to work like as you said. But I'm not very sure, because even in this version the bug has manifested twice, one after another.
After that, I tested the "no more afford" scenario again and again - maybe 10 times - and everything works just fine in zocalo-PM-2009.3a. So just the 2 consecutive errors (infinite loop) that never repeted by now.
I'm starting to suspect that maybe has something to do with the (fractional) numbers of share in v2009.3a - maybe when it's a periodic number or something...
In v2011, is hard for me to bealive that I hit that "bad numbers" so many times - must be something else wrong.
Related to that, what change in the source code should I make to restrict the trades only to whole shares - even in situations where you trade to the limit of your money?
Maybe some changes you made between 2009.3a and 2011 is the cause for this bug.
Please test for yourself - latest PM version on Windows&JDK11. I'm pretty sure you will also hit this bug.
I managed to pinpoint a scenario that triggers the bug (please use my P-data and config).
v2009.3a
Case 1: user 3 tries to Sell to user2 5@30c -> bug triggered
Case 2: (no bug)
user3 first sell to user2 1@30c -> successful Sell 1 & user2 new Funds = 18c
user3 tries to Sell again to user2 1@30c -> successful Sell 0.6 & the user2 order (to Buy @30c) Canceled & new user3 order to Sell 0.4@30c created.
v2011.1
Bug triggered in both cases (1&2)
See attached files.
I hope all of this will help you to figure out where is the problem.
Last edit: Dan Teca 2019-03-31
Thanks for reporting this, Dan. I was able to reproduce the issue, and provide a fix.
Dan also reported an issue with whole share trading, which I was also able to reproduce and fix.