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") {
6363log . enableJSONLogging ( "server" , process . env . VERSION , LogrusLogLevel . getFromEnv ( ) ) ;
6464
6565export 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+
6684 const tracing = container . get ( TracingManager ) ;
6785 tracing . setup ( process . env . JAEGER_SERVICE_NAME ?? "server" , {
6886 perOpSampling : {
@@ -72,15 +90,6 @@ export async function start(container: Container) {
7290 } ,
7391 } ) ;
7492
75- const server = container . get ( Server ) ;
76- const port = 3000 ;
77- const app = express ( ) ;
78-
7993 await server . init ( app ) ;
8094 await server . start ( port ) ;
81-
82- process . on ( "SIGTERM" , async ( ) => {
83- log . info ( "SIGTERM received, stopping" ) ;
84- await server . stop ( ) ;
85- } ) ;
8695}
Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ import { redisMetricsRegistry } from "@gitpod/gitpod-db/lib";
1919log . enableJSONLogging ( "ws-manager-bridge" , undefined , LogrusLogLevel . getFromEnv ( ) ) ;
2020
2121export 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+
2231 try {
2332 const db = container . get ( TypeORM ) ;
2433 await db . connect ( ) ;
You can’t perform that action at this time.
0 commit comments