Express stops working after reloading page 10 times

I am using express as my webserver for node and everything seems to be working correctly. The only problem I am encoutering is when I load a specific page ('/learn' route) 10 times repeatedly. Once I do this, express seems to stop working, although no error is logged to the console and nothing wrong is displayed on the page. It just keeps waiting for the host in the browser. What is weird is that the problem doesn't occur if I go from the page with the problem to another page, and then back again. I can repeat this as much as I want without error. Here is my route with the problem:

var bcrypt = require('bcrypt');
var pool = require('../database.js').pool;


module.exports = function(app) {
    app.get('/learn', function(req, res, next) {
        var query = 'SELECT * FROM questions INNER JOIN answers ON questions.questionID = answers.questionID';
        pool.getConnection(function(err, connection) {
            connection.query(query, function(err, rows) {
                if (err) {
                    throw err;
                }

                var data = {
                    name: req.session.name,
                    problems: rows,
                };

                res.render('learn.html', data);
            });
        });
    });

    app.post('/learn/checkAnswer', function(req, res) {
        //get posted form data
        var questionID = req.body.questionID;
        var selectedAnswer = req.body.selectedAnswer;

        //query database
        pool.getConnection(function(err, connection) {
            var query = connection.query('SELECT correctAnswer FROM questions WHERE questionID = ?', questionID, function(err, rows) {
                res.send({
                    correctAnswer: rows[0].correctAnswer
                });
            });
        });
    });
};

I'm not sure if this makes a difference, but I am using handlebars as my rendering engine instead of jade, as well as node-mysql for my database.

10 is the default size of the node-mysql pool. And since you're not ending the connections retrieved with pool.getConnection, the 11th request will wait indefinitely for a free connection.

Easy to fix:

connection.query(query, function(err, rows) {
  connection.end(); // end the connection as soon as possible,
                    // so it's returned to the pool and can be reused.
  if (err) ...
});