diff --git a/go/vt/vtgate/vtgate.go b/go/vt/vtgate/vtgate.go index 4716cdcf794..f3be94599e4 100644 --- a/go/vt/vtgate/vtgate.go +++ b/go/vt/vtgate/vtgate.go @@ -364,8 +364,10 @@ func Init( st.Start() } srv := initMySQLProtocol(vtgateInst) - servenv.OnTermSync(srv.shutdownMysqlProtocolAndDrain) - servenv.OnClose(srv.rollbackAtShutdown) + if srv != nil { + servenv.OnTermSync(srv.shutdownMysqlProtocolAndDrain) + servenv.OnClose(srv.rollbackAtShutdown) + } }) servenv.OnTerm(func() { if st != nil && enableSchemaChangeSignal {