Skip to content
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

Bug: Error process of GetQueuedCompletionStatus in syelogd.cpp. #264

Open
qieziting opened this issue Nov 16, 2022 · 0 comments
Open

Bug: Error process of GetQueuedCompletionStatus in syelogd.cpp. #264

qieziting opened this issue Nov 16, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@qieziting
Copy link

Describe the bug
When I use syslog to test my project, I found there is a bug in error process of GetQueuedCompletionStatus in syslogd.cpp (line 334).
The else branch will never be triggered.
And in this logic if client closed a piep, a work thread will exit.

       if (!b || lpo == NULL) {
            fKeepLooping = FALSE;
            MyErrExit("GetQueuedCompletionState");
            break;
        }
        else if (!b) {
            if (pClient) {
                if (GetLastError() == ERROR_BROKEN_PIPE) {
                    LogMessageV(SYELOG_SEVERITY_INFORMATION, "Client closed pipe.");
                }
                else {
                    LogMessageV(SYELOG_SEVERITY_ERROR,
                                "GetQueuedCompletionStatus failed %d [%p]",
                                GetLastError(), pClient);
                }
                CloseConnection(pClient);
            }
            continue;
        }

Expected behavior
I thought thread will exit only when both return value is false and lpo is NULL, as description in doc of GetQueuedCompletionStatus:

If a call to GetQueuedCompletionStatus fails because the completion port handle associated with it is closed while the call is outstanding, the function returns FALSE, *lpOverlapped will be NULL, and GetLastError will return ERROR_ABANDONED_WAIT_0.

I will create a PR for it.

Detours version

current master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant