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

Dequeue is failing while deleting the segment "The process cannot access the file because it is being used by another process" #30

Open
ysaik opened this issue Jul 20, 2021 · 3 comments

Comments

@ysaik
Copy link

ysaik commented Jul 20, 2021

Hi,
I was trying a simple program to enqueue and dequeue 10 elements. with segment size 5
its failing with below error
main.go and go.mod files attached
PS C:\Sai_laptop_backup\workspace\golang\dque_test> .\main.exe
Enqueued SAI100 1
Enqueued SAI101 2
Enqueued SAI102 3
Enqueued SAI103 4
Enqueued SAI104 5
Enqueued SAI105 6
Enqueued SAI106 7
Enqueued SAI107 8
Enqueued SAI108 9
Enqueued SAI109 10
Dequeued: &{SAI100 1}
Dequeued: &{SAI101 2}
Dequeued: &{SAI102 3}
Dequeued: &{SAI103 4}
2021/07/20 11:22:49 Error dequeuing item:error deleting queue segment C:/Sai_laptop_backup/workspace/golang/dque_test/item-queue/0000000000001.dque. Queue is in an inconsistent state: error deleting file: C:/Sai_laptop_backup/workspace/golang/dque_test/item-queue/0000000000001.dque: remove C:/Sai_laptop_backup/workspace/golang/dque_test/item-queue/0000000000001.dque: The process cannot access the file because it is being used by another process.

@ysaik
Copy link
Author

ysaik commented Jul 20, 2021

dque_test.zip

main.go and go.mod files are attached

It is failing to remove the first segment from the queue

@joncrlsn
Copy link
Owner

joncrlsn commented Jul 21, 2021

Hi, Thank you for reporting that. I don't have access to a Windows machine. If you figure it out and find a fix, please create a Pull Request. Or at least let me know what the fix is.

@malcolm-white-dti
Copy link

malcolm-white-dti commented Oct 5, 2023

This is an inherent bug with Golang, based on how files are created in Windows. There is a long thread on fixing and changing it (and the Linux people seemed to have won). One of the posts in there has a work around for it.

https://github.com/alexbrainman/goissue34681

I've implemented in a fork I am using, but I also had to make changes in the Flock library because it was using the same call/function.

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

3 participants