Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@
"maximumAssertionSizeInKb": 500000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "info",
"logging": {
"defaultLevel": "trace",
"enableExperimentalScopes": true
},
"assetSync": {
"syncDKG": {
"enabled": true,
Expand Down Expand Up @@ -404,7 +407,10 @@
"maximumAssertionSizeInKb": 500000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"logging": {
"defaultLevel": "info",
"enableExperimentalScopes": true
},
"assetSync": {
"syncDKG": {
"enabled": false,
Expand Down Expand Up @@ -638,7 +644,10 @@
"maximumAssertionSizeInKb": 500000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"logging": {
"defaultLevel": "trace",
"enableExperimentalScopes": true
},
"assetSync": {
"syncDKG": {
"enabled": false,
Expand Down Expand Up @@ -841,7 +850,10 @@
"maximumAssertionSizeInKb": 500000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"logging": {
"defaultLevel": "trace",
"enableExperimentalScopes": false
},
"assetSync": {
"syncDKG": {
"enabled": false,
Expand Down Expand Up @@ -1073,7 +1085,10 @@
"maximumAssertionSizeInKb": 500000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"logging": {
"defaultLevel": "trace",
"enableExperimentalScopes": false
},
"assetSync": {
"syncDKG": {
"enabled": false,
Expand Down
60 changes: 60 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,72 @@ process.on('unhandledRejection', (err) => {
return; // Don't crash for peer lookup failures
}

// Handle ECONNRESET errors gracefully - these are common network issues
if (err && (err.code === 'ECONNRESET' || err.errno === -104)) {
console.warn(`Network connection reset (ECONNRESET): ${err.message}`);
return; // Don't crash for connection reset errors
}

// Handle ERR_UNSUPPORTED_PROTOCOL errors gracefully
if (err && err.code === 'ERR_UNSUPPORTED_PROTOCOL') {
console.warn(`Unsupported protocol error (ERR_UNSUPPORTED_PROTOCOL): ${err.message}`);
return; // Don't crash for protocol errors
}

// Handle EPIPE (broken pipe) errors gracefully
if (err && (err.code === 'EPIPE' || err.errno === -32)) {
console.warn(`Broken pipe error (EPIPE): ${err.message}`);
return; // Don't crash for broken pipe errors
}

// Handle ETIMEDOUT errors gracefully - these are common database connection timeouts
if (err && (err.code === 'ETIMEDOUT' || err.errno === -110)) {
console.warn(`Connection timeout error (ETIMEDOUT): ${err.message}`);
return; // Don't crash for timeout errors
}

// Handle Sequelize "Got timeout reading communication packets" errors gracefully
if (err && err.message && err.message.includes('Got timeout reading communication packets')) {
console.warn(`Sequelize communication timeout error: ${err.message}`);
return; // Don't crash for database communication timeout errors
}

// For all other unhandled rejections, crash the node
console.error('Something went really wrong! OT-node shutting down...', err);
process.exit(1);
});

process.on('uncaughtException', (err) => {
// Handle ERR_UNSUPPORTED_PROTOCOL errors gracefully
if (err && err.code === 'ERR_UNSUPPORTED_PROTOCOL') {
console.warn(`Unsupported protocol error (ERR_UNSUPPORTED_PROTOCOL): ${err.message}`);
return; // Don't crash for protocol errors
}

// Handle EPIPE (broken pipe) errors gracefully
if (err && (err.code === 'EPIPE' || err.errno === -32)) {
console.warn(`Broken pipe error (EPIPE): ${err.message}`);
return; // Don't crash for broken pipe errors
}

// Handle ECONNRESET errors gracefully
if (err && (err.code === 'ECONNRESET' || err.errno === -104)) {
console.warn(`Network connection reset (ECONNRESET): ${err.message}`);
return; // Don't crash for connection reset errors
}

// Handle ETIMEDOUT errors gracefully - these are common database connection timeouts
if (err && (err.code === 'ETIMEDOUT' || err.errno === -110)) {
console.warn(`Connection timeout error (ETIMEDOUT): ${err.message}`);
return; // Don't crash for timeout errors
}

// Handle Sequelize "Got timeout reading communication packets" errors gracefully
if (err && err.message && err.message.includes('Got timeout reading communication packets')) {
console.warn(`Sequelize communication timeout error: ${err.message}`);
return; // Don't crash for database communication timeout errors
}

console.error('Something went really wrong! OT-node shutting down...', err);
process.exit(1);
});
2 changes: 1 addition & 1 deletion ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class OTNode {
}

initializeLogger() {
this.logger = new Logger(this.config.logLevel);
this.logger = new Logger(this.config.logging.defaultLevel);
}

initializeFileService() {
Expand Down
Loading
Loading