wyx2685 / v2board

🚀A multiple proxy protocol manage panel application interface
MIT License
615 stars 187 forks source link

[BUG]StatUserJob使用foreach会造成数据库死锁 #149

Closed amdyes66 closed 1 week ago

amdyes66 commented 1 week ago

🙇‍♂️🙇‍♂️🙇‍♂️注意:XrayR等非V2Board问题请前往项目方提问 🙇‍♂️🙇‍♂️🙇‍♂️Note: XrayR and other non-V2Board issues please go to the project side to ask questions

The V2Board version number you are using 当前使用的V2Board版本号

1.7.5

Briefly describe the problem you are experiencing 简单描述你遇到的问题

大量failed_jobs,StatUserJob使用foreach会造成数据库死锁

Screenshot of the reported error(Please do desensitization) 报告错误的截图(请做脱敏处理)

Screenshot of the reported error(Please do desensitization) 报告错误的截图(请做脱敏处理)

The latest log files in the storage/logs directory report from #1 (Please do desensitization) storage/logs 目录下最新的日志文件从 #1 开始报告(请做脱敏处理)

Symfony\Component\HttpKernel\Exception\HttpException: 用户统计数据失败SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction (SQL: select * from v2_stat_user where record_at = XXXXX and server_rate = 1 and user_id = XXX limit 1 for update)

wyx2685 commented 1 week ago

反思反思是不是面板机实力太差哈哈哈哈 这一块代码是想优化性能,代价就是容易死锁

wyx2685 commented 1 week ago

先按流量消费的优化方案了 https://github.com/wyx2685/v2board/compare/870ec9dec87a...d3db08f8f254