shadow-plugin-bitcoin icon indicating copy to clipboard operation
shadow-plugin-bitcoin copied to clipboard

Bitcoin examples shown on the wiki are broken

Open bawejakunal opened this issue 10 years ago • 21 comments

I am trying to setup the shadow-bitcoin-plugin with the latest Shadow v1.10.2 installation. Shadow installation is working perfectly, but upon running the basic example for shadow-bitcoin-plugin using the command ../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r 2 -t, I get an error trace indicating a missing file 2 as follows:

00:00:00.000777 [thread-0] n/a [shadow-error] [n/a] [parser_parseFile] g_file_get_contents: Failed to open file '2': No such file or directory
**ERROR ENCOUNTERED**
    At process: 3824 (parent 3822)
    At file: /home/kunal/Documents/shadow/src/support/shd-logging.c
    At line: 54
    At function: logging_handleLog
    Message: FALSE && "failure due to error-level log message"
**BEGIN BACKTRACE**
Obtained 12 stack frames:
    /home/kunal/.shadow/bin/shadow() [0x43c98c]
    /home/kunal/.shadow/bin/shadow(utility_handleError+0x34) [0x43c404]
    /home/kunal/.shadow/bin/shadow(logging_handleLog+0x1df) [0x43133f]
    /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_logv+0x1b1) [0x7f3384775ae1]
    /home/kunal/.shadow/bin/shadow(logging_logv+0x41c) [0x43176c]
    /home/kunal/.shadow/bin/shadow(logging_log+0x157) [0x431a27]
    /home/kunal/.shadow/bin/shadow(parser_parseFile+0x105) [0x432825]
    /home/kunal/.shadow/bin/shadow(master_run+0x2df) [0x40d4af]
    /home/kunal/.shadow/bin/shadow(shadow_main+0x34c) [0x40c68c]
    /home/kunal/.shadow/bin/shadow(main+0x22) [0x43ca82]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f3383f7cec5]
    /home/kunal/.shadow/bin/shadow() [0x40c279]
**END BACKTRACE**
**ABORTING**
**ERROR ENCOUNTERED**
    At process: 3824 (parent 3822)
    At file: /home/kunal/Documents/shadow/src/support/shd-logging.c
    At line: 54
    At function: logging_handleLog
    Message: FALSE && "failure due to error-level log message"
**BEGIN BACKTRACE**
Obtained 12 stack frames:
    /home/kunal/.shadow/bin/shadow() [0x43c98c]
    /home/kunal/.shadow/bin/shadow(utility_handleError+0x34) [0x43c404]
    /home/kunal/.shadow/bin/shadow(logging_handleLog+0x1df) [0x43133f]
    /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_logv+0x1b1) [0x7f3384775ae1]
    /home/kunal/.shadow/bin/shadow(logging_logv+0x41c) [0x43176c]
    /home/kunal/.shadow/bin/shadow(logging_log+0x157) [0x431a27]
    /home/kunal/.shadow/bin/shadow(parser_parseFile+0x105) [0x432825]
    /home/kunal/.shadow/bin/shadow(master_run+0x2df) [0x40d4af]
    /home/kunal/.shadow/bin/shadow(shadow_main+0x34c) [0x40c68c]
    /home/kunal/.shadow/bin/shadow(main+0x22) [0x43ca82]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f3383f7cec5]
    /home/kunal/.shadow/bin/shadow() [0x40c279]
**END BACKTRACE**
**ABORTING**
[2015-10-14 12:09:09.100428] bitcoind: Shadow returned 0 in 0:00:00.370978 seconds

Am I missing something in the plugin installation instructions ?

bawejakunal avatar Oct 14 '15 04:10 bawejakunal

Try it with -r but without the 2 in your command, so like this:

./src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r -

Does that work? If so, the wiki needs to be updated.

robgjansen avatar Oct 14 '15 04:10 robgjansen

The complete content of data/shadow.log file is at this link: http://pastebin.com/w30aPYJm

../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r gave a console output as below.

write skipping worker
gmodule init bitcoind
read skipping worker
check_init done
read skipping worker
gmodule init bitcoind
check_init done
pthread_key_create:0x7fdc2d2003a0
pthread_create:0
pthread_key_create:0x7fdc2d2003d0
pthread_create:1
pthread_key_create:0xca7158
pthread_create:2
Error: Specified data directory "data/.bitcoin2" does not exist.
pthread_key_create:0x7fdc2d2003a0
pthread_create:0
pthread_key_create:0x7fdc2d2003d0
pthread_create:1
pthread_key_create:0xcac938
pthread_create:2
Error: Specified data directory "data/.bitcoin1" does not exist.

bawejakunal avatar Oct 14 '15 04:10 bawejakunal

Sorry I pasted the command incorrectly. Your original command was this

../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r 2 -t

I just asked you to try to remove the 2, like this

../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r -t

robgjansen avatar Oct 14 '15 13:10 robgjansen

@robgjansen please check upon the output I have posted in my 2nd comment. I executed ../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r as well as ../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r -t and both give me the output as shown above, with the content in the log file that I have posted on pastebin.

bawejakunal avatar Oct 14 '15 15:10 bawejakunal

It was likely broken in 86479fa8f3fc48c24a03df6b4d5326259339dee0. It looks like in that commit, the name of the data directories for each node changed from .bitcoin to the node name (here), but the example config file was not updated (here and here).

robgjansen avatar Oct 14 '15 16:10 robgjansen

@bawejakunal Does the above fix work for you (I can't test right now)?

robgjansen avatar Oct 14 '15 16:10 robgjansen

Sorry, even I cant check right now, will let you know in a few hours.

bawejakunal avatar Oct 14 '15 16:10 bawejakunal

OK, thanks! Make sure to grab both commits, I had a typo in the first one. I also updated the wiki to remove the int parameter after the -r option.

robgjansen avatar Oct 14 '15 16:10 robgjansen

@robgjansen the example works perfectly now. Thanks.

bawejakunal avatar Oct 15 '15 03:10 bawejakunal

@robgjansen In the realistic example what directory does '/storage/dotbitcoin_backing_120krefer to in the copy commandcp -R /storage/dotbitcoin_backing_120k pristine/.`

bawejakunal avatar Oct 15 '15 03:10 bawejakunal

Ah, it was an oversight not to include that somewhere! I'm hosting it here for now. I'll leave the issue open until documenting this in the readme https://cs.umd.edu/~amiller/dotbitcoin_backing_120k.tar.gz

amiller avatar Oct 15 '15 17:10 amiller

Good day. I still have with running the basic example. I made the changes made on the comments above but I'm still getting an error. This is the error that I get after running this command (../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r -t | grep -e "received: getaddr" -e "received: verack"):

Traceback (most recent call last):
  File "../src/bitcoind/shadow-bitcoind", line 167, in <module>
    main()
  File "../src/bitcoind/shadow-bitcoind", line 28, in main
    ap.add_argument('-r', '--reset', action="store_true", dest="reset", help="reset data directory before running", default=False)
  File "/usr/lib/python2.7/argparse.py", line 1297, in add_argument
    return self._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1671, in _add_action
    self._optionals._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1498, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1311, in _add_action
    self._check_conflict(action)
  File "/usr/lib/python2.7/argparse.py", line 1449, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/usr/lib/python2.7/argparse.py", line 1456, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument -r/--reset: conflicting option string(s): -r, --reset

sthembilm avatar Nov 04 '15 10:11 sthembilm

I am trying to run the basic example and this is the command (../src/bitcoind/shadow-bitcoind -y -i ../resource/shadow.config.xml -r -t | grep -e "received: getaddr" -e "received: verack") but I am getting an. This is the error that I'm getting:

[2015-11-10 08:28:09.016896] bitcoind: Data exists in output path
template None
copying /home/smthethwa/shadow-plugin-bitcoin/run/data/bcdnode1
copying /home/smthethwa/shadow-plugin-bitcoin/run/data/bcdnode2
[2015-11-10 08:28:09.017766] bitcoind: Data directory reset in output path
[2015-11-10 08:28:09.019297] bitcoind: set environmental variables for libevent: EVENT_NOSELECT, EVENT_NOPOLL, EVENT_NOKQUEUE, EVENT_NODEVPOLL, EVENT_NOEVPORT, EVENT_NOWIN32
[2015-11-10 08:28:09.019446] bitcoind: calling '/home/smthethwa/.shadow/bin/shadow --preload=/home/smthethwa/.shadow/lib/libshadow-preload-bitcoind.so  /home/smthethwa/shadow-plugin-bitcoin/resource/shadow.config.xml', output directed to '/home/smthethwa/shadow-plugin-bitcoin/run/data/shadow.log'
00:00:00.000080 [thread-0] n/a [shadow-message] [n/a] [master_run] Shadow v1.10.2-0-g1598ccc 2015-05-27 (built 2015-11-09)
00:00:00.000134 [thread-0] n/a [shadow-message] [n/a] [master_run] For more information, visit https://shadow.github.io or https://github.com/shadow
00:00:00.000226 [thread-0] n/a [shadow-message] [n/a] [master_run] Shadow initialized at 2015-11-10 08:28:09 using GLib v2.40.2
00:00:00.000257 [thread-0] n/a [shadow-message] [n/a] [master_run] args=/home/smthethwa/.shadow/bin/shadow --preload=/home/smthethwa/.shadow/lib/libshadow-preload-bitcoind.so /home/smthethwa/shadow-plugin-bitcoin/resource/shadow.config.xml
00:00:00.000285 [thread-0] n/a [shadow-message] [n/a] [master_run] LD_PRELOAD=/home/smthethwa/.shadow/lib/libshadow-preload-bitcoind.so:/home/smthethwa/.shadow/lib/libshadow-interpose.so
00:00:00.000309 [thread-0] n/a [shadow-message] [n/a] [master_run] SHADOW_SPAWNED=TRUE
00:00:00.000506 [thread-0] n/a [shadow-message] [n/a] [master_run] successfully parsed Shadow XML input!
write skipping worker
00:00:00.000697 [thread-0] n/a [shadow-message] [n/a] [_topology_loadGraph] reading graphml topology graph at '/tmp/shadow-cdata-Y9WV7X.graphml.xml'...
00:00:00.001099 [thread-0] n/a [shadow-message] [n/a] [_topology_loadGraph] successfully read graphml topology graph at '/tmp/shadow-cdata-Y9WV7X.graphml.xml'
00:00:00.001132 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphProperties] checking graph properties...
00:00:00.001194 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphProperties] topology graph is complete, undirected, and strongly connected with 1 cluster
00:00:00.001219 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphProperties] checking graph attributes...
00:00:00.001300 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphProperties] successfully verified graph attributes
00:00:00.001324 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphVertices] checking graph vertices...
00:00:00.001352 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphVertices] 1 graph vertices ok
00:00:00.001374 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphEdges] checking graph edges...
00:00:00.001403 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraphEdges] 1 graph edges ok
00:00:00.001428 [thread-0] n/a [shadow-message] [n/a] [_topology_checkGraph] successfully parsed graphml and validated topology: graph is strongly connected with 1 cluster, 1 vertex, and 1 edge
00:00:00.004214 [thread-0] n/a [shadow-critical] [n/a] [program_new] g_module_open() failed: /home/smthethwa/.shadow/plugins/libshadow-plugin-bitcoind.so: undefined symbol: _Z18addmultisigaddressRKSt6vectorIN11json_spirit10Value_implINS0_13Config_vectorISsEEEESaIS4_EEb
00:00:00.004254 [thread-0] n/a [shadow-error] [n/a] [program_new] unable to load private plug-in '/home/smthethwa/.shadow/plugins/libshadow-plugin-bitcoind.so'
**ERROR ENCOUNTERED**
    At process: 31534 (parent 31532)
    At file: /home/smthethwa/shadow/src/support/shd-logging.c
    At line: 54
    At function: logging_handleLog
    Message: FALSE && "failure due to error-level log message"
