Code Monkey home page Code Monkey logo

cita-forever's Introduction

cita-forever

Licences

Apache License 2.0

cita-forever's People

Contributors

boundless-forest avatar dependabot-support avatar dependabot[bot] avatar driftluo avatar eighteenzi avatar jerry-yu avatar jjyr avatar kaikai1024 avatar kayryu avatar leeyr338 avatar pencil-yao avatar rink1969 avatar suyanlong avatar thewawar avatar u2 avatar volzkzg avatar yangby-cryptape avatar zeroqn avatar zhangsoledad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cita-forever's Issues

当存在 .pid 文件时,启动微服务可能出错

启动微服务出错场景:

  1. 节点目录下存在 .pid 文件;
  2. 在微服务启动前,存在一个与 .pid 文件中 pid 号相同的进程已经在执行;

以上场景会导致微服务启动失败,出错信息为:

WARN - cita-network already started, pid is 5617

其实这时,微服务是没有启动的。
见:
https://talk.citahub.com/t/topic/523/5
citahub/cita#407

更多信息:
程序在 check_process 中处理逻辑不正确。

// whether process exsit
fn check_process(pidfile: String) -> Option<u32> {
    // read pid from pidfile
    let pid: u32 = read_pid(pidfile);
    if pid == 0 {
        None
    } else {
        let pid_str = pid.to_string();
        let args = vec!["-p", &pid_str, "-o", "pid="];
        let output = Command::new("ps")
            .args(args)
            .output()
            .expect("failed to execute ps -p");
        if output.status.success() {
            let otpt_str = String::from_utf8(output.stdout).unwrap();
            if otpt_str.contains(&pid.to_string()) {
                Some(pid)
            } else {
                None
            }
        } else {
            None
        }
    }
}

程序需要检查 pid 号外,还需检查微服务名是否一致,才能判定微服务已经启动。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.