-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix super flaky tfdleak
test on windows refs #14090
#14548
fix super flaky tfdleak
test on windows refs #14090
#14548
Conversation
7d15be7
to
c12b7de
Compare
I'm sorry, but this is not a fix.
I'd be curious as to what is being used under that handle, maybe it's the various DLLs that's loaded by the program (due to |
Imported from nim-lang#14548 and tweaked for consumption by testament. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
it's a fix for the flakiness but doesn't close #14090; the point was the test was flawed and needs a better test on windows; until then it doesn't make sense to have CI keep breaking; but if you have a better fix, I'm all for it |
c12b7de
to
fda450e
Compare
Imported from nim-lang#14548 and tweaked for consumption by testament. This test seems to be really good at bringing out the flakyness of tfdleadk. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* tfdleak_multiple: introduce stress tester for tfdleak Imported from #14548 and tweaked for consumption by testament. This test seems to be really good at bringing out the flakyness of tfdleadk. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * tfdleak: increase accuracy of the test on Windows This commit implements a new testing strategy for Windows: 1. We duplicate the handle that will be tested and enable inheritance. This duplicate will serve as a reference handle. 2. In addition to checking whether the handle is valid, we also verify whether the handle is the same as the reference. This gives us complete certainty on whether the handle in question is inherited from the parent. A side effect is that this uses Windows 10+ APIs. But since this is just for the test, we don't have to be picky about it. Ideally we would want to do something like this for other POSIX-based system, but most of them lack a facility to do this, and as of writing there isn't any false positive for them, so we won't need the additional checks. MemFile.fHandle will also no longer be tested, as this handle defaults to being invalid. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
@timotheecour please help me I am getting this error, which you mentioned.
Is there a way to fix that in nim? Is there a way to downgrade VC++ to a version that works? What would you recommend? |
A solution was found here: #14980 Thanks! |
tfdleak
is probably the most flaky test we have; this PR fixes that by establishing thatisValidHandle
is incorrect and ignoring when is returns trueI did some research (not being a windows user...), it's a a tricky topic but from what I gathered:
tests/stdlib/mfdleakIssue14090.nim
which on windows will always fail (and always succeed on linux+osx)my "fix" is to disable the test in the case where a leak is not expected and windows sees a leak, since isValidHandle has false positives
future work
getHandleInformation
(next step towards closing tests/stdlib/tfdleak is flaky on windows + netbsd #14090)incorrect types should be fixed
I've also encountered a number of types that are incorrect (and could lead to other subtle bugs on windows), eg:
proc getOsfhandle(fd: cint): FileHandle
=> should beproc getOsfhandle(fd: cint): Handle
(FileHandle is cint whereas Handle is int or castable as int); see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=vs-2019
proc setHandleInformation(handle: FileHandle, mask, flags: culong): cint {.importc: "SetHandleInformation", header: "<handleapi.h>".}
is also incorrect according to https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-sethandleinformation
=> 1st param should be Handle not FileHandle
winlean should really use distinct types eg
BOOL
,DWORD
etc, which would make it much safer to use those bug prone window APIS