**BEGIN BACKTRACE**
Obtained 14 stack frames:
    /home/smthethwa/.shadow/bin/shadow() [0x43c97c]
    /home/smthethwa/.shadow/bin/shadow(utility_handleError+0x34) [0x43c3f4]
    /home/smthethwa/.shadow/bin/shadow(logging_handleLog+0x1df) [0x43132f]
    /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_logv+0x1b1) [0x7f413e6b7ae1]
    /home/smthethwa/.shadow/bin/shadow(logging_logv+0x41c) [0x43175c]
    /home/smthethwa/.shadow/bin/shadow(logging_log+0x157) [0x431a17]
    /home/smthethwa/.shadow/bin/shadow(program_new+0x16a) [0x42031a]
    /home/smthethwa/.shadow/bin/shadow(loadplugin_run+0x6f) [0x42d55f]
    /home/smthethwa/.shadow/bin/shadow(runnable_run+0xbf) [0x42f7bf]
    /home/smthethwa/.shadow/bin/shadow(master_run+0x385) [0x40d545]
    /home/smthethwa/.shadow/bin/shadow(shadow_main+0x34c) [0x40c67c]
    /home/smthethwa/.shadow/bin/shadow(main+0x22) [0x43ca72]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f413debeec5]
    /home/smthethwa/.shadow/bin/shadow() [0x40c269]
**END BACKTRACE**
**ABORTING**
**ERROR ENCOUNTERED**
    At process: 31534 (parent 31532)
    At file: /home/smthethwa/shadow/src/support/shd-logging.c
    At line: 54
    At function: logging_handleLog
    Message: FALSE && "failure due to error-level log message"
**BEGIN BACKTRACE**
Obtained 14 stack frames:
    /home/smthethwa/.shadow/bin/shadow() [0x43c97c]
    /home/smthethwa/.shadow/bin/shadow(utility_handleError+0x34) [0x43c3f4]
    /home/smthethwa/.shadow/bin/shadow(logging_handleLog+0x1df) [0x43132f]
    /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_logv+0x1b1) [0x7f413e6b7ae1]
    /home/smthethwa/.shadow/bin/shadow(logging_logv+0x41c) [0x43175c]
    /home/smthethwa/.shadow/bin/shadow(logging_log+0x157) [0x431a17]
    /home/smthethwa/.shadow/bin/shadow(program_new+0x16a) [0x42031a]
    /home/smthethwa/.shadow/bin/shadow(loadplugin_run+0x6f) [0x42d55f]
    /home/smthethwa/.shadow/bin/shadow(runnable_run+0xbf) [0x42f7bf]
    /home/smthethwa/.shadow/bin/shadow(master_run+0x385) [0x40d545]
    /home/smthethwa/.shadow/bin/shadow(shadow_main+0x34c) [0x40c67c]
    /home/smthethwa/.shadow/bin/shadow(main+0x22) [0x43ca72]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f413debeec5]
    /home/smthethwa/.shadow/bin/shadow() [0x40c269]
**END BACKTRACE**
**ABORTING**
[2015-11-10 08:28:09.140994] bitcoind: Shadow returned 0 in 0:00:00.121435 seconds

Am I missing something in the installation instructions or is it something else?

sthembilm avatar Nov 10 '15 06:11 sthembilm

Your first error was related to the --reset option:

argparse.ArgumentError: argument -r/--reset: conflicting option string(s): -r, --reset

It seems like you are not running the plugin on the master branch that includes me latest fix.

Your second error is related to the plugin that you built:

[program_new] g_module_open() failed: /home/smthethwa/.shadow/plugins/libshadow-plugin-bitcoind.so: undefined symbol: _Z18addmultisigaddressRKSt6vectorIN11json_spirit10Value_implINS0_13Config_vectorISsEEEESaIS4_EEb

That undefined symbol appeared from somewhere... but where? Did you change some of the code or link in a new library while compiling the plugin? Did you use a different version of one of the libraries listed on the wiki?

robgjansen avatar Nov 10 '15 12:11 robgjansen

Thank you for responding. Yes I did make changes to the code based on the fix you posted above and I got the second error. Not really sure where the undefined symbol is coming from.

sthembilm avatar Nov 10 '15 12:11 sthembilm

You should be using shadow-plugin-bitcoin from the master branch which already includes my commit above and should have already fixed it for you. Are you using the master branch? Which files did you change? If you were not using master, you may want to start a fresh install and go through the wiki instructions again. It was working for me when I tried it on my VM.

robgjansen avatar Nov 10 '15 17:11 robgjansen

Which version of the Bitcoin code are you using, in shadow-plugin-bitcoin/build/bitcoin? The wiki recommends using git clone https://github.com/amiller/bitcoin.git -b 0.9.2-netmine. It's possible to use newer versions, but that requires some manual effort to edit the cmake files.

amiller avatar Nov 10 '15 18:11 amiller

@robgjansen I changed the shadow-bitcoind file and the shadow.config.xml. I am not really sure which one is the main branch.

sthembilm avatar Nov 11 '15 05:11 sthembilm

I will try reinstalling now and see what happens. @amiller I will check it out thanks.

sthembilm avatar Nov 11 '15 05:11 sthembilm

@amiller the version I'm using is: git clone https://github.com/amiller/bitcoin.git -b 0.9.2-netmine

sthembilm avatar Nov 11 '15 06:11 sthembilm

@robgjansen I reinstalled it again and still have an error running both the examples

sthembilm avatar Nov 11 '15 13:11 sthembilm