Skip to content

高频同文件并发读写场景下,下载文件概率性空文件 #219

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

Open
weigod0122 opened this issue Mar 23, 2025 · 4 comments
Open

Comments

@weigod0122
Copy link

No description provided.

@codeskyblue
Copy link
Owner

有没有可能是下载软件的问题

@weigod0122
Copy link
Author

weigod0122 commented Mar 24, 2025

用的是curl下载,一个func内既有上传文件(curl -u XXX:XXX http://10.253.0.2:8001 -F [email protected])的部分又有下载文件(curl -u XXX:XXX http://10.253.0.2:8001/XXX.json -O)的部分,func在不同节点(总计四台服务器)上每台同时起500+的goroutine,最后共计有4-6个func下载的文件(XXX.json)是空的,现在给上传和下载加了读写锁,就没有下载失败的问题了

@codeskyblue
Copy link
Owner

奥,猜测应该 是上传的时候会有一小段时间,会将文件至为空。所以下载有概率下载到空文件。

@weigod0122
Copy link
Author

嘶😂,文件覆盖的时候能加锁不,阻塞一下读取请求

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants