question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System Error when running Ganache 2.0.1 on win32 ('pop' of undefined)

See original GitHub issue
  • Was testing dapp. After relevant commands (truffle migrate --reset and npm run dev), my dapp initially did not display. I initially refreshed several times until the content finally displayed. It appears as if there were delays in communication between the backend + UI because I got duplicates, and perhaps this delay caused mismatches of fields of some sort.

I received RPC errors where nonces were mismatched. I restarted Ganache several times and, by working through Metamask, used the same RPC link and sample account private key. Transactions were unable to pass because of a nonce mismatch (ie: upon restart, nonce 2 mismatch with nonce 184)

PLATFORM: win32 GANACHE VERSION: 2.0.1

EXCEPTION:

TypeError: Cannot read property 'pop' of undefined
    at CheckpointTrie.Trie._updateNode (C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:360:23)
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:107:16
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:461:14
    at processNode (C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:471:23)
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:516:13
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:180:7
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\util.js:75:7
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\node_modules\async\lib\async.js:52:16
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\node_modules\async\lib\async.js:269:32
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\node_modules\async\lib\async.js:44:16
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\util.js:71:7
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:157:9
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\lib\database\levelupobjectadapter.js:41:16
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\level-sublevel\shell.js:101:15
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\level-sublevel\nut.js:121:19
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\encoding-down\index.js:51:21
    at C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\node_modules\cachedown\index.js:58:21
    at ReadFileContext.callback (C:\Program Files\WindowsApps\Ganache_2.0.1.0_x64__zh355ej5cj694\app\resources\app.asar\node_modules\ganache-core\lib\database\filedown.js:26:14)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)

APPLICATION LOG:

T+702867124ms: eth_sendTransaction
T+702867225ms:   Transaction: 0xd2796e2c1a72a57c7d452beb031b4bccd3e5dc92a47a83ef26b306a8c753ce11
T+702867225ms:   Contract created: 0x9fd1d717675ca9c78e0cb1e410b5cd91864d8667
T+702867225ms:   Gas usage: 544676
T+702867225ms:   Block Number: 187
T+702867225ms:   Block Time: Fri Jun 07 2019 15:42:04 GMT-0700 (US Mountain Standard Time)
T+702867225ms: eth_getBlockByNumber
T+702867225ms: eth_getTransactionReceipt
T+702867227ms: eth_getCode
T+702867228ms: eth_getTransactionByHash
T+702867229ms: eth_getBlockByNumber
T+702867233ms: eth_getBalance
T+702867241ms: eth_getBlockByNumber
T+702867246ms: eth_getBlockByNumber
T+702867251ms: eth_sendTransaction
T+702867319ms:   Transaction: 0x04b265c9add73a700905498e5dafc9ac07fb33e0856e624f60fbe2a3c4072b14
T+702867319ms:   Gas usage: 27008
T+702867319ms:   Block Number: 188
T+702867319ms:   Block Time: Fri Jun 07 2019 15:42:04 GMT-0700 (US Mountain Standard Time)
T+702867321ms: eth_getBlockByNumber
T+702867321ms: eth_getTransactionReceipt
T+702873682ms: net_version
T+702873683ms: net_version
T+702873756ms: eth_getLogs
T+702873761ms: eth_call
T+702875635ms: eth_blockNumber
T+702875641ms: eth_getBlockByNumber
T+702875761ms: eth_call
T+702877603ms: net_version
T+702877609ms: net_version
T+702877680ms: eth_getLogs
T+702877685ms: eth_call
T+702878772ms: eth_call
T+702878773ms: eth_call
T+702895652ms: eth_blockNumber
T+702901290ms: net_version
T+702901291ms: net_version
T+702902114ms: eth_getLogs
T+702905186ms: net_version
T+702905191ms: net_version
T+702906072ms: net_version
T+702906075ms: net_version
T+702907078ms: eth_getLogs
T+702915670ms: eth_blockNumber
T+702935684ms: eth_blockNumber
T+702955703ms: eth_blockNumber
T+702975720ms: eth_blockNumber
T+702995740ms: eth_blockNumber
T+702999093ms: net_version
T+702999094ms: net_version
T+703000068ms: net_version
T+703000073ms: net_version
T+703001083ms: eth_getLogs
T+703015756ms: eth_blockNumber
T+703016891ms: net_version
T+703016898ms: eth_accounts
T+703016918ms: eth_getBlockByNumber
T+703016922ms: eth_accounts
T+703016941ms: eth_getBlockByNumber
T+703016945ms: eth_getBlockByNumber
T+703016949ms: eth_getBlockByNumber
T+703016957ms: eth_estimateGas
T+703017087ms: eth_unsubscribe
T+703017087ms: eth_unsubscribe
T+703017104ms: eth_unsubscribe
T+703017104ms: eth_unsubscribe
T+703017110ms: eth_unsubscribe

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
davidmurdochcommented, Jan 14, 2020

I figured out a way of reproducing the issue (in the case where it errors on start up). It came down to a race condition in how we write and read the trie files.

The gist of it is that if you fs.readFile on a file that is being written to with fs.writeFile then sometimes the readFile will return "" (or an empty Buffer). The value would then propagate into the trie, causing the trie to have an invalid node, and then it would eventually crash as you are seeing here.

The issue you described on start up is caused by a bug in ethereumjs-vm’s constructor performing asynchronous IO with no way of signaling to the caller that its IO is complete. The fix I’m proposing for ganache-core works around this issue. I’ve opened an issue at etehreumjs-vm you can check out if you are curious.

1reaction
davidmurdochcommented, Apr 11, 2020

Fixed in https://github.com/trufflesuite/ganache/releases/tag/v2.3.0! Please let me know if you are still experiencing problems!

Read more comments on GitHub >

github_iconTop Results From Across the Web

System Error when running Ganache 2.5.4 on win32 #4889
PLATFORM: win32 GANACHE VERSION: 2.5.4 EXCEPTION: TypeError: Cannot read property 'stack' of undefined at IpcMainImpl.
Read more >
truffleframework - Bountysource
PLATFORM: win32. GANACHE VERSION: 2.5.4. EXCEPTION: TypeError: Cannot read property 'pop' of undefined at CheckpointTrie.
Read more >
Ganache Install File System Error Solution Windows 10
Solve File System Error while Installing Ganache in Windows 10. Use Add-AppxPackage -Path .\ Ganache -2.4.0-win-x64.appx command to Install ...
Read more >
Windows Ganache install Errors - Ethereum Stack Exchange
I'm attempting to install ganache via npm install ganache from my windows machine using PowerShell. Upon execution, a list of errors is ...
Read more >
CodaLab Worksheets
NET 2.0 ≥ 98 old 1.x Win32 declared No support numbers whole loaded memory error invalid conflict between charsets header declaration set improve ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found