Missing timeout deadlines on `Modify/DeleteResourceGroup` calls
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
In the function `onAlterResourceGroup` within `pkg/ddl/resource_group.go`, `ModifyResourceGroup` is called without a deadline:
```go
err = infosync.ModifyResourceGroup(context.TODO(), protoGroup)
```
Similarly, `DeleteResourceGroup` in `onDropResourceGroup` has the same issue:
```go
err = infosync.DeleteResourceGroup(context.TODO(), groupInfo.Name.L)
```
Both `ModifyResourceGroup` and `DeleteResourceGroup` should be called with a deadline. Otherwise, they may stuck if the internal RPC requests encounter timeout errors.
These functions should follow the same pattern as `AddResourceGroup` in `onCreateResourceGroup`, which properly implements a timeout context:
```go
ctx, cancel := context.WithTimeout(jobCtx.stepCtx, defaultInfosyncTimeout)
defer cancel()
err = infosync.AddResourceGroup(ctx, protoGroup)
```
### 1. Minimal reproduce step (Required)
The following statements call all three functions.
```sql
create resource group rg1 ru_per_sec = 100;
create user user1;
alter user `user1` resource group `rg1`;
alter resource group rg1 ru_per_sec = 200;
drop user user1;
drop resource group if exists rg1;
```
### 2. What did you expect to see? (Required)
Internal RPCs of `ModifyResourceGroup` and `DeleteResourceGroup` return `DeadlineExceeded`
### 3. What did you see instead (Required)
Internal RPCs of `ModifyResourceGroup` and `DeleteResourceGroup` stuck, further block themselves, and further block `onAlterResourceGroup` and `onDropResourceGroup`.
### 4. What is your TiDB version? (Required)
v8.5.0
Contributor guide
Assessment
This issue has not been assessed yet.