apache / dubbo-go-samples

Apache dubbo
https://dubbo.apache.org/
Apache License 2.0
235 stars 185 forks source link

context deadline exceeded #317

Closed baymax55 closed 2 years ago

baymax55 commented 2 years ago

环境:win11|GoLand 2021.3|go1.17.1.windows-amd64 现象: context deadline exceeded 启动helloworld包下的go-server(正常启动),然后在java-client包下执行sh run.sh 正常,客户端正常相应; but,启动go-client包下的go-client 失败:

GOROOT=D:\devPrograms\go1.17.1.windows-amd64\go #gosetup GOPATH=C:\Users\Administrator\go #gosetup D:\devPrograms\go1.17.1.windows-amd64\go\bin\go.exe build -o C:\Users\Administrator\AppData\Local\Temp\GoLand_helloworld_goclient.exe github.com/apache/dubbo-go-samples/helloworld/go-client/cmd #gosetup C:\Users\Administrator\AppData\Local\Temp\GoLand\helloworld_go_client.exe 2022-02-01T17:43:08.143+0800 INFO config/root_config.go:159 [Config Center] Config center doesn't start 2022-02-01T17:43:08.144+0800 INFO zookeeper/registry.go:72 [Zookeeper Registry] New zookeeper registry with url map[host:192.168.5.104 port:52181 protocol:zookeeper registry:zookeeper registry.group: registry.label:true registry.namespace: registry.preferred:false registry.role:0 registry.timeout:3000s registry.ttl:10s registry.weight:0 registry.zone: simplified:false] 2022-02-01T17:43:08.144+0800 INFO zookeeper/client.go:55 [Zookeeper Client] New zookeeper client with name = 192.168.5.104:52181, zkAddress = 192.168.5.104:52181, timeout = 10s 2022-02-01T17:43:08.144+0800 INFO v3router/router_chain.go:55 [NewUniformRouterChain] Config center does not start, please check if the configuration center has been properly configured in dubbogo.yml &pid=21664&registry=zookeeper&registry.role=3&release=dubbo-golang-3.0.0&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&timestamp=1643708411} 2022-02-01T17:43:08.214+0800 INFO dubbo3/dubbo3_protocol.go:141 [Triple Protocol] Refer service: tri://192.168.5.103:20000/com.apache.dubbo.sample.basic.IGreeter?anyhost=true&app.version=3.0.0&application=dubbo.io&async=false&bean.name=GreeterProvider&cluster=failover&config.tracing=&environment=dev&export=true&generic=&group=&interface=com.apache.dubbo.sample.basic.IGreeter&loadbalance=random&message_size=4&metadata-type=local&methods=SayHello%2CSayHelloStream&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go&pid=21664&provided-by=&reference.filter=cshutdown&registry=zookeeper&registry.role=3&registry.ttl=10s&release=dubbo-golang-3.0.0&remote.timestamp=1643708411&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&sticky=false&timestamp=1643708588&version= 2022-02-01T17:43:08.225+0800 INFO zookeeper/registry.go:223 [Zookeeper Registry] Registry instance with root = /dubbo/com.apache.dubbo.sample.basic.IGreeter/consumers, node = consumer%3A%2F%2F192.168.5.103%2Fcom.apache.dubbo.sample.basic.IGreeter%3Fapp.version%3D3.0.0%26application%3Ddubbo.io%26async%3Dfalse%26bean.name%3DGreeterClientImpl%26cluster%3Dfailover%26config.tracing%3D%26environment%3Ddev%26generic%3D%26group%3D%26interface%3Dcom.apache.dubbo.sample.basic.IGreeter%26loadbalance%3D%26metadata-type%3Dlocal%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26protocol%3Dtri%26provided-by%3D%26reference.filter%3Dcshutdown%26registry.role%3D0%26release%3Ddubbo-golang-3.0.0%26retries%3D%26serialization%3D%26side%3Dconsumer%26sticky%3Dfalse%26timestamp%3D1643708588%26version%3D 2022-02-01T17:43:08.296+0800 INFO cmd/client.go:43 start to test dubbo 2022-02-01T17:43:14.314+0800 WARN proxy/proxy.go:210 [CallProxy] received rpc err: Failed to invoke the method SayHello in the service com.apache.dubbo.sample.basic.IGreeter. Tried 1 times of the providers [tri://:@192.168.5.103:20000/?interface=com.apache.dubbo.sample.basic.IGreeter&group=&version= tri://:@192.168.5.103:20000/?interface=com.apache.dubbo.sample.basic.IGreeter&group=&version=] (2/1)from the registry zookeeper://192.168.5.104:52181?registry=zookeeper&registry.group=&registry.label=true&registry.namespace=&registry.preferred=false&registry.role=0&registry.timeout=3000s&registry.ttl=10s&registry.weight=0&registry.zone=&simplified=false on the consumer 192.168.5.103 using the dubbo version 3.0.0. Last error is context deadline exceeded.: context deadline exceeded 2022-02-01T17:43:14.314+0800 ERROR cmd/client.go:49 context deadline exceeded main.main C:/Users/Administrator/GolandProjects/dubbo-go-samples/helloworld/go-client/cmd/client.go:49 runtime.main D:/devPrograms/go1.17.1.windows-amd64/go/src/runtime/proc.go:255 2022-02-01T17:43:14.314+0800 INFO cmd/client.go:51 client response result:

