Downstream — Trip 8

On the previous trip I walked from Teddington Lock to the Golden Jubilee Bridges. On this walk, I am finishing the series by going to the Thames Barrier. Getting to the start this time was easy peasy, with just a Tube ride down to Embankment.

Day 10 — Golden Jubilee Bridges to Thames Barrier

Downstream — Day 10

When I exited Embankment station, the rain had just stopped, and it felt very cold. The weather forecast indicated that it would get sunny, but I was very sceptical. I crossed the Golden Jubilee Bridges slowly, taking my time taking some photos and video of the London Eye. I considered taking a timelapse, but realised I had done so earlier for London in Fives, when the weather was much better.

The moment I made it to the south bank of the Thames, the Sun came out, and I was happy that I had brought my sun glasses. Not only was the Sun low, it also reflected a lot on the puddles on the ground.

This part of the Thames and Thames Part are right in the middle of London, and hence usually very busy with both commuters and tourists. Once the Sun came out, it therefore quickly became slow going, with lots of people going around the puddles in zigzaggy fashion.

The tide was out, which meant that there were quite a few people out on the river bed as well, to seek fortunes. There are still many bridges here, and definitely many landmarks and tourist attractions.

The best known is probably the Tower of London and Tower Bridge. The Victorian Tower Bridge (1894) is significantly younger than the Norman Tower (1078), which was built by the Normans after they invaded in 1066. The contrast behind the older Tower and Tower Bridge and the tall buildings of The City and City Hall is much starker still.

Beyond Tower Bridge, and the big yacht Kismet, the Thames Path becomes its quiet self again, with people going about their weekend morning business. The walk was now a lot more pleasant as I didn't have to dodge around people all the time. With the tide so low, many of the former docks now showed their muddy bottom, which made for some great photos.

After coming around the corner at Rotherhithe, the Thames Path loops nearly 270° degrees around The City, where dark clouds and rainbows loomed over on the North bank of the Thames, all the way to Greenwich. At Greenwich, the path goes along the Cutty Sark, a 19th century tea clipper which is now a museum. After crossing the square at the former Royal Naval College, the scenery turns quickly from "lovely residential area" into "industrial", which persists nearly all the way to the Thames Barrier.

Some interesting landmarks are the Millennium Dome. You can now walk across the roof, which is precisely what some people were doing when I came past. The Emirates Air Line flew high overhead between the two banks of the Thames as I was making my way further downstream.

After just over 300 kilometres of walking in 56 hours, while burning 25 000 calories, I then made it to the Thames Barrier, London's flood defence barrier. The barrier marks the end of the official Thames Path, although it is possible to extend it to the river Darent, where it then connects to the London LOOP that I walked a few years ago.

With the Thames Path done, it's time to look for the next adventure—I've my eyes on Hadrians Wall ;-).

Photos from my Adventure on the Thames Path are available on Flickr, and all videos on Vimeo. You can also see all the photos on a map.


This article has a short URL available:


No comments yet

Downstream — Trip 7

On the previous trip I walked from to Staines to Teddington Lock. The start of the walk was easy to reach by a direct train from Waterloo, but it does involve a 1 km walk in Teddington. But please do make sure you get out at the right side of the station, otherwise that walk is 2 km ☺.

Day 9 — Teddington Lock to the Golden Jubilee Bridges

Downstream — Day 9

I didn't spend a lot of time at Teddington Lock, as I had done so a week earlier. I did notice a few signs saying "Caution! Tidal" as a reminder that the Thames downstream from Teddington Lock is tidal. At the moment it was low tide, although at Teddington that is still a little hard to see due to the presence of Richmond Lock. At Teddington Lock you can chose whether the follow the North or South Bank to the Thames Barrier. As I know that the North Bank's path has a lot of barriers and diversions, especially further East in the City, I chose to walk the Thames Path along the South Bank.

On most of today's walk I was accompanied with rowers on the Thames—for practice, teaching, and races. There must be a rowing club every other kilometre or so. On the way into Richmond the Petersham Hotel looming above the town.

Just beyond Richmond the Thames path passes along the Old Deer Park, where I encountered a Meridian Line. Before Greenwich became the Prime Meridian in 1884, the line at Richmond, which passes through the King's Observatory fulfilled this role for a few centuries.

