I am working on a node.js app, and occasionally it seems to freeze. I assume this is because the user code thread has frozen. It seems to happen after about 5 minutes of usage, but I have no idea why. Are there any tools that would let you know where it's become deadlocked? Apart from adding logging on every line.
Updated to add more information....
I've added some trace statements and have narrowed it down to the following code:
exports.addLocationToRoute = function(req, res) {
console.log("27");
console.log(req.body);
var queryConfig = {
text: "INSERT INTO route_locations (route_id, location_id, order_id) VALUES ($1, $2, $3);",
values: [req.params.id, req.body.locationId, req.body.order]
};
pg.connect(conString, function(err, client) {
console.log("28");
...
I see 27 output in trace, but not 28. Is there a way to see why it is frozen between those two points?
update 2:
I just tried to reproduce again and it's become frozen at a different point in the code, but at this point it is also calling
pg.connect(conString, function(err, client) {