eos icon indicating copy to clipboard operation
eos copied to clipboard

Eixt nodeos gracefully if db size is smaller than snapshot size

Open softprofe opened this issue 3 years ago • 4 comments
trafficstars

Change Description

For EPE 894, if db size if set to smaller than snapshot size, it will print bad_alloc and throw. After this PR, give a meaningful print and gracefully shutdown.

Change Type

Select ONE:

  • [ ] Documentation
  • [x] Stability bug fix
  • [ ] Other
  • [ ] Other - special case

Testing Changes

Select ANY that apply:

  • [ ] New Tests
  • [ ] Existing Tests
  • [ ] Test Framework
  • [ ] CI System
  • [ ] Other

Consensus Changes

  • [ ] Consensus Changes

API Changes

  • [ ] API Changes

Documentation Additions

  • [ ] Documentation Additions

softprofe avatar Dec 08 '21 02:12 softprofe

This fix is not better it indicates success on exit.

After this PR, It print two red marked lines to let user know error happened. as below: error 2021-12-08T02:34:32.713 thread-0 controller.cpp:531 startup ] db storage not configured to have enough storage for the provided snapshot, please increase and retry snapshot error 2021-12-08T02:34:32.713 thread-0 controller.cpp:539 startup ] Failed initialization from snapshot

The final line says nodeos successfully exiting just let user know it is not crashed. info 2021-12-08T02:34:32.715 thread-0 main.cpp:179 main ] nodeos successfully exiting

I think for most people and most company, a crashed-like end is not recommend. @nksanthosh please make decision we will have this PR or not.

softprofe avatar Dec 08 '21 17:12 softprofe

This fix is not better it indicates success on exit.

@heifner - can you elaborate what you are suggesting here? (exit with a non zero error code? or something else?)

nksanthosh avatar Dec 13 '21 19:12 nksanthosh

the node failed to start, so non-zero exit code seems correct here.

matthewdarwin avatar Dec 13 '21 19:12 matthewdarwin

@heifner - can you elaborate what you are suggesting here? (exit with a non zero error code? or something else?)

The reported issue was that all that was reported was bad alloc. The actual error was indicated before the bad alloc error. All I think we need to do is change nodeos main.cpp catch of boost::interprocess::bad_alloc to indicate that the likely issue is chainbase exhaustion and to look for previously reported errors.

We still want nodeos to return BAD_ALLOC return code 1 in this case.

heifner avatar Dec 13 '21 19:12 heifner