Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Command doesn't return and stuck at Saving artifacts... when using hdwallet provider. #14

Open
Janaka-Steph opened this issue Aug 8, 2017 · 60 comments

Comments

@Janaka-Steph
Copy link

Hello,

I have a minor issue with truffle migrate. It deploys my contracts fine to any network but the console will be stuck at the end on Saving artifacts... and doesn't return.

Thank you

@rguikers
Copy link

Same problem here. Keeps polling for eth_getBlockByNumber but never returns. In my case I have my own provider based on web3-provider-engine. Wondering what triggers the exit(0) after the last migration step.

@Techworker
Copy link

@Janaka-Steph Were you able to resolve that issue? I have the same problem.

@rguikers
Copy link

rguikers commented Oct 5, 2017

@Techworker , changing the provider definition with a function was resolving some issues :
trufflesuite/truffle-provider#1

@gnidan
Copy link
Contributor

gnidan commented Jan 3, 2018

@Janaka-Steph @Techworker is this still an issue for either of you? Closing for issue cleanup, let me know and I'll happily re-open.

@gnidan gnidan closed this as completed Jan 3, 2018
@ishallbethat
Copy link

This is still an issue.

i use truffle 4.0.6 and ganache UI as network.
When i ran below "truffle migrate --reset --network dev" it hungs for very long time and it took more than 5mins to return.

PS C:\mygithub\solidity-contract\mylottory> truffle migrate --reset --network dev
Using network 'dev'.

Running migration: 1_migration.js
  Deploying Migrations...
  ... 0xeff5fd199bd302c79a788cdda077d8fdf09cb3e7d62bc0407aa8f7a11f69a6f3
  Migrations: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0
  Deploying Lottory...
  ... 0x7c2a800ae458a5f48b6f495c9b6410bf0368b38053da04877249fbc32cb68730
  Lottory: 0xf12b5dd4ead5f743c6baa640b0216200e89b60da
Saving artifacts...


@nklipa13
Copy link

Is there any news on this? I'm getting stuck at "Saving artifacts..."

@omerkhushnood
Copy link

Same here

@TitBourne
Copy link

the migration is perfect but I got stuck in saving artifacts, any news in this?

@alwindeleon
Copy link

same here

1 similar comment
@mohoff
Copy link

mohoff commented May 14, 2018

same here

@silviopaganini
Copy link

same

@DavidLeeR
Copy link

getting the same error here. Only after updating truffle for me.

@psyshe
Copy link

psyshe commented May 15, 2018

Same here, pretty annoying.

Tried in --verbose-rpc mode and the last message is:

<   }
   > {
   >   "jsonrpc": "2.0",
   >   "id": 322,
   >   "method": "eth_uninstallFilter",
   >   "params": [
   >     "0x03"
   >   ]
   > }
  Contract: 0x
Saving artifacts...
 <   {
 <     "id": 322,
 <     "jsonrpc": "2.0",
 <     "result": true
 <   }

Stuck after that.

Don't know yet what does that mean, investigating.

@gnidan please reopen as its still there.

@vzts
Copy link

vzts commented May 16, 2018

Same issue here. In my case I used hdwallet-provider + remote node on infura. Here's my setting:

const HDWalletProvider = require("truffle-hdwallet-provider");

module.exports = {
  networks: {
    ropsten: {
      provider: () => new HDWalletProvider(some_mnemonic, "https://ropsten.infura.io/<token>"),
      network_id: 3
    }
  }
};

and then truffle migrate --network ropsten

@vzts
Copy link

vzts commented May 16, 2018

Same code didn't have such problem with normal development config on ganache:

    development: {
      host: "localhost",
      port: 8545,
      network_id: "*"
    }

So it may have something to do with communication to other standard node like geth or parity, or maybe time spent on deployment?

@emkman
Copy link

emkman commented May 16, 2018

I believe this is the same issue (hopefully) fixed by trufflesuite/truffle-core#135 which is now merged into dev. And at it's core may be an HDWallet issue? Not sure though.

@cgewecke
Copy link
Contributor

cgewecke commented May 16, 2018

@emkman
@vzts
@psyshe
@DavidLeeR
@silviopaganini
@mohoff
@alwindeleon
@TitBourne
@omerkhushnood

Agree with @emkman - this is likely a duplicate of truffle-core 135. The current state of the develop branch is published as a nightly truffle build at darq-truffle on npm here. You could try that if you're feeling adventurous (should work).

npm install -g darq-truffle
darq-truffle migrate --network ropsten # Example command

We had to upgrade the hd-wallet's dependencies because of formal security warning. More on that here.

We will probably be doing a new patch release early next week.

Another thing to note is that this is a quirk about how the command exits. It should be completing all the work it needs to do - the underlying problem is that we're not cleaning up interval polling from the Wallet and the process hangs at the final moment.

@cgewecke cgewecke changed the title Command doesn't return and stuck at Saving artifacts... Command doesn't return and stuck at Saving artifacts... when using hdwallet provider. May 16, 2018
@nukec
Copy link

nukec commented May 21, 2018

stuck here as well

@cgewecke
Copy link
Contributor

This should be fixed in 4.1.9. Please ping if you continue to see this.

@gerchicov-bp
Copy link

@cgewecke just WTF? Had this problem. Ok, updated the truffle to the latest version (currently 4.1.11)

Now I have troubles with truffle compile - it seems it compiles contracts but works infinitely. So I need to kill it manually.

@mspublic
Copy link

I'm seeing this issue as well on 4.1.11. It happens randomly. Sometimes it works fine others it never completes. No idea why

@cgewecke
Copy link
Contributor

@mspublic Is truffle 962 relevant for your case? In that issue the poster has a truffle.js that declares multiple hdwallet providers connected to Infura without wrapping them in function closures.

If 962 isn't relevant, would love any other info you can provide - a reproduction case or a link to your project if it's public would be great.

@mspublic
Copy link

mspublic commented May 26, 2018

While I am setting multiple networks - I am not using HD wallets. When using an older version of node I would see the crash listed below. Now running on node v10.1.0 - I do not see this crash, truffle will just end at "Saving artifacts..." without returning the contract address.

