Skip to content

请问项目在tars里面启动服务之后,又被停止服务是什么问题? #1

Open

Description

@ronylee

项目在tars里面启动服务之后,又被停止服务,通过查找日志,程序是正常启动的没有报错,被停止的时候,项目目录下会生成 tars_stop.sh 这个脚本,发布历史记录提示:
[ServantProxy::invoke timeout:3000,servant:tars.tarsAdminRegistry.AdminRegObj,func:restartServer,adaptertcp -h 172.17.0.3 -p 12000,reqid:393]
这个明显是外部停止的,不是程序问题,估计是tars干掉的,请问是什么原因导致的 ?

Activity

  1. dpp2009 commented on Oct 24, 2019

    @dpp2009
    Owner

    确认下服务上报存活是否正常 比如服务名是否正确等等

  2. ronylee commented on Oct 24, 2019

    @ronylee
    Author
    public function keepAlive($masterPid)
    {
        if( $masterPid<1 ){
            return;
        }else{
            $adapter = $this->tarsName.'.objAdapter';
            $application = $this->appName;
            $serverName = $this->serverName;
    
            $nodeInfo = $this->getNodeInfo();
            if( empty($nodeInfo) ){
                var_dump('keepAlive getNodeInfo fail');
                return null;
            }
            $host = $nodeInfo['host'];
            $port = $nodeInfo['port'];
            $objName = $nodeInfo['objName'];
    
            $serverInfo = new ServerInfo();
            $serverInfo->adapter = $adapter;
            $serverInfo->application = $application;
            $serverInfo->serverName = $serverName;
            $serverInfo->pid = $masterPid;
    
            $serverF = new ServerFSync($host, $port, $objName);
            $serverF->keepAlive($serverInfo);
    
            $adminServerInfo = new ServerInfo();
            $adminServerInfo->adapter = 'AdminAdapter';
            $adminServerInfo->application = $application;
            $adminServerInfo->serverName = $serverName;
            $adminServerInfo->pid = $masterPid;
            $serverF->keepAlive($adminServerInfo);
    
            var_dump(' keepalive ');
        }
    }
    

    这里主进程启动上报成功,还一个10秒定时上报的也成功,服务名字和tars上一致

  3. ronylee commented on Oct 25, 2019

    @ronylee
    Author

    服务一启动 master 进程直接退出,不知道什么原因

  4. dpp2009 commented on Oct 25, 2019

    @dpp2009
    Owner

    试着在非tars环境用脚本启动服务(copy到非tars目录执行) 确认下是否服务本身问题

  5. ronylee commented on Oct 25, 2019

    @ronylee
    Author

    确认过了,我重新在github拉了一份,简单的修改端口和cache_size配置之后,在运行tars的同一个docker环境下的非tars目录下启动运行正常的,主进程没挂,定时执行keepalive,然后我把原来的服务删除,重新拉代码发布到tars,就可以正常发布。

    但是又有新的问题,第一次发布服务启动正常,停掉后,重启就起不来了,观察到它,执行 tars_start.sh 之后就立马执行tars_stop.sh 相差只有一秒,但进入服务器手动执行 tars_start.sh 就正常了不会退出

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions