Open xuxiaofan1203 opened 1 month ago
... in the test functions?? Do you have an PR?
... in the test functions?? Do you have an PR?
Yes, the bug is in the test functions mentioned above. I found the bug, but I'm not sure how to fix it. So I haven't submitted an PR.
For the lock and condition variable, if the testShutdownNotify.Wait() get executed very late, some goroutine will leak. https://github.com/miekg/dns/blob/b77d1ed8e9282cadf21c4124f53a660fed55c8ca/server_test.go#L733-L735 The interleaved sequence that trigger bugs can be reproduced by adding
time.Sleep
to make Wait() executes late like this:After that, you can use goleak to reproduce the bug in the test function. https://github.com/miekg/dns/blob/b77d1ed8e9282cadf21c4124f53a660fed55c8ca/server_test.go#L825 Some outputs about the bug from goleak are as follows: