如何在FreeBSD 8.2上的崩溃事件后调试Node.js崩溃?

时间:2011-12-14 19:39:39

标签: mongodb node.js mongoose

我有一个运行Node.js的HTTP服务器计算事物(结果使用Mongoose存储在MongoDB中)。简而言之:

    var Elbrus = (function() {

            var my = {},

            my.try = function(testId, tag) {
                    var testresult = new TestTry();
                    testresult.testId = testId;
                    testresult.tag = tag;
                    testresult.save();
            };

            my.score = function(testId, tag) {
                    var testresult = new TestScore();
                    testresult.testId = testId;
                    testresult.tag = tag;
                    testresult.save();
            }

            return my;
    }());

    http.createServer(function (req, res) {
            var urlObj = url.parse(req.url, true);
            if (urlObj.query["score"]) {
                res.writeHead(200, {'Content-Type': 'image/gif'});
                Elbrus.score(urlObj.query["testId"],urlObj.query["score"]);
                res.end();
            }
            else if (urlObj.query["try"]) {
                res.writeHead(200, {'Content-Type': 'image/gif'});
                Elbrus.try(urlObj.query["testId"],urlObj.query["try"]);
                res.end();
            }
    }).listen(8080, "myserver.com");

TestTry和TestScore是Mongoose模型。

此服务器将运行几个小时,有时最多12个,然后崩溃。我怎样才能开始了解问题所在?我在FreeBSD 8.2上,没有mdb,虽然我有gdb。

0 个答案:

没有答案