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

add monitor for relayer #16

Open
xiaoch05 opened this issue Apr 9, 2024 · 2 comments
Open

add monitor for relayer #16

xiaoch05 opened this issue Apr 9, 2024 · 2 comments

Comments

@xiaoch05
Copy link
Contributor

xiaoch05 commented Apr 9, 2024

  1. Why does relayer hang due to network issues?
  2. If relayer hangs, kill the process and restart it.
@fewensa
Copy link
Contributor

fewensa commented Apr 9, 2024

because some dependencies have internal check and throw exception. the relayer not handle these exceptions.
https://github.com/ethers-io/ethers.js/blob/ad5f1c5fc7b73cfb20d9012b669e9dcb9122d244/lib.commonjs/providers/provider-jsonrpc.js#L140-L182

image

You should add this listen to handle these exceptions wait next run.

    process.on('uncaughtException', (error) => {
      console.error(error.message)
      console.log('skip')
    })

but relayer program is use nest.js, maybe schedule exist can not restart again. that why i plan not use nest to develop slasher

@fewensa
Copy link
Contributor

fewensa commented Apr 9, 2024

e.g.

public async testError2() {
    new Promise((resolve, reject) => {
      try {
        throw new Error("hello");
      } catch (e: any) {
        reject(new Error("world"));
      }
    });
  }

async main() {
   try {
    await testError2(); // a. will undefined
    while(true) { console.log(1) } // b
    } catch(e) { console.log(e) }
}

e.g.

async function fnb() {
  new Promise((resolve, reject) => {
    reject(new Error('word'));
  });
}

async function fna() {
  return new Promise((resolve, reject) => {
    reject(new Error('Hello'))
  });
}

async function t1() {
  try { await fna() } catch(e) { console.log('---> a', e)}
  console.log('after a')
}

async function t2() {
  try { await fnb() } catch(e) {console.log('---> b', e)}
  console.log('after b');
}

try {
  t2()
    .then(() => console.log('done' ))
    .catch(e => console.log('====>', e));
} catch(x) {
  console.log('-=-=-=>', x);
}

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

2 participants