Not far from the first Meridian Line is Richmond Lock and Footbridge. This is the last lock on the Thames, but it is not a full lock. The lock is accompanied by sluice gates which are open when the tide is at it highest—around two hours on either side of the high tide mark. During that time boats can bypass the lock gates. When the sluice gates are closed, boats have to use the lock to make their way downstream or upstream. When I walked by, the Thames was nearly at its lowest point, and hence, the sluice gates were closed. I didn't see any boats wanting to go through the lock either though.

Beyond the Old Deer Park, the Thames Path passes between the Thames and Kew Gardens. You can unfortunately not see much of it, due the dense vegetation and a wall. You can only really get a glimpse of Kew Palace. Royal Botanic Gardens, Kew, as the gardens are also called, is well worth visiting—especially in Spring.

Now that I passed the last lock at Richmond, there are no further more locks all the way to the North Sea, however, there are plenty of bridges that cross the Thames, both for car, and rail and tube traffic. It became very clear that it was low tide, as there were vast areas of the bottom visible, with plenty of people trying to hunt for treasures.

I had lunch in Putney, at The Duke's Head, where I also had a local brew from nearby Wimbledon brewery. I did pass by the Stag Brewery as well, but that only makes Budweiser, or so their sign says.

After lunch the small deviations from the Thames Part started, as there is a lot of new building works going on in Wandsworth and Battersea. The path wasn't always signed very well, or the signs were outdated due to either new developments, or completed ones with the redirections still in place. Only at the former Battersea Power Station the deviation was a little annoying, as it included going along a busy road.

After going around the SIS building, I was back on familiar territory. I have walked along the Thames East from Lambeth Bridge to Tower Bridge many times. This is also the section that becomes really busy on nice warm autumn days, so my progress was slowed down a little.

A few more bridges later, the Sun started to come closer to setting. I always like this moment in a day, as the light becomes extra yellow, which makes in my opinion for much better photos. You also get to catch the Sun's rays on buildings, such as Lambeth Palace.

Across the river from Lambeth Palace is the Palace of Westminster, where the UK's parliament sits. One of the towers is the Elizabeth Tower, which also hosts the Big Ben bell. The latter is currently out of action and wrapped in scaffolding, as the bell and its tower are being refurbished.

I finished my walk just beyond the London Eye at the Golden Jubilee Bridges. From there on it was a short walk to Waterloo station where I took the tube home. It took however nearly an hour from the bridge to the station, but that was only because I sat down at the Waterloo Tap for a restorative beverage.

Only one more walk to go!

Photos from my Adventure on the Thames Path are available on Flickr, and all videos on Vimeo. You can also see all the photos on a map.


This article has a short URL available:


No comments yet

Downstream — Trip 6

On the previous trip I walked from Bourne End to Staines. Staines is pretty easy to reach by a direct train from London Waterloo. Normally I would walk on a Saturday, but this time I walked on a Sunday because the weather on Saturday was rubbish, and I don't like walking in the rain.

Day 8 — Staines to Teddington Lock

Downstream — Day 8

Luckily, the weather had all cleared up on Sunday, and I started in Staines on another beautiful morning. It was cold when I left home in the morning, and I had actually brought a coat. Instead of the coat, I should have brought my sunglasses, as the Sun warmed me up quickly. The coat went not soon after I set of walking in earnest, as I was getting sweaty.

It was quite quiet in Staines, with only few people walking their dogs, running, and cycling. There were a lot of posh houses along the Thames on this stretch.

After walking past a new built house called "Downstream" (coincidence?) I arrived at a point where I could either take a detour along the River Wey Navigation, or take the ferry to the other bank of the Thames and continue my journey there. The Nauticalia Ferry from Shepperton to Weybridge goes once every 15 minutes, and has been in operation for about 500 years, with a short break in the eighties. The choice was easy, and after buying my £2.50 ticket I didn't have to wait long for it to set off and ferry me, and a couple with a dog, across.

Just before I arrived in Walton-on-Thames I "ran into" a bunch of people running a marathon. There was even a sign congratulating a runner with their 100th marathon. I think I'll stick to walking…

For lunch I stopped at The Swan in Walton, and sat in its garden to enjoy my fish and chips, and a half. It was still a little early and I spend a little too much time relaxing and sitting in the Sun.

A little further the Thames passes close along a few massive reservoirs, which feed into the water supply of Greater London. Slightly annoyingly, their border is a massive stone wall — and I even had to cross some tank barriers.

There was another tiny ferry at Hampton, which I ignored. Instead I crossed the Thames near Hampton Court Palace, where I walked into the forecourt to smooch and take some photos. I visited the palace with my parents a few years ago, but it is so massive that you really need a full day to visit it all. I certainly didn't have the time for that, and continued along the Thames Path. Between Hampton Court Palace and Kingston, there is a quite wide path/walking area, The Barge Walk, with at the beginning lots of flower banks.

At Kingston upon Thames I crossed the Thames for the last time on today's walk. I continued through Canberry Gardens and a little section along a raised road. Just after coming back onto a footpath my way was blocked by a massive blown-over tree. There was no way to climb over it, so I made my way up the steep bank towards the road, move 20 meters downstream, and then slide back onto the footpath. I think the tree recently blew over, as its brilliant yellow leaves hadn't fallen off yet.

I finished my walk at Teddington Lock, but not after wandering around the lock's island for a while. There are three lock gates at Teddington, instead of the usual one (or two) lock gates. I also always thought that Teddington Lock was the last (or first) lock on the Thames, but I failed to realise that there is one further downstream at Richmond as well. However, the one at Teddington is the last full lock. Beyond Teddington Lock the river Thames is tidal, and the lock at Richmond only operates on low tide—more about that in the next instalment.

After wandering around the lock, I crossed a few bridges, and made my way to Teddington station for my train back into Waterloo. Curiously, as Teddington is situated on the Kingston Loop Line, you can catch the train to Waterloo from either of its two platforms.

Photos from my Adventure on the Thames Path are available on Flickr, and all videos on Vimeo. You can also see all the photos on a map.


This article has a short URL available:


No comments yet

Using the Right Debugging Tools

A while ago, we updated the MongoDB PHP driver's embedded C library to a new version. The C library handles most of the connection management and other low level tasks that the PHP driver needs to successfully talk to MongoDB deployments, especially in replicated environments where servers might disappear for maintenance or hardware failures.

After upgrading the C library from 1.12 to 1.13 we noticed that one of the PHP driver's tests was failing:

derick@singlemalt:~/dev/php/derickr-mongo-php-driver $ make test TESTS=tests/atlas.phpt
Atlas Connectivity Tests [tests/atlas.phpt]

When running the test manually, we get:

derick@singlemalt:~/dev/php/mongodb-mongo-php-driver $ php tests/atlas.phpt
Atlas Connectivity Tests
skip Atlas tests not wanted
mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c:1852 mongoc_cluster_fetch_stream_single():
        precondition failed: scanner_node && !scanner_node->retired

That was not good news.

The atlas.phpt test tests whether the PHP driver (through the C driver) can connect to a set of different deployments of Atlas, MongoDB's Database as a Service platform. The test makes sure we can talk to an Atlas replica set, a sharded cluster, a free tier replica set, as well as TLS 1.1 and TLS 1.2 specific deployments. The test started failing when connecting to the second provided URI (the sharded cluster).

At first I thought this was caused by the upgrade from version 1.12 to 1.13 of the C driver, but that didn't end up being the case. Let's see how we got to finding and fixing this bug.

First of all, I started GDB to see where it was failing:

derick@singlemalt:~/dev/php/mongodb-mongo-php-driver $ gdb --args php tests/atlas.phpt
GNU gdb (Debian 8.1-4+b1) 8.1
Reading symbols from php...done.
(gdb) run
Starting program: /usr/local/php/7.3dev/bin/php tests/atlas.phpt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/".
Atlas Connectivity Tests
mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c:1852 mongoc_cluster_fetch_stream_single():
        precondition failed: scanner_node && !scanner_node->retired

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

This shows that the C driver bailed out due to a specific assertion on line 1852 of mongoc-cluster.c. This assertion reads:

BSON_ASSERT (scanner_node && !scanner_node->retired);

Which didn't really say a lot. The next thing to try is then to make a backtrace in GDB with the bt command. This revealed:

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff41472f1 in __GI_abort () at abort.c:79
#2  0x00007ffff32cdcf1 in mongoc_cluster_fetch_stream_single (
        cluster=0x555556ba8e68, server_id=2, reconnect_ok=true, error=0x555556b95858)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c:1852
#3  0x00007ffff32cd9df in _mongoc_cluster_stream_for_server (
        cluster=0x555556ba8e68, server_id=2, reconnect_ok=true, cs=0x0, reply=0x7fffffff9ee0, error=0x555556b95858)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c:1762
#4  0x00007ffff32cdbe6 in mongoc_cluster_stream_for_server (
        cluster=0x555556ba8e68, server_id=2, reconnect_ok=true, cs=0x0, reply=0x7fffffff9ee0, error=0x555556b95858)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c:1826
#5  0x00007ffff32ddb0a in _mongoc_cursor_fetch_stream (cursor=0x555556b95700)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c:647
#6  0x00007ffff32e12a0 in _prime (cursor=0x555556b95700)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find.c:40
#7  0x00007ffff32df22c in _call_transition (cursor=0x555556b95700)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c:1146
#8  0x00007ffff32df54b in mongoc_cursor_next (cursor=0x555556b95700, bson=0x7fffffffa038)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c:1214
#9  0x00007ffff332511c in phongo_cursor_advance_and_check_for_error (cursor=0x555556b95700)
        at mongo-php-driver/php_phongo.c:742
#10 0x00007ffff33253d9 in phongo_execute_query (
        client=0x555556ba8e60, namespace=0x7fffeaeb5d58 "test.test", zquery=0x7ffff38201c0, options=0x0,
        server_id=1, return_value=0x7ffff38200f0, return_value_used=1)
        at mongo-php-driver/php_phongo.c:810
#11 0x00007ffff3342cc3 in zim_Manager_executeQuery (execute_data=0x7ffff3820160, return_value=0x7ffff38200f0)
        at mongo-php-driver/src/MongoDB/Manager.c:492
#12 0x0000555555e41d16 in execute_internal (execute_data=0x7ffff3820160, return_value=0x7ffff38200f0)
        at /home/derick/dev/php/php-src.git/Zend/zend_execute.c:2328

At first glance, I couldn't really see anything wrong with this backtrace, and was still puzzled as to why it would abort. I decided to go for a lunch time walk and have a look at it again. I always find that walks are good for clearing my mind.

After the walk, and a cuppa tea, I looked at the backtrace again, and noticed the following curiosity:

#4  0x00007ffff32cdbe6 in mongoc_cluster_stream_for_server (
        cluster=0x555556ba8e68, server_id=2, reconnect_ok=true, cs=0x0, reply=0x7fffffff9ee0, error=0x555556b95858)
        at mongo-php-driver/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c:1826


#10 0x00007ffff33253d9 in phongo_execute_query (
        client=0x555556ba8e60, namespace=0x7fffeaeb5d58 "test.test", zquery=0x7ffff38201c0, options=0x0,
        server_id=1, return_value=0x7ffff38200f0, return_value_used=1)
        at mongo-php-driver/php_phongo.c:810

In frame #10 the server_id variable is 1, whereas in frame #4 later on, the server_id variable is 2. These should have been the same.

The server ID is determined by the C driver when selecting a server to send a read or write operation to, and refers to a specific server's connection ID. The PHP driver uses this server ID when executing the query through the phongo_execute_query function, which calls the C driver's mongoc_collection_find_with_opts. The latter accepts as its 3rd argument a bson_t value with options to use while executing a query. These options include the pre-selected server ID, so that the C driver does not attempt to reselect a server:

cursor = mongoc_collection_find_with_opts(collection, query->filter, query->opts,
        phongo_read_preference_from_zval(zreadPreference TSRMLS_CC));

I decided to investigate which options the PHP driver was sending to mongoc_collection_find_with_opts. A while ago I developed a GDB helper function, about which I wrote in pretty-printing BSON. I sourced this helper within my GDB instance, and switched to frame #10 to inspect the value of the query options:

(gdb) source ~/dev/php/mongodb-mongo-php-driver/src/libmongoc/.gdbinit
(gdb) frame 10

The function call uses the options from the query struct query->opts, so I used the printbson helper function to display its contents:

(gdb) printbson query->opts

Which showed:

$11 = "!\000\000\000\020serverId\000\002\000\000\000\020serverId\000\001", '\000' <repeats 90 times>
INLINE (len=33)
        'serverId' : NumberInt("2"),
        'serverId' : NumberInt("1")

There are not supposed to be two conflicting serverId elements. Unlike PHP's arrays, bson_t values can have the same key appear multiple times. Although the C driver had selected server ID 1 for this query, server 2 was used because it was the first serverId element in the options struct. But why were there two values in the first place?

If you look at the PHP test, you see the following:

$urls = explode("\n", file_get_contents('.travis.scripts/atlas-uris.txt'));

$query = new \MongoDB\Driver\Query([]);

foreach ($urls as $url) {

        try {
                $m = new \MongoDB\Driver\Manager($url);
                iterator_to_array($m->executeQuery('test.test', $query));
        } catch(Exception $e) {

From this follows that we create the Query object, assign it to $query, and then use the same variable for each iteration. Somehow, we were not resetting the query options back to default before we used them, resulting in a duplicate serverId field. Once we figured out the problem, creating the fix was easy enough: Make sure we use a clean query->opts struct before we pass it to the mongoc_collection_find_with_opts function.

Debugging this issue was made a lot easier by having the right debugging tools, and this case shows that spending time on writing the GDB helper function printbson earlier in the year paid off. With this bug fixed, we could release a new patch version of the MongoDB Driver for PHP.

Happy hacking!


This article has a short URL available:


No comments yet

Downstream — Trip 5

On the previous trip I walked from Reading to Bourne End on the Thames Path, and on this trip I will progress to Staines. Getting to Bourne End wasn't as easy as getting to Reading, and a fair bit slower with a train to Maidenhead and then the branch line towards Marlow.

Day 7 — Bourne End to Staines

Downstream — Day 7

I set off from Bourne End (without going to the lovely craft beer place) fairly early in the morning, on a bright and sunny day. It was clearly regatta season as became apparent when I made my way to Cookham, where their yearly races were on. Not only were they preparing for the watery fun, there was also a good display of vintage cars being set-up. I think I was too early to see it in full flow. Unfortunately, it did mean diverting from the river for a while, first because of the regatta, and then because there are private things in the way.

When I got back to the river after about a mile, I could just about make out the outlines and hill of Cliveden House across the river. I had visited this National Trust property with family.

Just before reaching Maidenhead I came upon Boulter's Lock. An industrial looking lock that replaced earlier 16th and 18th century locks on the same place. It was quite busy around the lock, with apparently one or two tour buses having stopped to let their passengers having a look at it. I spend some time wandering around and relaxing, before continuing my walk.

Not far from Maidenhead lays Bray, famous for their large number of Michelin starred restaurants. There is the one star Hind's Head where I had eaten before, the three star Fat Duck, and the three start Waterside Inn, where I attended a wedding once. You can't see much of it from the other side of the Thames though, so just had to do with my memories of the tasty food.

Not far from Bray is the Dorney Lake, which was used in the 2012 Olympics as a rowing venue under the name "Eton Dorney". You can't see much of it from the North side, but once you've walked along it to the bottom end you can actually go up and have a look.

Immediately after rounding a bend in the river Thames, you see Windsor Castle, the Queen's "country home", towering over Windsor and the river. My plan was to have lunch in Windsor, but just after getting into Eton I noticed a nice looking pub, the Waterman's Arms. Their menu looked good, and they have a few nice draughts on so I decided to have lunch there instead. As a bonus, I also noticed the pub's ceiling had a painting of the whole length of the Thames on it!

After lunch, and perhaps half a pint too much, I continued my walk. On the bridge that connects Eton to Windsor, a guitar player was playing joyful tunes, to which I listened when taking some photos and video.

After walking for a while in between a railway and the river, there were plenty of signs saying that "no drones" could be flown in and near The Home Park. I bet the Queen doesn't like people snoop on her activities much. Beyond lovely Datchet, I was directed through a field with nettles to be "closer to the river", but I don't think that was specifically worth it. The 200 meter stretch along the road would probably be easier walking. The only real scenery were planes leaving Heathrow Airport anyway. The noise of planes overhead continued for the rest of the walk into Staines, or as it now is called "Staines-upon-Thames". Please note that Staines does not rhyme with Thames.

Just before Staines is Runnymede. Runnymede is an important site in British history, as this is the location where the Magna Carta was signed, all the way back in 1215. The Magna Carta is a charter of rights that is the first one to prevent from the King being above the law. Modifications were made in the following decades, and not many of its provisions are currently left, but it was very important on a journey to a constitutional monarchy.

The site itself is an open expanse of grassland, with a piece of art — "The Jurors", by Hew Locke. There is also a memorial created by the American Bar Association. Unfortunately I only found out about this after I had come home, and hence did not visit it.

Just beyond Runnymede the Thames Path passes under the M25, which means I have walked all the way from the source into Greater London. From there it was not much further to the end of my walk at St. Peter's Church in Staines.

Photos from my Adventure on the Thames Path are available on Flickr, and all videos on Vimeo. You can also see all the photos on a map.


This article has a short URL available:


No comments yet

Life Line