cloud-barista / cb-spider

CB-Spider offers a unified view and interface for multi-cloud management.
https://github.com/cloud-barista/cb-spider/wiki
Apache License 2.0
32 stars 48 forks source link

Panic occurs when gRPC server reflection is enabled #383

Closed jihoon-seo closed 3 years ago

jihoon-seo commented 3 years ago

@jmleefree 한 번 확인 부탁드립니다. ^^

What happened : Panic occurs when gRPC server reflection is enabled

What you expected to happen : gRPC server reflection 활성화해도 CB-Spider 가 정상적으로 실행됨

How to reproduce it (as minimally and precisely as possible) :

cd ~/go/src/github.com/cloud-barista/cb-spider
make dyna
cd conf
vi grpc_conf.yaml (reflection: enable 라인의 주석을 해제)
cd ../bin
./start-dyna.sh

[Result]

❯ ./start-dyna.sh

        [CB-Spider] Driver Plugin Mode: Dynamic Plugin Mode

[CLOUD-BARISTA].[INFO]: 2021-05-26 10:51:01 nutsdb-driver.go:35, github.com/cloud-barista/cb-store/store-drivers/nutsdb-driver.initialize() - ######## dbfile: /home/jhseo/go/src/github.com/cloud-barista/cb-spider/meta_db/dat 
[CLOUD-BARISTA].[INFO]: 2021-05-26 10:51:01 nutsdb-driver.go:35, github.com/cloud-barista/cb-store/store-drivers/nutsdb-driver.initialize() - ######## dbfile: /home/jhseo/go/src/github.com/cloud-barista/cb-spider/meta_db/dat 
[CLOUD-BARISTA].[INFO]: 2021-05-26 10:51:01 nutsdb-driver.go:35, github.com/cloud-barista/cb-store/store-drivers/nutsdb-driver.initialize() - ######## dbfile: /home/jhseo/go/src/github.com/cloud-barista/cb-spider/meta_db/dat 
[CLOUD-BARISTA].[INFO]: 2021-05-26 10:51:01 nutsdb-driver.go:35, github.com/cloud-barista/cb-store/store-drivers/nutsdb-driver.initialize() - ######## dbfile: /home/jhseo/go/src/github.com/cloud-barista/cb-spider/meta_db/dat 
[CLOUD-BARISTA].[INFO]: 2021-05-26 10:51:01 nutsdb-driver.go:35, github.com/cloud-barista/cb-store/store-drivers/nutsdb-driver.initialize() - ######## dbfile: /home/jhseo/go/src/github.com/cloud-barista/cb-spider/meta_db/dat 

  <CB-Spider> Multi-Cloud Infrastructure Federation Framework
     - AdminWeb: http://129.254.75.178:1024/spider/adminweb
     - REST API: http://129.254.75.178:1024/spider
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x12c9110]

goroutine 201 [running]:
github.com/cloud-barista/cb-spider/api-runtime/grpc-runtime.RunServer()
        /home/jhseo/go/src/github.com/cloud-barista/cb-spider/api-runtime/grpc-runtime/CBSpiderGRPCRuntime.go:67 +0x430
main.main.func2(0xc0004285c0)
        /home/jhseo/go/src/github.com/cloud-barista/cb-spider/api-runtime/apiserver.go:35 +0x25
created by main.main
        /home/jhseo/go/src/github.com/cloud-barista/cb-spider/api-runtime/apiserver.go:34 +0x9e

Anything else we need to know? :

Environment

Proposed solution :

Any other context :

jihoon-seo commented 3 years ago

@jmleefree https://github.com/cloud-barista/cb-tumblebug/issues/548#issuecomment-848387245 와 유사하게

grpcuiServer Reflection 방식 말고 Proto Source Files 방식으로 실행하는 방법을 시도해 보았습니다.

cd ~/go/src/github.com/cloud-barista/cb-spider/api-runtime/grpc-runtime/idl
~/go/bin/grpcui -proto cbspider/cbspider.proto -plaintext localhost:2048

Failed to process proto source files.: could not parse given files: cbspider/cbspider.proto:3:8: open gogo.proto: no such file or directory


확인해 보니

cb-tumblebug/src/api/grpc/protobuf/cbtumblebug/cbtumblebug.proto 에는

import "gogoproto/gogo.proto";

이렇게 되어 있고 (gogo.proto 위치: cb-tumblebug/src/api/grpc/protobuf/gogoproto/gogo.proto)


cb-spider/api-runtime/grpc-runtime/idl/cbspider/cbspider.proto 에는

import "gogo.proto";

이렇게 되어 있습니다. (gogo.proto 위치: cb-spider/api-runtime/grpc-runtime/idl/gogoproto/gogo.proto)


import "gogoproto/gogo.proto";import "gogo.proto"; 중에서 어느 쪽이 더 적절하려나요?


[참고]

CB-Tumblebug: cb-tumblebug/src/api/grpc/protobuf/Makefile 이 있습니다.

CB-Spider: cb-spider/api-runtime/grpc-runtime/idl 등의 위치에 Makefile 이 없습니다.

jmleefree commented 3 years ago

@jihoon-seo ./start-dyna.sh 실행할 때 에러나는 것은 grpc_conf.yaml 에서 interceptos 항목을 주석처리해서 발생하는 버그였습니다.

idl 아래 gogoproto 로 이동해서 실행해보세요

cd ~/go/src/github.com/cloud-barista/cb-spider/api-runtime/grpc-runtime/idl/gogoproto
~/go/bin/grpcui -proto ../cbspider/cbspider.proto -plaintext localhost:2048
jihoon-seo commented 3 years ago

알려 주신 방법으로 grpcui 실행이 되는 것을 확인했습니다. (Proto Source Files 방식) 😊

cd ~/go/src/github.com/cloud-barista/cb-spider/api-runtime/grpc-runtime/idl/gogoproto
~/go/bin/grpcui -proto ../cbspider/cbspider.proto -plaintext localhost:2048

Server Reflection 방식으로도 실행이 되는 것을 확인했습니다. 😊

~/go/bin/grpcui -plaintext localhost:2048