Code Monkey home page Code Monkey logo

Comments (7)

tuxcanfly avatar tuxcanfly commented on June 14, 2024

After tracing this I've found that rpcclient was trying to auto-reconnect, so I've set DisableAutoReconnect to true and now it raises the error as expected. I'm still finding a hang but it's for Wait on btcwallet to exit after receiving a SIGINT.

I've updated the gist to demonstrate the issue with btcwallet

from btcrpcclient.

jrick avatar jrick commented on June 14, 2024

If this is hanging before the Wait calls for the btcwallet process, and not after (when you make a final call to GetNewAddress, then wallet isn't shutting down correctly. Can you run wallet with profiling and dump the goroutines?

from btcrpcclient.

tuxcanfly avatar tuxcanfly commented on June 14, 2024

Here's the dump of goroutines when it hangs:

https://gist.github.com/tuxcanfly/549ec22a9d4496117028

I can see that when I hit Ctrl+C manually, it shuts down correctly:

23:32:23 2014-07-01 [INF] BTCW: Received SIGINT (Ctrl+C).  Shutting down...
23:32:23 2014-07-01 [WRN] BTCW: Server shutting down
23:32:23 2014-07-01 [WRN] BTCW: Disconnecting chain server client connection
^C23:32:26 2014-07-01 [INF] BTCW: Received SIGINT (Ctrl+C).  Shutting down...
23:32:26 2014-07-01 [WRN] BTCW: Server already shutting down
23:32:26 2014-07-01 [INF] BTCW: Disconnected websocket client 127.0.0.1:41610
23:32:26 2014-07-01 [INF] BTCW: Shutdown complete

from btcrpcclient.

tuxcanfly avatar tuxcanfly commented on June 14, 2024

Steps to repro:

Keep rpcclient connection open, I have something like this in a simple test script:

for i := 0; i < 10; i++ {
    time.Sleep(time.Second)
    addr, err := client.GetNewAddress()
    if err != nil {
        log.Printf("Cannot generate new address: %v", err)
    }
    log.Printf("Address: %v", addr)
}

While this is running, I interrupt btcwallet with SIGINT. Both btcwallet as well as rpcclient hang.

Here's the goroutine dump for btcwallet: https://gist.github.com/tuxcanfly/924fc97f4fed16cd383d

from btcrpcclient.

jrick avatar jrick commented on June 14, 2024

That looks like a btcwallet clean shutdown bug, not the issue I was seeing with the rpcclient hanging. In this case, wallet is waiting for new messages from a websocket client (rpcserver.go:433) instead of erroring and breaking out of the loop (which should shut down the remaining rpcserver goroutines).

from btcrpcclient.

tuxcanfly avatar tuxcanfly commented on June 14, 2024

OK, I was guessing this was the same rpcclient issue because once btcwallet hangs, it keeps the client waiting.

I guess this issue should be moved to btcwallet.

from btcrpcclient.

davecgh avatar davecgh commented on June 14, 2024

The shutdown hangs in btcrpcclient have been resolved as of commit 656fa86.

from btcrpcclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.