Giving up on NextBus

My bus arrival timings web-app, NextBus, has been performing very poorly for the past several weeks. I’ve tried everything I can to fix it but unfortunately I can’t. Given the circumstances, I have decided to stop further development on the app.

I’ll try and describe why the site is broken but the summary is this: I have reason to believe that SBS Transit is rejecting network connections from my app to its servers. In the face of this, there is no way that I can keep NextBus functional.

To regular users who have come to rely on NextBus, I am sorry for letting you down. I have also let down the folks behind third-party apps such as iSingeo and SG Buses which relied on NextBus. I feel really bad that they spent time integrating their applications with NextBus which is now a waste.

I’ll leave the site running and it will at least work for the 200 odd stops for which arrival information is available via PublicTransport@SG. iPhone users: you may want to try tranSGuide, an app that shows bus arrival timings. It’s developed by a friend and it still works :-)

The Details

As you know, the core functionality of NextBus is to provide you with arrival information of all buses at any bus stop. To do this, it has to communicate with the SBS Transit mobile iris website which provides the information, although in a rather inconvenient manner.

Starting sometime in the last week of March, several connection requests to the SBS Transit servers from the Google App Engine environment (the infrastructure that hosts NextBus), started timing out. I didn’t notice it initially since the stops that I personally use NextBus for are handled by the Public Transport@SG service, which NextBus also supports. When I did notice the problem from the server logs, I didn’t have sufficient time to investigate the cause since I was to leave town for a week. So the site suffered while I was away.

When I got back, it took me a day to figure out what the problem was (requests to SBS servers timing out) and another day to implement a work-around. My work-around was simple - I implemented a simple web proxy that just fetches pages from SBS servers and returns them as is. I put up this proxy on an Amazon EC2 server instance hosted in the US. I modified the NextBus code to request pages from this proxy instead of requesting them directly from SBS servers. This worked! SBS pages were flowing back to NextBus via the proxy. So I quickly put this new proxy-powered code into production and the NextBus site was working reliably again. I thought it was kind-of weird that direct connections from the App Engine environment were not working but connections from Amazon servers were working. But hey, it was working now! So I didn’t give it much thought.

Until a week later.

A week after implementing the proxy, requests from the Amazon EC2 server hosting the proxy also started timing out! I then moved the proxy service to my shared hosting server; the same server that shows you this blog. So now requests were going from NextBus to my shared hosting server to SBS servers and all the way back. NextBus was working again.

This lasted for three days.

Interestingly enough, when the proxy service on my shared hosting server stopped working, it wasn’t because of connections to SBS timing out. No, the connection attempts were simply getting dropped! They still are, as a matter of fact.

Then I asked couple of my friends to help me out. They kindly agreed to host the proxy service on their servers. You can guess how that went.

Given what I’ve seen so far, I think the reasonable conclusion to draw is that the folks at SBS are denying connections from NextBus. It may be intentional or it may just be an automated response by some network monitoring tool that is banning any IP that originates an unusually high number of requests. Either way, I don’t have an endless supply of proxy servers at my disposal to try and work around the connection bans. And even if I did have that supply, I have no intention of actually doing it since it makes no sense to go on with NextBus when SBS does not like what I am doing here.

So to all of NextBus’ users, so long and thanks for all the fish!