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

scheduler.start state need to be set only at the end of the start() function #4

Open
lzl1024 opened this issue Mar 9, 2016 · 4 comments

Comments

@lzl1024
Copy link

lzl1024 commented Mar 9, 2016

Otherwise, monitor might start running before scheduler is fully started and query those components which are not initialized. It will run into a panic.

@hyper0x
Copy link
Owner

hyper0x commented Apr 14, 2016

Hi, maybe you could describe in detail.

@lzl1024
Copy link
Author

lzl1024 commented Apr 14, 2016

scheduler.go line 102 has to be put to the end of the start function, because scheduler actually has not been fully started yet at that time. Downloader, analyzer are all not initialized.

However, monitor is waiting for this stat change and will query those components afterwards. So there will be a risk condition when those initializing components are queried by the monitor.

@hyper0x
Copy link
Owner

hyper0x commented Apr 25, 2016

OK, sometimes there will be a problem, although it seems had little effect. What do you do to improve it? Welcome to send PR. :-)

In fact, it's to prevent repeated start.

@SwanSpouse
Copy link

@lzl1024 You are right.
@hyper0x
E.g. :

  1. When the monitor is waiting for state change of scheduler at monitor.go line 193
  2. Then go to line 102 in scheduler.go the state of scheduler change to be running.
  3. After that Function "waitForSchedulerStart" returns, and it runs to line 201 in monitor.go. But at that time, the ErrorChan is not initialized. So it occurs a nil pointer panic.

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

No branches or pull requests

3 participants