tokenika / eosfactory

Python-based EOS smart-contract development & testing framework
http://eosfactory.io/
Other
243 stars 62 forks source link

Intercept and show errors from nodeos #130

Closed rkintzi closed 5 years ago

rkintzi commented 5 years ago

Current behavior: EOS Factory ignores errors from nodeos.

Requested behavior: EOS Factory should intercept errors print them to the console and try restart nodeos only in case it makes sense (has a chance to succeed).

Steps to reproduce:

  1. Install EOS Factory and deps (nodeos-1.6.0).
  2. To a ./localnode/config.ini file add following lines (or any other non-existent option):
    # maximum sizes of transaction or block messages that are sent without first sending a notice (eosio::net_plugin)
    max-implicit-request = 1500
  3. Try run example tests:
    python3 tests/01_hello_world.py
  4. Observe how nodeos is started twice without any message about the encountered error.
  5. Run nodeos by hand (and see the error):
    $ /usr/bin/nodeos --http-server-address 127.0.0.1:8888 --data-dir /home/radek/projects/eosfactory/localnode/ --config-dir /home/radek/projects/eosfactory/localnode/ --chain-state-db-size-mb 200 --contracts-console --verbose-http-errors --enable-stale-production --producer-name eosio --signature-provider EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_api_plugin --genesis-json /home/radek/projects/eosfactory/localnode/genesis.json --delete-all-blocks
    error 2019-01-28T13:05:29.858 thread-0  main.cpp:135                  main                 ] Throw location unknown (consider using BOOST_THROW_EXCEPTION)
    Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >
    std::exception::what: unrecognised option 'max-implicit-request'
    $ echo $?
    254
stefanzarembinski commented 5 years ago

This 'current' behavior is due to an error in the code. With this error, the nodeos fails in the following way:

    cartman@cartman-PC:/mnt/c/Workspaces/EOS/eosfactory$ python3 tests/01_hello_world.py

    ###  SCENARIO:
    Create a contract from template, then build and deploy it.

    Local node is stopped [].
    ..........Local node is stopped [].
    ..........Local node is stopped [].
    Local node is stopped [].
    E
    ======================================================================
    ERROR: setUpClass (__main__.Test)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
    eosfactory.core.errors.Error: ERROR:
    The local node does not respond.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    eosfactory.core.errors.Error: ERROR:
    The local node does not respond.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    eosfactory.core.errors.Error: ERROR:
    The local ``nodeos`` failed to start twice in sequence. Perhaps, something is
    wrong with configuration of the system. See the command line issued:

Now, in a working branch, the error is corrected and the right code will be published with the next edition.

The exception behavior is following:

This is a log of the described action:

    cartman@cartman-PC:/mnt/c/Workspaces/EOS/eosfactory$ python3 tests/01_hello_world.py

    ###  SCENARIO:
    Create a contract from template, then build and deploy it.

    Local node is stopped [].
    ..........Local node is stopped [2474, 2475].
    ..........Local node is stopped [].
    Local node is stopped [].
    ERROR:
    The local ``nodeos`` failed to start twice in sequence. Perhaps, something is
    wrong with configuration of the system. See the command line issued:

    /usr/bin/nodeos --http-server-address 127.0.0.1:8888 --data-dir /mnt/c/Workspaces/EOS/eosfactory/localnode/ --config-dir /mnt/c/Workspaces/EOS/eosfactory/localnode/ --chain-state-db-size-mb 200 --contracts-console --verbose-http-errors --enable-stale-production --producer-name eosio --signature-provider EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_api_plugin --genesis-json /mnt/c/Workspaces/EOS/eosfactory/localnode/genesis.json --delete-all-blocks

    Now, see the result of execution of the command line:
    Exception in thread Thread-3:
    Traceback (most recent call last):
    eosfactory.core.errors.Error: ERROR:
    error 2019-01-29T11:38:54.524 thread-0  main.cpp:135                  main                 ] Throw location unknown (consider using BOOST_THROW_EXCEPTION)
    Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >
    std::exception::what: unrecognised option 'abi-serializer-max-time-msX'

    Local node is stopped [].
stefanzarembinski commented 5 years ago
Thank you for your contribution. We include it to the next edition of EOSFactory.