Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

find a workaround to mitigate failures of GetExtendedTcpTable() #17

Open
xilun opened this issue Jul 31, 2016 · 1 comment
Open

find a workaround to mitigate failures of GetExtendedTcpTable() #17

xilun opened this issue Jul 31, 2016 · 1 comment

Comments

@xilun
Copy link
Owner

xilun commented Jul 31, 2016

GetExtendedTcpTable() sometimes miserably fails and returns 0xc0000001 (NT status generic error)
(This prevents a command from being launched when this occurs.)

I must find a workaround to mitigate the effect of such failures. Calling GetExtendedTcpTable() again in a loop in this case is not efficient enough (I still have some failures after 5 retries...)

@xilun
Copy link
Owner Author

xilun commented Aug 1, 2016

8ca3301 improves the reliability a lot.

It actually mainly do retry in a loop (for at most 5 times) but it seems that failures might be more common when launching cygwin processes and/or launching outbash.exe from within VS IDE. Also it comes with exp increase of buffer size (to amortize worst case complexity) and a buffer size of 8 extra bytes (as in the SIZEOF_TCPTABLE_OWNER_PID macro of the SDK)

I did some other attempts with other or less changes, and they did not work. (It was: avoiding reentrancy of GetExtendedTcpTable() with a mutex at various levels, only 8 extra bytes for alloc, and only using exp increase of buffer size.)

When tested in standalone (launched without VS IDE) in a loop with four client caller threads each launching 200 non-cygwin processes as fast as possible, 9 seconds of relaxation, tasklist and taskkill, keeping the test running for dozens of hours, I was not able to get a single 0xc0000001 failure not mitigated by the retry loop in version 8ca3301 -- even when trying to also simultaneously load the system by other means.

So I ship this mitigation. I keep this issue open for now for ref; the error message in case the mitigation is not enough is: outbash: CConnection::run() exception: GetExtendedTcpTable: unknown error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant