Profile cover photo
Profile photo
Len Holgate
About
Len Holgate's posts

Post has attachment

Post has attachment

Post has attachment
Practical Testing: 35 - Heap corruption

Previously on "Practical Testing"... I've just fixed a new bug in the timer queue and in doing so I updated the code used in the blog posts to the latest version that ships with The Server Framework. This code included two fixes that had been fixed some time ago and which I hadn't documented here. They also lacked unit tests... In this episode I find and fix the first of these issues by writing a unit test that triggers the issue.

This bug is another edge case that isn't used that often by most of the code that uses the timer queue. The queue supports timers that can be set and reset a number of times via an interface that allows you to create a timer, set/cancel it and then destroy the timer. A less used interface allows you to create 'fire and forget' timers that can only be set once and that clean themselves up. Hardly any code that I write uses this interface but it's there for backwards compatibility and the code required to support it is limited to the call that sets the initial timer, as the cleanup is done by code that's shared with timers that are deleted during their own timeout processing.

This bug also only affects the Timer Wheel implementation which has a considerably smaller set of users and a considerably narrower use case. There's test coverage for "one shot" timers but only for timers that are processed whilst the timer queue's internal lock is held. There is no test for a "one shot" timer for queues that dispatch without holding a lock. The code for lock-free dispatch is significantly different to the code for dispatch whilst holding a lock and that's where the bug is.

The bug was originally found because it causes heap corruption due to a double delete. The first thing I'll do is add a test for lock-free timer dispatch of "one shot" timers. This clearly demonstrates the bug when run in release mode on Windows 10 as the heap alerts us to the problem.

Continue reading

Post has attachment
We drove over to Munich and back to visit Emma and family. The last minute purchase of DVD players was a good idea...

Post has attachment
Easter in Guernsey with DadDad and DoDo.

Post has shared content

Post has shared content

Post has attachment
Photo

Post has shared content
Good morning Google Plus. #Craftidea for today- if you want creative envelopes, go to #Google Maps, map the route from your letter to the other person's mailbox. Print them up, fold them into 8 by 11 envelopes (or smaller if you are sending #holiday cards).
Photo

Post has shared content
Happiness and success?


1. Marry the right person. This one decision will determine 90% of your happiness or misery.
2. Work at something you enjoy and that's worthy of your time and talent.
3. Give people more than they expect and do it cheerfully.
4. Become the most positive and enthusiastic person you know.
5. Be forgiving of yourself and others.
6. Be generous.
7. Have a grateful heart.
8. Persistence, persistence, persistence.
9. Discipline yourself to save money on even the most modest salary.
10. Treat everyone you meet like you want to be treated.
11. Commit yourself to constant improvement.
12. Commit yourself to quality.
13. Understand that happiness is not based on possessions, power or prestige, but on relationships with people you love and respect.
14. Be loyal.
15. Be honest.
16. Be a self-starter.
17. Be decisive even if it means you'll sometimes be wrong.
18. Stop blaming others. Take responsibility for every area of your life.
19. Be bold and courageous. When you look back on your life, you'll regret the things you didn't do more than the ones you did.
20. Take good care of those you love.
21. Don't do anything that wouldn't make your Mom proud.
Photo
Wait while more posts are being loaded