Skip to content

[Bug]: golang的agent在grpc中使用了一元拦截器(UnaryInterceptor)的时候报错 #44

@Fliv

Description

@Fliv

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I am not looking for support or already pursued the available support channels without success.

Version

1.8.1

Installation Type

Official Docker Compose

Service Name

DongTai-Core

Describe the details of the bug and the steps to reproduce it

在项目中已经使用了grpc一元拦截器(grpc.UnaryInterceptor)的情况下,dongtai agent再注册拦截器会导致报错

代码路径:
https://github.com/HXSecurity/DongTai-agent-go/blob/v0.4.2/core/grpc/newServer/replacement.go#L25

报错:

panic: The unary server interceptor was already set and may not be reset

Additional Information

No response

Logs

2022-07-13 19:13:43.840 error ******[-]: panic: The unary server interceptor was already set and may not be reset. 
	/usr/local/go/src/runtime/panic.go:844
google.golang.org/grpc.UnaryInterceptor.func1
	/***/go/pkg/mod/google.golang.org/[email protected]/server.go:382
google.golang.org/grpc.(*funcServerOption).apply
	/***/go/pkg/mod/google.golang.org/[email protected]/server.go:201
google.golang.org/grpc.NewServer
	/***/go/pkg/mod/google.golang.org/[email protected]/server.go:564
github.com/HXSecurity/DongTai-agent-go/core/grpc/newServer.NewServer
	/***/go/pkg/mod/github.com/!h!x!security/!dong![email protected]/core/grpc/newServer/replacement.go:26

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions