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

Fixes forking for workers. Should not corrupt pg connection anymore. #218

Closed

Conversation

Inviz
Copy link
Contributor

@Inviz Inviz commented May 14, 2014

Alternative solution for #207 forking

To achieve correct forking, all SQL-queries are moved out to the parent process, so child process only does the workload and marshals result back to parent process. Forked workers should NOT re-use parent connection (sanity check added).

The code makes use of exit!(0) command, that triggers fast exit from a forked process, so postgres does not have a chance to close the connection.

Adds specs for forked workers success/failure, mixed workers, connection reuse exception.

To achieve that, all logging actions are moved out to the parent process, so child process only does the workload and marshals it back to parent process. Forked workers should NOT re-use parent connection (sanity check added).

The code makes use of exit!(0) command, that triggers fast exit from a forked process, so postgres does not close the forked connection.

Adds specs for forked workers success/failure, mixed workers, connection reuse exception.
@Inviz Inviz closed this May 14, 2014
@Inviz Inviz deleted the forking_without_reused_connection branch May 14, 2014 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant