You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using node greater than 4.0 version with node-mssql. I have enabled try catch, promise then-catch pattern, as well as handled unhandled rejection and uncaught errors in my node server with proper logging. But we are seeing that server got crashed 2-3 times everyday when users are performing operations on front end. From the logs it shows me the log before transaction.begin statement but not the next log after that line. Try catch and Promise then catch as well as other handlers not logging it and not capturing it. Its like a very serious matter. Below is the code snippet
`
var connection = new sql.Connection({
user: '...',
password: '...',
server: 'localhost',
database: '...'
});
connection.connect(function(err) {
//Log1 here prints
try{
var transaction = new sql.Transaction(/* [connection] */);
//Log2 here prints
transaction.begin(function(err) {
//Log3 here does not print when we get the isue
// ... error checks
var rolledBack = false;
transaction.on('rollback', function(aborted) {
// emited with aborted === true
rolledBack = true;
});
}catch(err){
//Log 4 here does not prints
}).then(..)
.catch(err){
//Log5 here does not prints
}
//server.js(main file)
....
....
.
.
process
.on('unhandledRejection', (reason, p) => {
//Log6 It does not prints
console.error(reason, 'Unhandled Rejection at Promise', p);
})
.on('uncaughtException', err => {
//Log7 It does not prints
console.error(err, 'Uncaught Exception thrown');
process.exit(1);
});
app.use(function (err, req, res, next) {
//Log8 It does not prints
});
``
`
The text was updated successfully, but these errors were encountered:
More recent versions of node-mssql have improved lifecycle management which I think should resolve this issue, so I'm closing it. Please upgrade to v4.2.2 (most recent at time of writing). If this doesn't improve things then please feel free to reopen.
We are using node greater than 4.0 version with node-mssql. I have enabled try catch, promise then-catch pattern, as well as handled unhandled rejection and uncaught errors in my node server with proper logging. But we are seeing that server got crashed 2-3 times everyday when users are performing operations on front end. From the logs it shows me the log before transaction.begin statement but not the next log after that line. Try catch and Promise then catch as well as other handlers not logging it and not capturing it. Its like a very serious matter. Below is the code snippet
`
var connection = new sql.Connection({
user: '...',
password: '...',
server: 'localhost',
database: '...'
});
connection.connect(function(err) {
//Log1 here prints
try{
var transaction = new sql.Transaction(/* [connection] */);
//Log2 here prints
transaction.begin(function(err) {
//Log3 here does not print when we get the isue
// ... error checks
}).then(..)
.catch(err){
//Log5 here does not prints
}
//server.js(main file)
....
....
.
.
process
.on('unhandledRejection', (reason, p) => {
//Log6 It does not prints
console.error(reason, 'Unhandled Rejection at Promise', p);
})
.on('uncaughtException', err => {
//Log7 It does not prints
console.error(err, 'Uncaught Exception thrown');
process.exit(1);
});
app.use(function (err, req, res, next) {
//Log8 It does not prints
});
``
`
The text was updated successfully, but these errors were encountered: