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

AV in race condition between auto-update and process recycle logic #274

Closed
tjanczuk opened this issue May 1, 2013 · 0 comments
Closed
Labels

Comments

@tjanczuk
Copy link
Owner

tjanczuk commented May 1, 2013

The test scenario is documented in #273, and dump is captured in #273 (comment).

Hypothesis: there is a race condition between the application recycle logic as a result of changes to the watched files, and the process recycle logic as a result of the node.exe process unexpectedly terminating which can happen while there are active HTTP requests in flight. This is the hypothetical timeline:

  1. Node.exe process terminates unexpectedly while there are active requests targeting this process in the system.
  2. CNodeProcessManager::RecycleProcess initiaties graceful shutdown of the CNodeProcess on a separate thread. This logic disassociates the CNodeProcess from CNodeProcessManager and then waits for all active requests processed by CNodeProcess to finish. This is the thread 18 in the dump.
  3. File watcher detects a change in the application files and initiates recycle of the entire application. In CNodeProcessManager::Recycle a graceful shutdown of all remaining processes is initiated on a separate thread. This logic has no knowledge of the existence of the CNodeProcess that was previously disassociated in step 2. When all CNodeProcess instances still associated with the application finish processing their active requests, the CNodeApplication is deleted.
  4. Processing of an HTTP request active in the CNodeProcess that started graceful recycle in step 2 attempts to write to event log which request referencing the CNodeProcessManager and CNodeApplication associated with that CNodeProcess, both of which have been deleted at this point. This is thread 15 in the dump which causes an AV.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant