Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix nil pointer no target discovered #1055

Merged

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Mar 2, 2021

Signed-off-by: kpango kpango@vdaas.org

Description:

@datelier reports this bug in the commit c1addd2
when no target connection found gRPC client continue to discover and connect to target,
but there is no target Connect method returns Error and nil connection which makes nil-pointer panic for logging.

2021-03-02 15:00:37     [WARN]: recovered: %+v                                                                                                                                                               
stacktrace:                                                                                                                                                                                                  
%s runtime error: invalid memory address or nil pointer dereference goroutine 119 [running]:                                                                                                                 
runtime/debug.Stack(0xc0004f3590, 0x11a3aa0, 0x1cea7d0)                                                                                                                                                      
        runtime/debug/stack.go:24 +0x9f                                                                                                                                                                      
github.com/vdaas/vald/internal/safety.recoverFunc.func1.1(0xc0004f3e30, 0x1)                                                                                                                                 
        github.com/vdaas/vald/internal/safety/safety.go:41 +0x79                                                                                                                                             
panic(0x11a3aa0, 0x1cea7d0)                                                                                                                                                                                  
        runtime/panic.go:969 +0x1b9                                                                                                                                                                          
github.com/vdaas/vald/internal/net/grpc.(*gRPCClient).Connect.func2(0xc000682dc0, 0x1, 0xc0003eb4d0, 0x10fa580)                                                                                              
        github.com/vdaas/vald/internal/net/grpc/client.go:570 +0x1093                                                                                                                                        
github.com/vdaas/vald/internal/singleflight.(*group).Do(0xc000422f60, 0x1545be0, 0xc000804f60, 0xc0003b6c90, 0x2b, 0xc000824eb0, 0x2b, 0x479f49, 0x203000, 0x203000, ...)                                    
        github.com/vdaas/vald/internal/singleflight/singleflight.go:62 +0xd8                                                                                                                                 
github.com/vdaas/vald/internal/net/grpc.(*gRPCClient).Connect(0xc00032c500, 0x1545be0, 0xc000804f60, 0xc0000440f0, 0x23, 0x0, 0x0, 0x0, 0x0, 0x0, ...)                                                       
        github.com/vdaas/vald/internal/net/grpc/client.go:556 +0x274                                                                                                                                         
github.com/vdaas/vald/internal/net/grpc.(*gRPCClient).StartConnectionMonitor.func1.3(0x11390c0, 0xc0003fd690, 0x1124440, 0x1ca8060, 0xc0004f3b00)                                                            
        github.com/vdaas/vald/internal/net/grpc/client.go:261 +0x190                                                                                                                                         
sync.(*Map).Range(0xc00032c600, 0xc0004f3cc0)                                                                                                                                                                
        sync/map.go:345 +0x1d9                                                                                                                                                                               
github.com/vdaas/vald/internal/net/grpc.(*gRPCClient).StartConnectionMonitor.func1(0x0, 0x0)                                                                                                                 
        github.com/vdaas/vald/internal/net/grpc/client.go:245 +0x40c                                                                                                                                         
github.com/vdaas/vald/internal/safety.recoverFunc.func1(0x0, 0x0)                                                                                                                                            
        github.com/vdaas/vald/internal/safety/safety.go:63 +0x65                                                                                                                                             
github.com/vdaas/vald/internal/errgroup.(*group).Go.func1(0xc00022ec80, 0xc0005e85c0)                                                                                                                        
        github.com/vdaas/vald/internal/errgroup/group.go:110 +0xd6                                                                                                                                           
created by github.com/vdaas/vald/internal/errgroup.(*group).Go                                                                                                                                               
        github.com/vdaas/vald/internal/errgroup/group.go:100 +0x7a

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.16
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.12.3

Types of changes:

  • Bug fix [type/bug]
  • New feature [type/feature]
  • Add tests [type/test]
  • Security related changes [type/security]
  • Add documents [type/documentation]
  • Refactoring [type/refactoring]
  • Update dependencies [type/dependency]
  • Update benchmarks and performances [type/bench]
  • Update CI [type/ci]

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Checklist:

  • I have read the CONTRIBUTING document.
  • I have checked open Pull Requests for the similar feature or fixes?
  • I have added tests and benchmarks to cover my changes.
  • I have ensured all new and existing tests passed.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly.

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Mar 2, 2021

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 💌 /changelog - replace the PR body by changelog details
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • /rebase - rebase master
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

@kpango kpango force-pushed the bugfix/internal-grpc/nil-pointer-when-no-target-discovererd branch from 476f5f9 to 07ca562 Compare March 2, 2021 06:56
Signed-off-by: kpango <kpango@vdaas.org>
@kpango kpango force-pushed the bugfix/internal-grpc/nil-pointer-when-no-target-discovererd branch from 07ca562 to d505514 Compare March 2, 2021 06:59
@codecov
Copy link

codecov bot commented Mar 2, 2021

Codecov Report

Merging #1055 (476f5f9) into master (691e2f7) will decrease coverage by 0.58%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1055      +/-   ##
==========================================
- Coverage   15.02%   14.43%   -0.59%     
==========================================
  Files         497      494       -3     
  Lines       28703    28351     -352     
==========================================
- Hits         4313     4093     -220     
+ Misses      24119    24007     -112     
+ Partials      271      251      -20     
Impacted Files Coverage Δ
internal/net/grpc/client.go 0.00% <0.00%> (ø)
internal/net/grpc/pool/pool.go 0.00% <0.00%> (ø)
internal/worker/queue.go 95.00% <0.00%> (-3.34%) ⬇️
internal/net/dialer.go
internal/net/net.go
internal/net/option.go
internal/db/storage/blob/s3/reader/reader.go 94.56% <0.00%> (+31.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 691e2f7...d505514. Read the comment docs.

@kpango kpango merged commit 679d2ec into master Mar 2, 2021
@kpango kpango deleted the bugfix/internal-grpc/nil-pointer-when-no-target-discovererd branch March 2, 2021 07:03
@vdaas-ci vdaas-ci mentioned this pull request Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants