ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.39k stars 20.05k forks source link

geth hangs and uses 100% CPU when running any js file #1892

Closed iurimatias closed 8 years ago

iurimatias commented 9 years ago

to replicate: (note: it happens with ANY js file)

touch empty.js
geth --datadir /tmp/something js empty.js

then ctrl + c, doesn't shut it down, and geth constantly uses 100% CPU available in the background.

|1009 09:24:08.907754   45245 cmd.go:134] Got interrupt, shutting down...
I1009 09:24:08.945125   45245 chain_manager.go:661] imported 203 block(s) (0 queued 0 ignored) including 0 txs in 186.876641ms. #22179 [9c1dad24 / df548ab0]
I1009 09:24:08.945188   45245 chain_manager.go:459] Chain manager stopped
I1009 09:24:08.945195   45245 handler.go:165] Stopping ethereum protocol handler...
I1009 09:24:08.945205   45245 handler.go:175] Ethereum protocol handler stopped
I1009 09:24:08.945222   45245 transaction_pool.go:138] Transaction pool stopped
I1009 09:24:08.945284   45245 backend.go:686] Automatic pregeneration of ethash DAG OFF (ethash dir: /Users/iurimatias/.ethash)
I1009 09:24:08.945689   45245 downloader.go:254] Synchronisation failed: hash fetching canceled (requested)
I1009 09:24:08.987080   45245 database.go:167] flushed and closed db: /tmp/something/chaindata
I1009 09:24:08.987216   45245 database.go:167] flushed and closed db: /tmp/something/dapp
^CI1009 09:24:11.715322   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:11.715344   45245 cmd.go:141] Interrupt 9 more times to induce panic.
^CI1009 09:24:12.275333   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:12.275350   45245 cmd.go:141] Interrupt 8 more times to induce panic.
^CI1009 09:24:12.571711   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:12.571729   45245 cmd.go:141] Interrupt 7 more times to induce panic.
^CI1009 09:24:12.739461   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:12.739479   45245 cmd.go:141] Interrupt 6 more times to induce panic.
^CI1009 09:24:12.907311   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:12.907325   45245 cmd.go:141] Interrupt 5 more times to induce panic.
^CI1009 09:24:13.083332   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:13.083346   45245 cmd.go:141] Interrupt 4 more times to induce panic.
^CI1009 09:24:13.243409   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:13.243427   45245 cmd.go:141] Interrupt 3 more times to induce panic.
^CI1009 09:24:13.395327   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:13.395347   45245 cmd.go:141] Interrupt 2 more times to induce panic.
^CI1009 09:24:13.555318   45245 cmd.go:140] Already shutting down, please be patient.
I1009 09:24:13.555337   45245 cmd.go:141] Interrupt 1 more times to induce panic.
^CI1009 09:24:13.756403   45245 cmd.go:144] Force quitting: this might not end so well.
panic: boom

goroutine 116 [running]:
github.com/ethereum/go-ethereum/cmd/utils.StartEthereum.func1(0xc8200cc140)
        /private/tmp/ethereum20150910-33799-h3id5m/src/github.com/ethereum/go-ethereum/cmd/utils/cmd.go:145 +0x6b8
created by github.com/ethereum/go-ethereum/cmd/utils.StartEthereum
        /private/tmp/ethereum20150910-33799-h3id5m/src/github.com/ethereum/go-ethereum/cmd/utils/cmd.go:146 +0x2d0

goroutine 1 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc82037579c)
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/sema.go:43 +0x26
sync.(*WaitGroup).Wait(0xc820375790)
        /usr/local/Cellar/go/1.5.1/libexec/src/sync/waitgroup.go:126 +0xb4
github.com/ethereum/go-ethereum/jsre.(*JSRE).Stop(0xc820375770, 0x7fff5fbff701)
        /private/tmp/ethereum20150910-33799-h3id5m/src/github.com/ethereum/go-ethereum/jsre/jsre.go:198 +0x5e
main.(*jsre).exec(0xc820064700, 0x7fff5fbff7d1, 0x8, 0x0, 0x0)
        /private/tmp/ethereum20150910-33799-h3id5m/src/github.com/ethereum/go-ethereum/cmd/geth/js.go:368 +0x18c
main.execJSFiles(0xc8202580e0)
        /private/tmp/ethereum20150910-33799-h3id5m/src/github.com/ethereum/go-ethereum/cmd/geth/main.go:478 +0x454

unfortunately, for anyone using a wrapper such as 'embark blockchain', once they ctrl + c the wrapper looks shutdown, but geth actually keeps running in the background at 100% CPU indefinitely.

rfikki commented 9 years ago

I believe this is the same issue I had in #1882. I have been using loadscript from console command line instead.

VoR0220 commented 9 years ago

:+1:

obscuren commented 9 years ago

I can confirm and replicate this issue.

karalabe commented 8 years ago

This issue was fixed upstream in Web3, and down-streamed into geth too. Should be fine on develop. Please reopen if you still encounter this problem on the develop branch.