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

Clean daemons & http shutdown #63

Merged
merged 12 commits into from
Jun 9, 2015

Conversation

gst
Copy link
Contributor

@gst gst commented Jun 8, 2015

Basically: join the main http thread (and in it join all the http client threads) when stopping an alignak daemon, so that no http thread is left running while everything is closed (which can, and have already, be harmful) .

+ some cleaning

  • some better logs
  • few fixes related to http.

@gst
Copy link
Contributor Author

gst commented Jun 9, 2015

don't merge directly... have to verify some thing..

@gst gst changed the title Clean daemons & http shutdown [WIP] Clean daemons & http shutdown Jun 9, 2015
Grégory Starck added 12 commits June 9, 2015 12:13
do_stop() does join() on the http thread..
and apparently generated some trouble from time to time (race condition).
and don't import * but just what's used.
so that if creating the server fails then the lock is available.
+ renamed shutdown() to close_sockets()
+ better logs
+ don't use the lock to start&stop the main http thread (don't know the reason of this, doesn't seem necessary to me)
+ no need to inspect for the manager.start() special case in py26 ..
because we do kill the proc pid at the end.
wait_for_initial_conf() is "buggy" since we moved from Pyro to http for communication,
because handleRequest() -> get_socks_activity() calls select() with empty sock set,
resulting in a sleep() behavior.
Given requests coming from clients should come directly once the connection is established,
use an hardcoded timeout for the client socket. 10 secs is rather conservative actually, should be safe.
A more agressive timeout (like 5 secs) could also be safely used.

This prevents bad clients from blocking http threads.
@gst gst changed the title [WIP] Clean daemons & http shutdown Clean daemons & http shutdown Jun 9, 2015
@gst
Copy link
Contributor Author

gst commented Jun 9, 2015

ok that's a first quick clean / fix ; I think it's preferable to merge it as it..

There will be anyway others passes and (big) clean/changes/rewrite on the http_daemon module so let's go..

ddurieux pushed a commit that referenced this pull request Jun 9, 2015
@ddurieux ddurieux merged commit 30a7cfb into Alignak-monitoring:develop Jun 9, 2015
@gst gst deleted the clean_daemons_shutdown branch June 9, 2015 21:23
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.

None yet

2 participants