EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

Set contract eosio.system error 3080006: transaction took too long (2) #3150

Closed keisuke-kanao closed 6 years ago

keisuke-kanao commented 6 years ago

Although this issue was closed in #2977, I still have the same issue under Dawn 4.0. First, regarding "-x, --expiration" option, I confirmed this works with:

$ cleos set contract eosio build/contracts/eosio.bios -x 600s -p eosio
Reading WAST/WASM from build/contracts/eosio.bios/eosio.bios.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: 3aaecb5e614c74787df9bf9bca561c54d34524757df0610817de5b7c13da352e  3248 bytes  1397 us

$ cleos get transaction 3aaecb5e614c74787df9bf9bca561c54d34524757df0610817de5b7c13da352e
...
    "trx": {
      "expiration": "2018-05-17T01:50:16",
...
  "block_time": "2018-05-17T01:40:17.000",
...

But with this option, "contract eosio build/contracts/eosio.system ..." still failed, as below:

$ cleos set contract eosio build/contracts/eosio.system -x 600s -p eosio
Reading WAST/WASM from build/contracts/eosio.system/eosio.system.wasm...
Using already assembled WASM...
Publishing contract...
Error 3080006: transaction took too long
Error Details:
deadline exceeded

So I don't think the transaction time is the main cause of this issue.

I tried other variations of "cleos set contract ..." as below, that indicated another error:

$ cleos set contract eosio build/contracts/eosio.system/eosio.system.wast build/contracts/eosio.system/eosio.system.abi -x 600s -p eosio
Reading WAST/WASM from build/contracts/eosio.system/eosio.system.abi...
Assembling WASM...
3106608ms thread-0   main.cpp:2366                 main                 ] Failed with error: Assert Exception (10)
!"error parsing wast": Error parsing WebAssembly text file:
:1:1: expected '('
{
^
$ cleos set contract eosio build/contracts/eosio.system/eosio.system.wasm build/contracts/eosio.system/eosio.system.abi -x 600s -p eosio
Reading WAST/WASM from build/contracts/eosio.system/eosio.system.abi...
Assembling WASM...
3216534ms thread-0   main.cpp:2366                 main                 ] Failed with error: Assert Exception (10)
!"error parsing wast": Error parsing WebAssembly text file:
:1:1: expected '('
{ 

Please let me know what exactly I should to to solve this issue.

cppfuns commented 6 years ago

you can try cleos set contract build/contracts/eosio eosio.system -x 1000

keisuke-kanao commented 6 years ago

I tried below and got the same error: $ cleos set contract eosio build/contracts/eosio.system -x 1000 -p eosio

keisuke-kanao commented 6 years ago

If I specified "-x 1000": $ cleos set contract eosio build/contracts/eosio.system -x 1000 -p eosio then, I go the exception log from nodeos, as follows:

1018257ms thread-0   chain_api_plugin.cpp:79       operator()           ] Exception encountered while processing chain.push_transaction: 3080006 deadline_exception: transaction took too long                                                                  
deadline exceeded                                                                                                               
    {"now":"2018-05-17T08:16:58.256","deadline":"2018-05-17T08:16:58.255","start":"2018-05-17T08:16:58.226"}                    
    thread-0  transaction_context.cpp:287 checktime                                                                             

    {"_pending_console_output.str()":""}                                                                                        
    thread-0  apply_context.cpp:55 exec_one

The corresponding parts in apply_context.cpp are as follows:

   void transaction_context::checktime()const {
      auto now = fc::time_point::now();
      if( BOOST_UNLIKELY( now > _deadline ) ) {
         if( billed_cpu_time_us > 0 || deadline_exception_code == deadline_exception::code_value ) {
            EOS_THROW( deadline_exception, "deadline exceeded", ("now", now)("deadline", _deadline)("start", start) );
         }

From the above, it seems to be natural that an exception occurred because of "now" > "deadline". I tested with a few other expiration value, all resulted in "now" > "deadline".

If I didn't specify an expiration value: $ cleos set contract eosio build/contracts/eosio.system -p eosio then, the exception log from nodeos was as follows:

1081742ms thread-0   chain_api_plugin.cpp:79       operator()           ] Exception encountered while processing chain.push_transaction: 3080006 deadline_exception: transaction took too long                                                                  
deadline exceeded                                                                                                               
    {"now":"2018-05-17T08:18:01.742","deadline":"2018-05-17T08:18:01.742","start":"2018-05-17T08:18:01.713"}                    
    thread-0  transaction_context.cpp:287 checktime
cppfuns commented 6 years ago

You try again like this cd eos/build make install then , cleos set contract eosio build/contracts/eosio.system -x 1000 -p eosio

keisuke-kanao commented 6 years ago

I already did build and install processes with two PCs (one is Core i7 and another is Core i5, both have 8 GB of RAM), a few times each, all resulted in the same error. Howerver, maybe I will do that later again.

dfguo commented 6 years ago

add this to config.ini max-transaction-time=1000

keisuke-kanao commented 6 years ago

Thanks dfguo.

Under Dawn 4.1 and based on https://github.com/EOSIO/eos/wiki/Tutorial-Bios-Boot-Sequence, I did below successfully:

$ nodeos --max-transaction-time=1000 --resync

$ cleos create key  # for eosio.token
$ cleos wallet import ...
$ cleos create account eosio eosio.token ...
$ cleos set contract eosio.token build/contracts/eosio.token
$ cleos push action eosio.token create '[ "eosio", "10000000000.0000 SYS", 0, 0, 0]' -p eosio.token
$ cleos push action eosio.token issue '[ "eosio", "1000000000.0000 SYS", "memo" ]' -p eosio

$ cleos set contract eosio build/contracts/eosio.system
Reading WAST/WASM from build/contracts/eosio.system/eosio.system.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: 901b98f873d67a084ed8e6ea50453e474935e44865ffcef42289e8878198a9fa  40440 bytes  5248 us
qimiaoguo commented 6 years ago

thanks

chrisli30 commented 5 years ago

Thank you! This solved "3080006: transaction took too long" which was happened too frequent for me.

Not familiar with restart process I had to build a new docker container though. The trick is in the last parameter "--max-transaction-time=1000"

docker run --name eosio \ --publish 7777:7777 \ --publish 127.0.0.1:5555:5555 \ --volume /Users/Venomancer/Documents/docker/contracts:/Users/Venomancer/Documents/docker/contracts \ --detach \ eosio/eos \ /bin/bash -c \ "keosd --http-server-address=0.0.0.0:5555 & exec nodeos -e -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_plugin --plugin eosio::history_api_plugin --plugin eosio::http_plugin -d /mnt/dev/data --config-dir /mnt/dev/config --http-server-address=0.0.0.0:7777 --access-control-allow-origin= --contracts-console --http-validate-host=false --filter-on='' --max-transaction-time=1000"

varshadqz commented 4 years ago

I set

--max-transaction-time=1000

still getting same issue. Any other alternative?

chrisli30 commented 4 years ago

I set

--max-transaction-time=1000

still getting same issue. Any other alternative?

Sorry no comment on this any more. The EOS core update breaks back-compatibility and I don't follow closely now.