gsliepen / tinc

a VPN daemon
http://tinc-vpn.org/
Other
1.87k stars 280 forks source link

Assertion failures on exit in tinc/tincd built with MSVC #361

Closed hg closed 2 years ago

hg commented 2 years ago

How to reproduce them:

They both crash with the same message:

image

and then

image

These values always seem to be way higher than the maximum possible 64 (at least in the 300-400 range).

I tracked these messages down to here:

https://github.com/gsliepen/tinc/blob/50c62f7235eacd3b88c59ead983e8be719fb7604/src/tincctl.c#L647

https://github.com/gsliepen/tinc/blob/50c62f7235eacd3b88c59ead983e8be719fb7604/src/net_setup.c#L1184

and at least a few other places.

My knowledge of Windows is really superficial, but as far as I understand it these fds are not really file descriptors, but OS handles, so they should be closed with CloseHandle().

Replacing every close() with CloseHandle() (by creating a new define in dropin.h) seems to do the trick (except for cross-compilation to x86, there are other issues there).

I'd like to finish the test suite first so I didn't look too much into it. Maybe some of those fds really are fds.

hg commented 2 years ago

This should be fixed by b9a7444b9fa216d16d91f34d2e12f51fc4d60e46.