Realized I had a Bug in the Message Serialization

bug.gif

Today I was doing more testing, more polishing, on my ticker plant and I realized that there's a bug in my message serialization. It wasn't obvious, as it effected the application the long it ran, it seemed. I was looking into the serialization and deserialization of the variants which forms the backbone of the serialization and deserialization of the ivars in the messages, but that all seemed to be working.

Yet I seemed to be receiving several thousand messages, but only a fraction of them were valid. Something was very wrong.

I started do a lot of logging, because there was no way to easily catch this in a debugger - it got more pronounced as time went along. So I had to put in some logging, then let it run a while, hoping that the logging was going to point out the problem, and cross my fingers.

The one "silver lining" of this is that when these kinds of things happen, I end up going back into the code and placing a lot of DEBUG level logging that clearly illustrates what's moving through the system at that point. I'm not talking about dumping byte streams, but there are times for that in the process, I'm talking about the nice, human-readable logging. Like how many messages are being passed in, the byte counts, and even the break-down of how many messages of each kind.

I end up making these logging helper methods that do a lot of this for me so the code looks clean and it's easy to add this kind of behavior in several places - like the server and the client. It makes life a lot easier. And when I make it look nice, leaving it in at the DEBUG level is really no "cost" to the project, and can help debug things later.

The problem today was that just when I was getting to the point that I was close on this issue, I had to leave for the weekend. I know there's not a lot I can do after-hours for a ticker plant - there's no source of ticks anymore, but I wanted to get this solved.

I'll have to live with disappointment.

On the up-side, I think it's in the Summary messages as those are having the problem right at the end of the day. Maybe it's the packing/unpacking of values not matching. I'll have to verify that on Monday.