A couple things to note:

  1. It seems rm build/* between "migrate --reset --network different_networkID" helps reduce the issue.
  2. The rm'ing above and using darq-truffle v4.1.8 seems to have solved the issue for now.

Node Crash:
Saving artifacts...
node[10700]: ../src/timer_wrap.cc:107:static void node::{anonymous}::TimerWrap::Stop(const v8::FunctionCallbackInfov8::Value&): Assertion `HandleWrap::IsAlive(wrap)' failed.
1: node::Abort() [node]
2: 0x8c24db [node]
3: 0x95007a [node]
4: v8::internal::FunctionCallbackArguments::Call(void ()(v8::FunctionCallbackInfov8::Value const&)) [node]
5: 0xad6f2c [node]
6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate
) [node]
7: 0x33e39cf842fd

@cgewecke
Copy link
Contributor

@mspublic Thanks that's helpful. Are you able to share your truffle.js? Please redact anything that should be private if you are.

@cgewecke
Copy link
Contributor

@chrischip Ah ok - good to know - which version of ganache were you using before?

@chrischip
Copy link

@cgewecke

Honesty I don't have a definite answer. I started my project a few months ago. After checking the Ganache release history I guess it is most probably version 1.0.2.

@haraldini
Copy link

@cgewecke Wrapping it into the return function seems to work. Seems like I looked at some bad example code from somewhere else when I implemented this. Thanks! 👍

@haraldini
Copy link

haraldini commented Jun 13, 2018

While that fixed the compile, it also broke the truffle migrate

TypeError: Cannot read property '_alreadyWrapped' of undefined
    at Object.wrap (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:12:1)
    at Object.wrap (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/index.js:7:1)
    at Object.create (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/index.js:21:1)
    at Config.get [as provider] (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-config/index.js:164:1)
    at Object.detect (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/environment.js:46:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/migrate.js:91:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-workflow-compile/index.js:50:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-workflow-compile/index.js:82:1
    at <anonymous>]

@cgewecke
Copy link
Contributor

@haraldini - Could you show your config here? If there's anything sensitive in there like API keys or addresses please hide them :)

@morrigan
Copy link

This happens to me when using truffle-hdwallet-provider and infura. Using Truffle v4.1.8 (core: 4.1.9)

@cgewecke
Copy link
Contributor

@morrigan Are you able to update to the latest Truffle? 4.1.11 should have fixed this.

@mspublic
Copy link

Sorry for long delay. I'm still having intermittent issues as well. It works sometimes... others it doesn't. One interesting note - it works mostly stable on node v10.3.0 but barely works on node v10.4.0

@cgewecke
Copy link
Contributor

@mspublic No worries - actually we were looking at this yesterday because @gnidan had it happen in another context - using the debugger within truffle develop while running redux remote tools. Everything seems normal on Node 8 fwiw.

We think it might be tied to the way we close handlers as commands exit.

Are you still using darq-truffle?

@mspublic
Copy link

mspublic commented Jun 19, 2018

Im back to using 4.1.11. Darq truffle started having issues on newer node :. Seems right now the "most" stable is 4.1.11 with node 10.3.0 using --verbose-rpc, and having a 3rd "3_helloworld.js" migration deployed after the main 2_contract.js. This setup is so odd but seems to work 80% of the time. And this is without hdwallet. Just standard geth unlocked account.

@eolszewski
Copy link

@cgewecke the problem here has to do with the function wrapping you referenced - I ran into this issue and that fixed it.

To anyone who sees this issue, let it be known that you must wrap your provider in a function when using HDWalletProvider.

ropsten: {
    provider: return new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"),
    network_id: '3',
  }

Breaks

ropsten: {
    provider: function() {
      return new HDWalletProvider(mnemonic, "https://ropsten.infura.io/");
    },
    network_id: '3',
  }

Works

@cgewecke
Copy link
Contributor

Thanks @eolszewski - good to know that's working.

@ekreda
Copy link

ekreda commented Jul 4, 2018

I can confirm that using @eolszewski wrapping + upgrading truffle to 4.1.13 from (4.1.9) solved this issue for me...

@jbogacz
Copy link

jbogacz commented Jul 7, 2018

@eolszewski Thanks dude! I stacked for a while but your suggestion solved my issue. I didn't upgrade truffle (still using 4.1.8) but only wrapped HDWallet provider an it works fine now.

@JoyCood
Copy link

JoyCood commented Aug 16, 2018

@cgewecke I still have the troubles with truffle migrate, my environment is:

truffle version:

$ truffle version
Truffle v4.1.13 (core: 4.1.13)
Solidity v0.4.24 (solc-js)

truffle.js:

module.exports = {
    // See <http://truffleframework.com/docs/advanced/configuration>
    // to customize your Truffle configuration!
    solc: {
	  optimizer: {
	    enabled: true,
	    runs: 200
	  }
    },
    networks: {
        development: {
	    host: '127.0.0.1',
		port: 8545,
		network_id: "2018",
		gas: 4700000,
		gasPrice: 99999999,
		from: "0x14CD5c014C56cd8464f871b0955Aa3B23EB78B5a"
	  }
	}
};

@JoyCood
Copy link

JoyCood commented Aug 16, 2018

I solve the truffle migrate stuck problem by delete the transactions.rlp file in the geth client data directory , inspect there exists any failure transactions in the geth client console with eth.pendingTransactions command, if any, try below way:

  1. stop the geth client
  2. delete the transactions.rlp file in the geth client data directory
  3. start the geth again
  4. resend the transaction with truffle migrate command

@stevenleeg
Copy link

I'm running into the same issue while using HDWalletProvider connected to a local Ganache instance. Adding the --verbose-rpc flag reveals that it's getting stuck in an infinite loop here:

   >   {                                                                                    
   >     "jsonrpc": "2.0",
   >     "id": 38,
   >     "method": "eth_getFilterChanges",
   >     "params": [
   >       "0x2"
   >     ]
   >   }
   > ]
 <   [
 <     {
 <       "id": 38,
 <       "jsonrpc": "2.0",
 <       "result": []
 <     }
 <   ]``` 

@cgewecke
Copy link
Contributor

cgewecke commented Aug 22, 2018

@stevenleeg What truffle version are you using? Have you checked your config to make sure that the Wallet provider is correctly wrapped in a function as shown in the docs here?

@stevenleeg
Copy link

stevenleeg commented Aug 23, 2018

@cgewecke

$ truffle version
Truffle v4.1.13 (core: 4.1.13)
Solidity v0.4.24 (solc-js)

I've managed to figure out the hanging issue, but I'm unfortunately now running into the issue first reported by @mspublic:

$ truffle migrate --reset
Using network 'development'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0x1800c21325bf4506724dade7d410ab5200f936450d7a8f9f61d8c6aafe244c38
  Migrations: 0x911a6996b07c151c4b376d3cfff225e646021b0a
Saving successful migration to network...
  ... 0xc6c94a6684f5aad21eddfc8de2014ca1e8644e26244c4768a5acb21d7a94fb82
Saving artifacts...
Running migration: 2_deploy_contracts.js
Saving successful migration to network...
1535028464 1536755964
  Replacing MyCoin...
  ... 0xec49ea466951b00d3ac5086d3385629f98ebbce7168240d254b44bd87a543fcb
  ... 0x96bd514fcf8badaa06ec6a8e1ae8057c4610c6b9ec3301bac96dea9b0afb659b
Saving artifacts...
node[67981]: ../src/timer_wrap.cc:130:static void node::(anonymous namespace)::TimerWrap::Stop(const FunctionCallbackInfo<v8::Value> &): Assertion `HandleWrap::IsAlive(wrap)' failed.
 1: node::Abort() [/usr/local/bin/node]
 2: node::Assert(char const* const (*) [4]) [/usr/local/bin/node]
 3: node::(anonymous namespace)::TimerWrap::SetImmediateCallback(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
 5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 6: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 7: 0x240f902842fd
 8: 0x240f9033d196
fish: 'truffle migrate --reset' terminated by signal SIGABRT (Abort)

Any ideas as to what the issue could be here? I've jotted down my full config here, as I think seeing the deploy script, truffle.js, and responses in one place would be helpful.

@cgewecke
Copy link
Contributor

@stevenleeg. The node::etc crash seems to be related to some versions of Node 10. Honestly don't know what's going on there. You shouldn't see that if you're using latest stable though (8.11.4).

And there's another issue with the way your migrations script is written that very similar to truffle 1195. Could you try wrapping the logic in the 2_deploy_contracts.js scripts in the deployer.then block and see if that helps?

@amity203
Copy link

amity203 commented Aug 28, 2018

i am also facing similar issue with truffle migrate, it is not deploying contract, but saving artifacts. below is the result of migrate command on windows 10 with verbose:

$ truffle migrate -reset --verbose-rpc
Compiling .\contracts\Migrations.sol...
Writing artifacts to .\build\contracts

{
"jsonrpc": "2.0",
"id": 1,
"method": "net_version",
"params": []
}
< {
< "id": 1,
< "jsonrpc": "2.0",
< "result": "5777"
< }
{
"jsonrpc": "2.0",
"id": 2,
"method": "eth_accounts",
"params": []
}
< {
< "id": 2,
< "jsonrpc": "2.0",
< "result": [
< "0xf98852bef6a3742de8f6c7f01695741603381070",
< "0xf139e4a1748c2cc935cdf7e4d44f2a67e3ffd951",
< "0x9aac644abc61547169fc8f4f34a0cb2257186754",
< "0xe232bef7c1b46b545749203533c3ddc1eaca7127",
< "0xbacae29c98de0ed2caa4eb6d27104829e24f553e",
< "0xf98141cf6c6900056409a2a54e1fa1db10cc6d24",
< "0x25d99fe28b962a2744016364a8866fd48e2340ee",
< "0x9b11fc7b89d6df66bf4f34e58bff2de962c542bc",
< "0x2231f3d6c4d6d81380c7540d209e8f4c1ba1d7ac",
< "0x79038094badbf481a4359bddd6d27e4ccd947c2e"
< ]
< }
Using network 'development'.

Network up to date.

@jamesjara
Copy link

Using the latest version of "truffle-hdwallet-provider": "^1.0.2", solved my issue stucked on the get last block call

@ngotiendatdinosys
Copy link

same issue:
screen shot 2019-01-24 at 11 37 00 pm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests