File tree Expand file tree Collapse file tree 2 files changed +27
-9
lines changed Expand file tree Collapse file tree 2 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,24 @@ if (process.env.NODE_ENV === "development") {
63
63
log . enableJSONLogging ( "server" , process . env . VERSION , LogrusLogLevel . getFromEnv ( ) ) ;
64
64
65
65
export async function start ( container : Container ) {
66
+ const server = container . get ( Server ) ;
67
+ const port = 3000 ;
68
+ const app = express ( ) ;
69
+
70
+ process . on ( "uncaughtException" , function ( err ) {
71
+ // fix for https://github.com/grpc/grpc-node/blob/master/packages/grpc-js/src/load-balancer-pick-first.ts#L309
72
+ if ( err && err . message && err . message . includes ( "reading 'startConnecting'" ) ) {
73
+ log . error ( "uncaughtException" , err ) ;
74
+ } else {
75
+ throw err ;
76
+ }
77
+ } ) ;
78
+
79
+ process . on ( "SIGTERM" , async ( ) => {
80
+ log . info ( "SIGTERM received, stopping" ) ;
81
+ await server . stop ( ) ;
82
+ } ) ;
83
+
66
84
const tracing = container . get ( TracingManager ) ;
67
85
tracing . setup ( process . env . JAEGER_SERVICE_NAME ?? "server" , {
68
86
perOpSampling : {
@@ -72,15 +90,6 @@ export async function start(container: Container) {
72
90
} ,
73
91
} ) ;
74
92
75
- const server = container . get ( Server ) ;
76
- const port = 3000 ;
77
- const app = express ( ) ;
78
-
79
93
await server . init ( app ) ;
80
94
await server . start ( port ) ;
81
-
82
- process . on ( "SIGTERM" , async ( ) => {
83
- log . info ( "SIGTERM received, stopping" ) ;
84
- await server . stop ( ) ;
85
- } ) ;
86
95
}
Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ import { redisMetricsRegistry } from "@gitpod/gitpod-db/lib";
19
19
log . enableJSONLogging ( "ws-manager-bridge" , undefined , LogrusLogLevel . getFromEnv ( ) ) ;
20
20
21
21
export const start = async ( container : Container ) => {
22
+ process . on ( "uncaughtException" , function ( err ) {
23
+ // fix for https://github.com/grpc/grpc-node/blob/master/packages/grpc-js/src/load-balancer-pick-first.ts#L309
24
+ if ( err && err . message && err . message . includes ( "reading 'startConnecting'" ) ) {
25
+ log . error ( "uncaughtException" , err ) ;
26
+ } else {
27
+ throw err ;
28
+ }
29
+ } ) ;
30
+
22
31
try {
23
32
const db = container . get ( TypeORM ) ;
24
33
await db . connect ( ) ;
You can’t perform that action at this time.
0 commit comments