Process finished with the exit code 0

wesleywu commented 2 years ago

I'm experiencing similar problem with "context deadline exceeded". I've wrote a provider and a consumer in Go. When the provider executed a long lasting (which takes 3 seconds or more to finish) Sql command, for example

select count(*) from my_table where non_indexed_field = 'xxx';

the provider threw an error:

[ERRO] context deadline exceeded, SELECT COUNT(1) FROM my_table WHERE (non_indexed_field = 'xxx') Stack:

  1. mypackage/myservice.(*MyServiceImpl).GetList /Users/admin/Documents/my_path_to.go:105
  2. dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory.(*ProxyInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/common/proxy/proxy_factory/default.go:145
  3. dubbo.apache.org/dubbo-go/v3/registry/protocol.(*invokerDelegate).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/registry/protocol/protocol.go:465
  4. dubbo.apache.org/dubbo-go/v3/filter/graceful_shutdown.(*providerGracefulShutdownFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/graceful_shutdown/provider_filter.go:67
  5. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  6. dubbo.apache.org/dubbo-go/v3/filter/exec_limit.(*executeLimitFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/exec_limit/filter.go:118
  7. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  8. dubbo.apache.org/dubbo-go/v3/filter/generic.(*genericServiceFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/generic/service_filter.go:63
  9. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  10. dubbo.apache.org/dubbo-go/v3/filter/tps.(*tpsLimitFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/tps/filter.go:82
  11. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  12. dubbo.apache.org/dubbo-go/v3/filter/accesslog.(*Filter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/accesslog/filter.go:109
  13. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  14. dubbo.apache.org/dubbo-go/v3/filter/token.(*tokenFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/token/filter.go:71
  15. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  16. dubbo.apache.org/dubbo-go/v3/filter/metrics.(*Filter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/metrics/filter.go:49
  17. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  18. dubbo.apache.org/dubbo-go/v3/filter/echo.(*echoFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/echo/filter.go:65
  19. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  20. mypackage/model._MyService_GetList_Handler /Users/admin/my_path_to_triple.pb.go:167
  21. github.com/dubbogo/grpc-go.(*Server).processUnaryRPC /Users/admin/go/pkg/mod/github.com/dubbogo/grpc-go@v1.42.8/server.go:1298
  22. github.com/dubbogo/grpc-go.(*Server).handleStream /Users/admin/go/pkg/mod/github.com/dubbogo/grpc-go@v1.42.8/server.go:1670
  23. github.com/dubbogo/grpc-go.(*Server).serveStreams.func1.2 /Users/admin/go/pkg/mod/github.com/dubbogo/grpc-go@v1.42.8/server.go:934
ilaotan commented 2 years ago

triple+hessian2 ,same problem,use: dubbo-go-samples/rpc/triple/hessian2/go-client

update: Solved, this request walked my local agent, and then abroad

LaurenceLiZhixin commented 2 years ago

I'm experiencing similar problem with "context deadline exceeded". I've wrote a provider and a consumer in Go. When the provider executed a long lasting (which takes 3 seconds or more to finish) Sql command, for example

select count(*) from my_table where non_indexed_field = 'xxx';

the provider threw an error:

[ERRO] context deadline exceeded, SELECT COUNT(1) FROM my_table WHERE (non_indexed_field = 'xxx') Stack:

  1. mypackage/myservice.(*MyServiceImpl).GetList /Users/admin/Documents/my_path_to.go:105
  2. dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory.(*ProxyInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/common/proxy/proxy_factory/default.go:145
  3. dubbo.apache.org/dubbo-go/v3/registry/protocol.(*invokerDelegate).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/registry/protocol/protocol.go:465
  4. dubbo.apache.org/dubbo-go/v3/filter/graceful_shutdown.(*providerGracefulShutdownFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/graceful_shutdown/provider_filter.go:67
  5. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  6. dubbo.apache.org/dubbo-go/v3/filter/exec_limit.(*executeLimitFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/exec_limit/filter.go:118
  7. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  8. dubbo.apache.org/dubbo-go/v3/filter/generic.(*genericServiceFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/generic/service_filter.go:63
  9. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  10. dubbo.apache.org/dubbo-go/v3/filter/tps.(*tpsLimitFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/tps/filter.go:82
  11. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  12. dubbo.apache.org/dubbo-go/v3/filter/accesslog.(*Filter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/accesslog/filter.go:109
  13. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  14. dubbo.apache.org/dubbo-go/v3/filter/token.(*tokenFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/token/filter.go:71
  15. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  16. dubbo.apache.org/dubbo-go/v3/filter/metrics.(*Filter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/metrics/filter.go:49
  17. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  18. dubbo.apache.org/dubbo-go/v3/filter/echo.(*echoFilter).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/filter/echo/filter.go:65
  19. dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper.(*FilterInvoker).Invoke /Users/admin/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.1-0.20220127074249-3cb4d1ba664e/protocol/protocolwrapper/protocol_filter_wrapper.go:128
  20. mypackage/model._MyService_GetList_Handler /Users/admin/my_path_to_triple.pb.go:167
  21. github.com/dubbogo/grpc-go.(*Server).processUnaryRPC /Users/admin/go/pkg/mod/github.com/dubbogo/grpc-go@v1.42.8/server.go:1298
  22. github.com/dubbogo/grpc-go.(*Server).handleStream /Users/admin/go/pkg/mod/github.com/dubbogo/grpc-go@v1.42.8/server.go:1670
  23. github.com/dubbogo/grpc-go.(*Server).serveStreams.func1.2 /Users/admin/go/pkg/mod/github.com/dubbogo/grpc-go@v1.42.8/server.go:934

@WesleyWu try adding request-timeout in your dubbogo.yml

  consumer:
    request-timeout: 15s
    registry-ids:
      - demoZK
    references:
      "ComplexProvider":
LaurenceLiZhixin commented 2 years ago

Does this bug still exists in latest master branch? @baymax55

ilaotan commented 2 years ago

我遇到一样的问题, 经过排查,triple协议走我本地代理了. 你可以查查

wesleywu commented 2 years ago

Thanks. Setting the consumer timeout fixed the problem. @LaurenceLiZhixin

baymax55 commented 2 years ago

Does this bug still exists in latest master branch? @baymax55

Thanks for your help, it works on