Repository: modelscope/evalscope
Issue: perf测试模型报错'statistic_benchmark_metric': database is locked
Root cause: Resource Mishandling

## 自查清单

在提交 issue 之前，请确保您已完成以下步骤:
- [√] 我已仔细阅读了[相关使用说明文档](https://evalscope.readthedocs.io/zh-cn/latest/get_started/parameters.html)
- [√ ] 我已查看了[常见问题解答](https://evalscope.readthedocs.io/zh-cn/latest/get_started/faq.html)
- [√ ] 我已搜索并查看了现有的 issues，确认这不是一个重复的问题

## 问题描述

perf测试模型报错'statistic_benchmark_metric': database is locked

## EvalScope 版本（必填）
v1.1.1和v0.16.0 都试过

## 使用的工具
- [ ] Native / 原生框架
- [ ] Opencompass backend
- [ ] VLMEvalKit backend
- [ ] RAGEval backend
- [√ ] Perf / 模型推理压测工具
- [ ] Arena / 竞技场模式

## 执行的代码或指令

evalscope perf     --url http://xxxx/v1/chat/completions     --parallel 1 2 4 8 16 32 64 128      --number 5 10 20 40 80 160 320 640     --model default     --log-every-n-query 100     --read-timeout 120     --max-tokens 2000     --dataset random     --max-prompt-length 4000     --min-prompt-length 4000     --tokenizer-path /test123/     --api openai     --extra-args '{"ignore_eos": true}'


## 错误日志

 evalscope - INFO: Test connection successful.
 evalscope - INFO: Save the data base to: outputs/xxxx/xxx/benchmark_data.db
 evalscope - ERROR: Exception in async function 'statistic_benchmark_metric': database is locked
Traceback (most recent call last):
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py", line 17, in async_wrapper
    return await func(*args, **kwargs)
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/benchmark.py", line 102, in statistic_benchmark_metric
    create_result_table(cursor)
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/db_util.py", line 59, in create_result_table
    cursor.execute(
sqlite3.OperationalError: database is locked
- asyncio - ERROR: Task was destroyed but it is pending!
task: <Task pending name='Task-6' coro=<send_request() running at /root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py:14>>
/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py:17: RuntimeWarning: coroutine 'send_request' was never awaited
  return await func(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
 asyncio - ERROR: Task was destroyed but it is pending!
task: <Task pending name='Task-7' coro=<send_request() running at /root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py:14>>
 evalscope - ERROR: Exception in async function 'benchmark': coroutine ignored GeneratorExit
Traceback (most recent call last):
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py", line 17, in async_wrapper
    return await func(*args, **kwargs)
RuntimeError: coroutine ignored GeneratorExit
Exception ignored in: <coroutine object benchmark at 0x7fab02ea7290>
Traceback (most recent call last):
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py", line 20, in async_wrapper
    sys.exit(1)
SystemExit: 1
asyncio - ERROR: Task exception was never retrieved
future: <Task finished name='Task-5' coro=<statistic_benchmark_metric() done, defined at /root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py:14> exception=SystemExit(1)>
Traceback (most recent call last):
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/handler.py", line 17, in async_wrapper
    return await func(*args, **kwargs)
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/benchmark.py", line 102, in statistic_benchmark_metric
    create_result_table(cursor)
  File "/root/miniconda3/envs/evalscope_1.1.1/lib/python3.10/site-packages/evalscope/perf/utils/db_util.py", line 59, in create_result_table
    cursor.execute(
sqlite3.OperationalError: database is locked

## 运行环境

- 操作系统：
- ubuntu 22.04.4
- Python版本：3.10

## 其他信息

如果有其他相关信息，请在此处提供。


你把本地的db文件删掉，再重新运行只有一个并发的测试试试问题还存在吗：`--parallel 1 --number 5`

> 感谢你的反馈！我们将关闭此问题。如果您有任何疑问，请随时重新打开它。如果EvalScope对您有所帮助，欢迎给我们点个STAR以示支持，谢谢！