Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handshake data race #101

Closed
dajohi opened this issue Jun 17, 2014 · 2 comments
Closed

Handshake data race #101

dajohi opened this issue Jun 17, 2014 · 2 comments

Comments

@dajohi
Copy link
Member

dajohi commented Jun 17, 2014

==================
==================
WARNING: DATA RACE
Write by goroutine 26:
  runtime.mapassign1()
      /home/dajohi/git/go/src/pkg/runtime/hashmap.goc:925 +0x0
  github.com/conformal/btcwallet/txstore.(*unconfirmedStore).txRecordForInserts()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/txstore/tx.go:409 +0x1a2
  github.com/conformal/btcwallet/txstore.(*Store).InsertTx()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/txstore/tx.go:557 +0x2a9
  main.(*AccountManager).RecordSpendingTx()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/acctmgr.go:665 +0x1ad
  main.redeemingTx.handleNotification()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/rpcclient.go:258 +0x175
  main.(*redeemingTx).handleNotification()
      <autogenerated>:508 +0xb4
  main.(*rpcClient).handleNotifications()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/rpcclient.go:419 +0xc0

Previous read by goroutine 21:
  github.com/conformal/btcwallet/txstore.(*Store).UnminedDebitTxs()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/txstore/tx.go:985 +0x60
  main.(*Account).ResendUnminedTxs()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/account.go:509 +0xd6
  main.(*AccountManager).ResendUnminedTxs()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/acctmgr.go:991 +0x147
  main.(*rpcClient).Handshake()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/rpcclient.go:538 +0x7bf
  main.func·011()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/rpcclient.go:294 +0x17f
  github.com/conformal/btcrpcclient.func·001()
      /home/dajohi/.go/src/github.com/conformal/btcrpcclient/infrastructure.go:875 +0xfc

Goroutine 26 (running) created at:
  main.(*rpcClient).Start()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/rpcclient.go:326 +0x78
  main.clientConnect()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/cmd.go:123 +0x1c2
  main.main()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/cmd.go:193 +0x5fd

Goroutine 21 (finished) created at:
  github.com/conformal/btcrpcclient.(*Client).start()
      /home/dajohi/.go/src/github.com/conformal/btcrpcclient/infrastructure.go:879 +0x293
  github.com/conformal/btcrpcclient.New()
      /home/dajohi/.go/src/github.com/conformal/btcrpcclient/infrastructure.go:1079 +0x370
  main.newRPCClient()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/rpcclient.go:314 +0x54f
  main.clientConnect()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/cmd.go:109 +0x6b
  main.main()
      /home/dajohi/.go/src/github.com/conformal/btcwallet/cmd.go:193 +0x5fd
==================
@dajohi dajohi added the bug label Jun 17, 2014
@jrick jrick changed the title txstore data race Handshake data race Jun 20, 2014
@jrick
Copy link
Member

jrick commented Jun 20, 2014

Although I'm not terribly thrilled by the idea, there has been discussion about blocking all other users of the account manager (rpc clients in particular) and let the handshake finish before general wallet use is allowed.

@jrick
Copy link
Member

jrick commented Jul 9, 2014

All of the locking around then AccountManager and each Account structure needs to be rethought. I've currently reorganizing the codebase to rip out the AccountManager (this will be unnecessary with BIP0032 keystores, see #93). In the process, I have made the keystore package safe for concurrent access, and plan on doing the same for txstore next. The DiskManager will also be removed in favor of a dirty flag on the keystore and txstore, and file write operations will be handled inside of those packages rather than outside in main.

@jrick jrick closed this as completed in b9fd527 Jul 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants