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

Find a way to pass config around processes on Windows #256

Open
ocaballeror opened this issue Feb 27, 2018 · 1 comment
Open

Find a way to pass config around processes on Windows #256

ocaballeror opened this issue Feb 27, 2018 · 1 comment
Assignees
Labels
Projects
Milestone

Comments

@ocaballeror
Copy link
Contributor

Related to #255

Since Windows can't fork to create new processes, and it must use spawn, global variables such as config are not being copied to child processes. We should find a way to work around this, otherwise config basically becomes a constant, and that's not the expected behaviour.

Maybe we should pass it as an extra attribute to AgentProcess and NameserverProcess?

@ocaballeror ocaballeror added this to the 0.7.0 milestone Feb 27, 2018
@ocaballeror ocaballeror self-assigned this Feb 27, 2018
@Peque Peque added this to TODO in Development Feb 27, 2018
@ocaballeror ocaballeror moved this from TODO to In progress in Development Mar 26, 2018
@ocaballeror
Copy link
Contributor Author

I have been playing around with this, with variable amounts of success.

I got the test_agent_bind_transport_global to work by passing the config as a parameter to the Agent constructor, and then using it to set the global variable inside __init__.

The linger test, though, I couldn't get to pass, and I'm still not sure why. One thing I noticed about the other one was that, when launching a windows process, __init__.py is executed again (which doesn't happen after a fork), and that overrides the config dictionary, so that's something to keep in mind.

In the end, I'm thinking the issue has something to do with the way and, specifically, the order in which python imports different modules, because even though Agent.close_all() and get_linger() are executed in the same process, they read different values for config['LINGER'], which is what eventually makes the thing fail.

All the progress (mostly hacks) I've made is saved in my config branch.

@ocaballeror ocaballeror mentioned this issue Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development
In progress
Development

No branches or pull requests

1 participant