When I came back from skiing in Colorado I had a bug report from a client and it took me a fair while to isolate the problem for them. The report suggested that a server that I’d built for them a while back was deadlocking in certain situations. The server had always had deadlock problems due to a couple of poor design decisions that I made early on and I’d built a tool to help me remove the potential for deadlock from it by analysing its lock acquisition patterns - the code was too complex for me to do this analysis by just looking at the code and although I should rewrite the poorly designed section of code I don’t have the time to do so (and it only causes problems when I make changes to the code, which doesn’t happen very often, and the problems can be caught by running my tool).
I’ve been looking at my web server log analysis and I have three peaks in my graphs for the last few days.
The first big peak, 6,000 hits per hour, was on 28th March when my relationship break-up post was on the front page of digg. The traffic then tailed off and dropped down to around 130 hits an hour on the 30th.
The second peak, of 500 hits per hour, occurred when a link was posted on The Register and stayed on its front page for a while.
My relationship break-up posting gets linked to from CNN.com…
And, of course, they put their own spin on it… However, as I mentioned in a reply to one of the comments on the original posting…
“Actually, I wrote a much longer piece with much more detail and decided that I didn’t need to publish it. I just needed to write it. To get it out of my head, in much the same way that I wrote about my sister’s tsunami experience.
Typical. My usual subject matter isn’t interesting enough to get onto digg.com, etc. but a throw-away post about using Ethereal to catch my partner cheating gets on the front page…
Ah well, such is life :) I’ll just try and write more interesting technical postings and in the mean time appreciate the kind words, the linky goodness, the traffic spike and correspondingly increased adsense revenue…
Previously published
This article was previously published on megeveski.com when I took some time out to ski. An index of these pages can be found here.
Just after we returned from this year’s trip to Megève I was bemoaning the fact that I was back, keen to “run away to the circus” and do another season and wondering how it could be possible to fit all of the interesting ski related things that are going on around “real life”.
Sorry about the lack of technical postings for a while, this last month or so has been rather hard for me.
On 13th February I became suspicious that something wasn’t quite right with Michelle, my partner for the last 17 or so years. My suspicions increased and I ended up setting up my laptop in the equipment cupboard as a packet sniffer running Ethereal (now WireShark). I then connected to the laptop via a Remote Desktop Connection and controlled the sniffer from my main PC.
The latest release of the free version of my asynchronous, windows, IOCP based, socket server framework can now be obtained from here at ServerFramework.com.
The latest release is really just a bug fix and compiler compatability release. The code now supports Visual Studio 2005 (as well as VC6, Visual Studio .Net (2002) and Visual Studio 2003). I’ve fixed the memory leak bugs that were present in the ThreadPoolLargePacketEchoServer sample and worked around the iostream leak that’s present in the Visual Studio 2005 version of STL.
Well, it turns out that my initial gut instinct about the leaks that I found in my socket servers when built with VS 2005 was correct. It was an STL thing.
The following code reproduces the problem.
#include <strstream> #include <sstream> #include <iostream> #include <stdio.h> using std::strstream; using std::ostrstream; using std::stringstream; using std::ostringstream; using std::cout; using std::endl; int main(int argc, char* argv[]) { cout << "Ready - press a key to test strsteam" << endl; getchar(); const size_t loopCount = 100000; size_t i; for (i = 0; i < loopCount; ++i) { strstream buf; } cout << "Ready - press a key to test ostrsteam" << endl; getchar(); for (i = 0; i < loopCount; ++i) { ostrstream buf; } cout << "Ready - press a key to test stringsteam" << endl; getchar(); for (i = 0; i < loopCount; ++i) { stringstream buf; } cout << "Ready - press a key to test ostringsteam" << endl; getchar(); for (i = 0; i < loopCount; ++i) { ostringstream buf; } cout << "Done - press a key" << endl; getchar(); return 0; } The code and projects for VC6 through VS2005 can be downloaded from here.
A while ago I reported that I’d been seeing very strange memory usage patterns in the debug build of the simple echo server when built with Visual Studio 2005 using the standard version of STL that ships with it. The thing that interests me most about this leak is that it seems to be more of a ‘strange allocation strategy’ rather than a leak as I was previously able to get the memory usage to grow to a large amount and then suddenly it dropped back to something reasonable and then started to grow again.
Recently I’ve been getting lots of emails from people who seem to think that my company, JetByte Limited, is currently recruiting. We’re not now and are unlikely to be in the near future, but that doesn’t mean people shouldn’t send speculative emails. In the past I’ve always responded to each of the applicants, explained that we’re not recruiting, and sometimes even made suggestions on how they might improve their approach and/or resume/cv.