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

[Bug]: [GoSDK] Failed to describe a existed role: role not found #40274

Open
1 task done
ThreadDao opened this issue Feb 28, 2025 · 2 comments
Open
1 task done

[Bug]: [GoSDK] Failed to describe a existed role: role not found #40274

ThreadDao opened this issue Feb 28, 2025 · 2 comments
Assignees
Labels
component/gosdk issues & PRs related to GoSDK package kind/bug Issues or changes related a bug priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@ThreadDao
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version:  master-20250228-762a644d-amd64
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): go sdk v2
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

  • case:
func TestDescribe(t *testing.T) {
	ctx := hp.CreateContext(t, time.Second*common.DefaultTimeout)
	mc := hp.CreateDefaultMilvusClient(ctx, t)
	roles, err := mc.ListRoles(ctx, client.NewListRoleOption())
	common.CheckErr(t, err, true)
	log.Info("TestDescribe", zap.Any("roles", roles))
	for _, r := range roles {
		role, err := mc.DescribeRole(ctx, client.NewDescribeRoleOption(r))
		log.Error("error", zap.Error(err))
		common.CheckErr(t, err, true)
		log.Info("TestDescribe", zap.Any("role", role))
	}
}
  • log:
[2025/02/28 19:43:45.131 +08:00] [INFO] [base/milvus_client.go:32] [Request] [method=Connect] [reqs="{\"client_info\":{\"sdk_type\":\"GoMilvusClient\",\"sdk_version\":\"2.4.0-dev\",\"local_time\":\"2025-02-28 19:43:45.131362124 +0800 CST m=+0.026610318\",\"user\":\"root\",\"host\":\"nausicca\"}}"]
[2025/02/28 19:43:45.150 +08:00] [INFO] [base/milvus_client.go:32] [Response] [method=Connect] [resp="{\"status\":{},\"server_info\":{\"build_tags\":\"2.6.0-dev\",\"build_time\":\"Fri Feb 28 03:05:08 UTC 2025\",\"git_commit\":\"762a644\",\"go_version\":\"go version go1.22.0 linux/amd64\",\"deploy_mode\":\"STANDALONE\"},\"identifier\":456325339570241539}"]
[2025/02/28 19:43:45.150 +08:00] [INFO] [base/milvus_client.go:32] [Request] [method=SelectRole] [reqs={}]
[2025/02/28 19:43:45.158 +08:00] [INFO] [base/milvus_client.go:32] [Response] [method=SelectRole] [resp="{\"status\":{},\"results\":[{\"role\":{\"name\":\"admin\"}},{\"role\":{\"name\":\"public\"}},{\"role\":{\"name\":\"role_DPnD\"}},{\"role\":{\"name\":\"role_PCFC\"}},{\"role\":{\"name\":\"role_Pxip\"}},{\"role\":{\"name\":\"role_cBGA\"}},{\"role\":{\"name\":\"role_dQae\"}},{\"role\":{\"name\":\"role_qFFv\"}},{\"role\":{\"name\":\"role_rAvo\"}},{\"role\":{\"nam......"]
[2025/02/28 19:43:45.158 +08:00] [INFO] [advcases/rbac_test.go:262] [TestDescribe] [roles="[admin,public,role_DPnD,role_PCFC,role_Pxip,role_cBGA,role_dQae,role_qFFv,role_rAvo,role_sztP]"]
[2025/02/28 19:43:45.158 +08:00] [INFO] [base/milvus_client.go:32] [Request] [method=SelectGrant] [reqs="{\"entity\":{\"role\":{\"name\":\"admin\"}}}"]
[2025/02/28 19:43:45.166 +08:00] [INFO] [base/milvus_client.go:32] [Response] [method=SelectGrant] [resp="{\"status\":{}}"]
[2025/02/28 19:43:45.166 +08:00] [ERROR] [advcases/rbac_test.go:265] [error] [error="role not found"] [stack="github.com/milvus-io/milvus/tests/go_client/testcases/advcases.TestDescribe\n\t/home/zong/zong/projects/milvus/tests/go_client/testcases/advcases/rbac_test.go:265\ntesting.tRunner\n\t/usr/local/go/src/testing/testing.go:1689"]
    response_checker.go:21: 

Expected Behavior

No response

Steps To Reproduce

Milvus Log

pod:

zong-debug-milvus-standalone-764bc69867-lvb7w

Anything else?

No response

@ThreadDao ThreadDao added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 28, 2025
@ThreadDao ThreadDao added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Feb 28, 2025
@ThreadDao ThreadDao added this to the 2.5.6 milestone Feb 28, 2025
Copy link

dosubot bot commented Feb 28, 2025

The "role not found" error in the DescribeRole function can occur if the response from the SelectGrant call does not contain any entities. This is checked by the condition if len(resp.GetEntities()) == 0, which leads to the error "role not found" [1].

In your test case, the SelectGrant response for the "admin" role seems to be empty, which is why the error is being logged. Here are a few things you might want to check or try:

  1. Verify Role Existence: Ensure that the role you are trying to describe actually exists and is correctly set up in the system. The ListRoles function seems to list the roles correctly, so the issue might be with the grants associated with the role.

  2. Check Role Grants: Verify that the role has associated grants. If a role exists but has no grants, the SelectGrant response might be empty, leading to the "role not found" error.

  3. Inspect Logs for Errors: Check the server logs for any errors or warnings that might indicate why the SelectGrant call is not returning the expected entities.

  4. Review Role Creation and Assignment: Ensure that roles are created and assigned correctly in your setup. There might be an issue with how roles and grants are being managed or stored.

By addressing these points, you should be able to identify the root cause of the issue and resolve the "role not found" error.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot dosubot bot added the component/gosdk issues & PRs related to GoSDK package label Feb 28, 2025
congqixia added a commit to congqixia/milvus that referenced this issue Mar 3, 2025
Related to milvus-io#40274

Previousy DescribeRole returns only roles with grants, this PR add
select role action to check role existence.

Also added database properties related option

Signed-off-by: Congqi Xia <[email protected]>
sre-ci-robot pushed a commit that referenced this issue Mar 3, 2025
Related to #40274

Previousy DescribeRole returns only roles with grants, this PR add
select role action to check role existence.

Also added database properties related option

---------

Signed-off-by: Congqi Xia <[email protected]>
@yanliang567
Copy link
Contributor

/assign @congqixia
/unassign

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/gosdk issues & PRs related to GoSDK package kind/bug Issues or changes related a bug priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants