Couple minutes with Google App Engine

I am an avid reader and on average can go through 2-3 books per month. I created a simple site (source) which runs on Google’s App Engine to help keep track of the books being read. Long story short, one of its features stopped working recently and I kept on delaying investigating the cause until tonight.

What broke was a page which showed the latest books a user marks to be read, or starts / finishes reading. When a user selects a book to read, in addition of all the logic that runs for such request, a job is queued to add that book to the “reading” list. I knew right away that job handlers are running into some problems. I figured that it had been a long time since I checked the Google App Engine, that bug was a good excuse to check things out and see where GAE is these days.

I am so glad that I did. Debugging the issue was a breeze because of the logs that are available in the app engine’s administrator console. They really do a good job of making the information available to the developers. As I said, I suspected that job handlers are having issues and logs confirmed just that:

book_toobig

Too large? How can it be too large? I only store the latest 20 books for each “to read”, “reading”, and “finished” lists! Well, after looking at the code I realized that I had a bug there and no truncation was occurring once more than 20 books had been marked. So eventually that list got too big to be saved as a regular data store item.

Once the bug was fixed, the tasks continued to fail to run but this time with a different error:

book_str_error

Messages like these are extremely vague, but luckily the “str” gave me a clue that the issue might be an empty string I was returning in the task handler code. I implemented the queue functionality when it was still in the early days of GAE labs. Certain functions and behaviors have changed since and removing a return part solved the remaining issue. And voila, the summary page is back online:

booklist

It was great seeing the page and the variety of subjects that I get to read about. Some comedy, history, philosophy, self-development, and software – quite a nice mix!

I love evenings like these. A long neglected bug is fixed, couple things learned (e.g. I had no idea that GAE updated their docs with Jinja2 instead of Django, so off I went reading up about Jinja2), and a piece of nice functionality is back and available.

Leave a Reply

Your email address will not be published. Required fields are marked *