Open Janaka-Steph opened 7 years ago
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.
@Janaka-Steph Were you able to resolve that issue? I have the same problem.
@Techworker , changing the provider definition with a function was resolving some issues : https://github.com/trufflesuite/truffle-provider/pull/1
@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.
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...
Is there any news on this? I'm getting stuck at "Saving artifacts..."
Same here
the migration is perfect but I got stuck in saving artifacts, any news in this?
same here
same here
same
getting the same error here. Only after updating truffle for me.
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.
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
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?
I believe this is the same issue (hopefully) fixed by https://github.com/trufflesuite/truffle-core/pull/135 which is now merged into dev. And at it's core may be an HDWallet issue? Not sure though.
@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.
stuck here as well
This should be fixed in 4.1.9
. Please ping if you continue to see this.
@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.
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
@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.
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:
Node Crash:
Saving artifacts...
node[10700]: ../src/timer_wrap.cc:107:static void node::{anonymous}::TimerWrap::Stop(const v8::FunctionCallbackInfo
@mspublic Thanks that's helpful. Are you able to share your truffle.js
? Please redact anything that should be private if you are.
Sure see attached. Ive played with gas levels, enabling/disabling the optimizer (as well as modifying the amount of runs etc). Outside of what I mentioned above post I can't seem to find anything specific that would cause it to always fail/succeed. I could rerun the same migrate command over and over and have it fail sometimes and pass sometimes without making any changes.
@mspublic I notice you're not using the standard 8545
port that most Ethereum clients use.
@cgewecke I know for sure nothing is using the port range - we have everything carefully automated. No server between the client. Truffle is always able to successfully deploy the base migration file. Just for some reason after that it will randomly work/not work when saving artifacts after second contract deploy. On the ethereum side I do have a pretty quick block speed but am not running any transactions during contract deployment. Also deploying using remix never seems to have issues.
And again for some reason deleting build dir between each migration + using darq seems to be working fairly stable (which does not make much sense to me as to why).
@mspublic Thanks for all that. Re-opening.
Thanks :). Let me know if I can be of anymore help!
Any thoughts/anything I can help with? The darq-truffle/deletion method is less stable then I hoped.
@mspublic To be clear - are you seeing a hang at the end of migrations where Truffle refuses to exit? If not your issue might be similar to truffle 974 where the problem is how to use async/await
in Migrations.
Is that possible? Are you able to show your migrations.js
files?
I have the same error. Truffle compile wait indefinitely at "Writing artifacts to .\build\contracts". However I think i have a bit more clue.
My truffle.js is using the "truffle-hdwallet-provider", which is pointing to a local Ganache instance. If I didn't start the instance, Truffle compile will work.
If the Ganache is running, it will hang forever. If I stop the Ganache instance, while waiting for the "Writing artifacts to .\build\contracts", I will have the following error messages repeating continuously.
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (C:\github\privateCode\retroArt\reactWebsite\node_modules\truffle-hdwallet-provider\node_modules\web3\lib\web3\errors.js:35:16)
at XMLHttpRequest.request.onreadystatechange (C:\github\privateCode\retroArt\reactWebsite\node_modules\truffle-hdwallet-provider\node_modules\web3\lib\web3\httpprovider.js:115:32)
at XMLHttpRequestEventTarget.dispatchEvent (C:\github\privateCode\retroArt\reactWebsite\node_modules\xhr2\lib\xhr2.js:64:18)
at XMLHttpRequest._setReadyState (C:\github\privateCode\retroArt\reactWebsite\node_modules\xhr2\lib\xhr2.js:354:12)
at XMLHttpRequest._onHttpRequestError (C:\github\privateCode\retroArt\reactWebsite\node_modules\xhr2\lib\xhr2.js:544:12)
at ClientRequest.
I am not good enough to fix the error myself but I think this could be helpful to someone who could fix it.
You can call process.exit()
at the end of your deployment. Just be sure there is nothing asynchronous going on anymore.
This happens in plain terminal/console too
@chrischip @haraldini
Are you wrapping your HDWallet providers in functions as shown here. Any other info you can give about these hangs (what versions you're using etc) would be really helpful - would like to squash this bug.
@mspublic Did you ever find a solution to the problem you were seeing here?
@cgewecke
This is how I wrap the provider:
var HDWalletProvider = require("truffle-hdwallet-provider");
module.exports = {
networks: {
development: {
provider: new HDWalletProvider(mnemonic, "http://192.168.1.1:7545/"),
network_id: "*"
}
}
}
Another clue, I only have this problem recently after pulling the current master branch of Ganache (1.1.0). It was not an issue previously before the pull.
versions: Ganache: 1.1.0
"dependencies": { "atob": "^2.1.1", "axios": "^0.18.0", "base-x-bytearray": "^0.1.3", "base58": "^1.0.1", "base58check": "^2.0.0", "base64-js": "^1.3.0", "bignumber": "^1.1.0", "bignumber.js": "^7.2.1", "bs58check": "^2.1.1", "btoa": "^1.2.1", "case-sensitive-paths-webpack-plugin": "^2.1.2", "connect-mongo": "^2.0.1", "cors-anywhere": "^0.4.1", "dotenv": "^6.0.0", "express-session": "^1.15.6", "find-color": "^0.1.0", "ionicons": "^4.1.2", "ipfs-api": "^22.0.1", "left-pad": "^1.3.0", "mongodb": "^3.1.0-beta4", "nedb": "^1.8.0", "next": "^6.0.3", "next-auth": "^1.8.5", "next-routes": "^1.4.2", "nodemailer": "^4.6.5", "nodemailer-direct-transport": "^3.3.2", "nodemailer-smtp-transport": "^2.7.4", "npm-run-all": "^4.1.3", "passport-google-oauth": "^1.0.0", "react": "^16.4.0", "react-dom": "^16.4.0", "react-favicon": "0.0.14", "react-google-charts": "^1.6.6", "react-no-ssr": "^1.1.0", "reactstrap": "^6.1.0", "scrypt": "^6.0.3", "semantic-ui-css": "^2.3.1", "semantic-ui-react": "^0.81.1", "truffle": "^4.1.11", "truffle-contract": "^3.0.5", "truffle-hdwallet-provider": "0.0.5", "universal-cookie": "^2.1.5", "web3": "^1.0.0-beta.34", "zeppelin-solidity": "1.9.0" }
@chrischip Ah ok - good to know - which version of ganache were you using before?
@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.
@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! 👍
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>]
@haraldini - Could you show your config here? If there's anything sensitive in there like API keys or addresses please hide them :)
This happens to me when using truffle-hdwallet-provider
and infura. Using Truffle v4.1.8 (core: 4.1.9)
@morrigan Are you able to update to the latest Truffle? 4.1.11
should have fixed this.
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
@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?
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.
@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
Thanks @eolszewski - good to know that's working.
I can confirm that using @eolszewski wrapping + upgrading truffle to 4.1.13 from (4.1.9) solved this issue for me...
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 onSaving artifacts...
and doesn't return.Thank you