scheduler.start state need to be set only at the end of the start() function
Opened this issue · 4 comments
Otherwise, monitor might start running before scheduler is fully started and query those components which are not initialized. It will run into a panic.
Hi, maybe you could describe in detail.
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.
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.
@lzl1024 You are right.
@hyper0x
E.g. :
- When the monitor is waiting for state change of scheduler at monitor.go line 193
- Then go to line 102 in scheduler.go the state of scheduler change to be running.
- 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.