joncrlsn / dque

dque is a fast, embedded, durable queue for Go
MIT License
767 stars 46 forks source link

Windows & leaking filedescriptors #3

Closed Kimbsen closed 4 years ago

Kimbsen commented 5 years ago

This doesn't seem to work at all on windows. Very few tests pass. This is mostly due to not closing segment files properly.

--- FAIL: TestSegment (0.02s)
        segment_test.go:82: Error cleaning up directory from the TestSegment method with 'remove ./TestSegment\0000000000001.dque: The process cannot access the file because it is being used by another process.'
--- FAIL: TestSegment_Turbo (0.00s)
        segment_test.go:111: Error creating directory in the TestSegment_Turbo method: mkdir ./TestSegment: Cannot create a file when that file already exists.
--- FAIL: TestQueue_AddRemoveLoop (0.01s)
        queue_test.go:75: Error cleaning up the queue directory remove test1\0000000000002.dque: The process cannot access the file because it is being used by another process.
--- FAIL: TestQueue_Add2Remove1 (0.00s)
        queue_test.go:88: Error removing queue directory remove test1\0000000000002.dque: The process cannot access the file because it is being used by another process.
--- FAIL: TestQueue_Add9Remove8 (0.00s)
        queue_test.go:154: Error removing queue directory remove test1\0000000000002.dque: The process cannot access the file because it is being used by another process.
--- FAIL: TestQueue_EmptyDequeue (0.00s)
        queue_test.go:240: Error cleaning up the queue directory: remove testEmptyDequeue\0000000000001.dque: The process cannot access the file because it is being used by another process.
--- FAIL: TestQueue_NewOrOpen (0.00s)
        queue_test.go:262: Error cleaning up the queue directory: remove testNewOrOpen\0000000000001.dque: The process cannot access the file because it is being used by another process.
--- FAIL: TestQueue_Turbo (0.00s)
        queue_test.go:269: Error removing queue directory: remove testNewOrOpen\0000000000001.dque: The process cannot access the file because it is being used by another process.
2019/01/24 14:38:32 Error creating new dque the given queue directory is not valid (/tmp)
exit status 1
FAIL    github.com/joncrlsn/dque        0.103s

The tests all seem to pass on nix but i'm guessing it is leaking filedescriptors there aswell.

joncrlsn commented 5 years ago

Thank you for finding this. I'm going to have to rethink how I handle files. The intent was to avoid closing it until it wasn't needed anymore. Wish I had a Windows machine to verify things on.

joncrlsn commented 4 years ago

This problem should be fixed now in the v2 branch (the fix did not break the API). I'm sorry it has taken so long. Please let me know if you still have this problem.

joncrlsn commented 4 years ago

Closing because I'm quite sure this issue has been fixed.