dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Bug][master server ] when get exception,dead loop can not get out

Open crazycarry opened this issue 5 years ago • 5 comments

when i upgrade ds to 1.3.3, i find a bug like before ,in the class MaterSchedulerService


   public void run() {
        logger.info("master scheduler started");
        while (Stopper.isRunning()){
            InterProcessMutex mutex = null;
            try {
                boolean runCheckFlag = OSUtils.checkResource(masterConfig.getMasterMaxCpuloadAvg(), masterConfig.getMasterReservedMemory());
                if(!runCheckFlag) {
                    Thread.sleep(Constants.SLEEP_TIME_MILLIS);
                    continue;
                }
                if (zkMasterClient.getZkClient().getState() == CuratorFrameworkState.STARTED) {

                    mutex = zkMasterClient.blockAcquireMutex();

                    int activeCount = masterExecService.getActiveCount();
                    // make sure to scan and delete command  table in one transaction
                    Command command = processService.findOneCommand();
                    if (command != null) {
                        logger.info("find one command: id: {}, type: {}", command.getId(),command.getCommandType());

                        try{

                            ProcessInstance processInstance = processService.handleCommand(logger,
                                    getLocalAddress(),
                                    this.masterConfig.getMasterExecThreads() - activeCount, command);
                            if (processInstance != null) {
                                logger.info("start master exec thread , split DAG ...");
                                masterExecService.execute(new MasterExecThread(processInstance, processService, nettyRemotingClient));
                            }
                        }catch (Exception e){
                            logger.error("scan command error ", e);
                            processService.moveToErrorCommand(command, e.toString());
                        }
                    } else{
                        //indicate that no command ,sleep for 1s
                        Thread.sleep(Constants.SLEEP_TIME_MILLIS);
                    }
                }
            } catch (Exception e){
                logger.error("master scheduler thread error",e);
            } finally{
                zkMasterClient.releaseMutex(mutex);
            }
        }
    }

when the db get a error or some other exception,the loop do not hava any function to down it

crazycarry avatar Dec 15 '20 02:12 crazycarry

I will fix it.

zt-1997 avatar Dec 25 '20 10:12 zt-1997

I don't think it should be closed here. There is no difference between exit and close master server .

CalvinKirs avatar Dec 25 '20 11:12 CalvinKirs

Deplly thanks for your enthusiastic participation, about this question, I don't think it is a BUG, in fact, when such problems, we should consider is that mysql is health problem, or is the version of adaptation problem, etc., you can see, we here have a sleep time, is actually based on this design is also considered the Circuit Breaker. If you quit abruptly, it's the same as shutting down the service.

CalvinKirs avatar Dec 28 '20 07:12 CalvinKirs

I will fix it.

Deplly thanks for your enthusiastic participation, if you are interested, you can from https://github.com/apache/incubator-dolphinscheduler/issues/4124 looking for tasks you like inside, if you need any help, can also issue the message the first time.

CalvinKirs avatar Dec 28 '20 07:12 CalvinKirs

This issue is not a bug. It will be closed because no update for a long time. You can reopen it if need.

caishunfeng avatar Jan 04 '22 14:01 caishunfeng