Uncaught exception in bitcoin_rpc_client::getblock #336

Closed
opened 2022-03-30 13:20:16 +00:00 by vampik · 17 comments
vampik commented 2022-03-30 13:20:16 +00:00 (Migrated from gitlab.com)

We have an uncaught exception that leads to abort when we parse json, that comes from bitcoin_rpc_client::getblock.

Place in code:

https://gitlab.com/PBSA/peerplays/-/blob/develop/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp#L450

Environment:

I use peerplays-qa-environment (bitcoin node version 0.21)

witness_node is latest from develop branch (last commit):
0e5d599fdd

Steps to reproduce:

  1. Run fresh container for peerplays-qa-environment_bitcoin-for-peerplays_1
  2. Run witness_node with config file from peerplays-all-in-one container
  3. Execute ./init-network.sh from bitcoin container
We have an uncaught exception that leads to abort when we parse json, that comes from bitcoin_rpc_client::getblock. Place in code: https://gitlab.com/PBSA/peerplays/-/blob/develop/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp#L450 **Environment:** I use peerplays-qa-environment (bitcoin node version 0.21) `witness_node` is latest from develop branch (last commit): https://gitlab.com/PBSA/peerplays/-/commit/0e5d599fdd4208f1064c2d354c055b962fdbc975 **Steps to reproduce:** 1) Run fresh container for peerplays-qa-environment_bitcoin-for-peerplays_1 2) Run `witness_node` with config file from peerplays-all-in-one container 3) Execute `./init-network.sh` from bitcoin container
vampik commented 2022-03-30 13:20:32 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
vampik commented 2022-03-30 13:20:47 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
vampik commented 2022-03-30 13:21:52 +00:00 (Migrated from gitlab.com)

At least we should wrap this code with try - catch block.

At least we should wrap this code with `try` - `catch` block.
vampik commented 2022-03-30 15:20:22 +00:00 (Migrated from gitlab.com)

The problem is actually here:

https://gitlab.com/PBSA/peerplays/-/blob/develop/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp#L916

We receive a reply, but don't check whether it is success or not

So in body we have this error message: Server responded with error code 500: Work queue depth exceeded

That is not json and it throws exception

The problem is actually here: https://gitlab.com/PBSA/peerplays/-/blob/develop/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp#L916 We receive a reply, but don't check whether it is success or not So in body we have this error message: Server responded with error code 500: Work queue depth exceeded That is not json and it throws exception
vampik commented 2022-04-05 05:34:33 +00:00 (Migrated from gitlab.com)

assigned to @vampik

assigned to @vampik
vampik commented 2022-04-05 07:29:03 +00:00 (Migrated from gitlab.com)

mentioned in commit 4a5cbb1153

mentioned in commit 4a5cbb115371d1cd7cec0bcd8d9cf3d4a89d4818
vampik commented 2022-04-05 07:29:04 +00:00 (Migrated from gitlab.com)

mentioned in commit 161fcc06ec

mentioned in commit 161fcc06ec22152aa3303f3d96f07dff932da719
vampik commented 2022-04-05 07:35:17 +00:00 (Migrated from gitlab.com)

mentioned in merge request !95

mentioned in merge request !95
vampik commented 2022-04-06 23:23:49 +00:00 (Migrated from gitlab.com)

mentioned in commit d49017ff21

mentioned in commit d49017ff2117092135641595147b8e5d501f0f2b
serkixenos commented 2022-04-06 23:23:50 +00:00 (Migrated from gitlab.com)

mentioned in commit d7c654500e

mentioned in commit d7c654500ec75710fcbf5f0cc0044362c63d4270
serkixenos commented 2022-04-06 23:24:26 +00:00 (Migrated from gitlab.com)

assigned to @prandnum

assigned to @prandnum
prandnum commented 2022-04-08 17:39:36 +00:00 (Migrated from gitlab.com)

When init script of bitcoin was executed the peerplays container restarted, following message was seen in logs "{"log":"double free or corruption (fasttop)\n","stream":"stderr","time":"2022-04-08T17:37:29.800023595Z"}
"

2247001ms th_a       witness.cpp:191               block_production_loo ] Generated block #14759 with timestamp 2022-04-08T17:37:27 at time 2022-04-08T17:37:27
double free or corruption (fasttop)
qa@PBSA-Dev:~/07042022/peerplays-utils/peerplays-qa-environment$


qa@PBSA-Dev:~/07042022/peerplays-utils/peerplays-qa-environment$ sudo docker ps -a
CONTAINER ID   IMAGE                   COMMAND                  CREATED        STATUS                    PORTS                                                                                                                                             NAMES
7c6f29c6e641   peerplays-all-in-one    "./witness_node -d .…"   12 hours ago   Up 19 seconds             0.0.0.0:8090->8090/tcp, :::8090->8090/tcp, 22/tcp, 0.0.0.0:9777->9777/tcp, :::9777->9777/tcp                                                      peerplays-qa-environment_peerplays-all-in-one_1
0f307c4b77c6   peerplays-base          "bash"                   12 hours ago   Exited (0) 12 hours ago                                                                                                                                                     peerplays-qa-environment_peerplays-base_1
bf9042518c94   875cadeaf455            "/bin/sh -c 'cd src/…"   23 hours ago   Exited (2) 22 hours ago                                                                                                                                                     sleepy_northcutt
1b99ae591735   hive-for-peerplays      "./hived -d ./hived_…"   23 hours ago   Up 23 hours               22/tcp, 0.0.0.0:28090-28091->28090-28091/tcp, :::28090-28091->28090-28091/tcp                                                                     peerplays-qa-environment_hive-for-peerplays_1
a6c2ad2b21f7   ubuntu-for-peerplays    "bash"                   23 hours ago   Exited (0) 12 hours ago                                                                                                                                                     peerplays-qa-environment_ubuntu-for-peerplays_1
45ae97dc9d9c   bitcoin-for-peerplays   "./bitcoind -datadir…"   23 hours ago   Up 23 hours               0.0.0.0:8332->8332/tcp, :::8332->8332/tcp, 0.0.0.0:11111->11111/tcp, :::11111->11111/tcp, 22/tcp, 0.0.0.0:18444->18444/tcp, :::18444->18444/tcp   peerplays-qa-environment_bitcoin-for-peerplays_1
qa@PBSA-Dev:~/07042022/peerplays-utils/peerplays-qa-environment$

@serkixenos @vampik

When init script of bitcoin was executed the peerplays container restarted, following message was seen in logs "{"log":"double free or corruption (fasttop)\n","stream":"stderr","time":"2022-04-08T17:37:29.800023595Z"} " ``` 2247001ms th_a witness.cpp:191 block_production_loo ] Generated block #14759 with timestamp 2022-04-08T17:37:27 at time 2022-04-08T17:37:27 double free or corruption (fasttop) qa@PBSA-Dev:~/07042022/peerplays-utils/peerplays-qa-environment$ qa@PBSA-Dev:~/07042022/peerplays-utils/peerplays-qa-environment$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7c6f29c6e641 peerplays-all-in-one "./witness_node -d .…" 12 hours ago Up 19 seconds 0.0.0.0:8090->8090/tcp, :::8090->8090/tcp, 22/tcp, 0.0.0.0:9777->9777/tcp, :::9777->9777/tcp peerplays-qa-environment_peerplays-all-in-one_1 0f307c4b77c6 peerplays-base "bash" 12 hours ago Exited (0) 12 hours ago peerplays-qa-environment_peerplays-base_1 bf9042518c94 875cadeaf455 "/bin/sh -c 'cd src/…" 23 hours ago Exited (2) 22 hours ago sleepy_northcutt 1b99ae591735 hive-for-peerplays "./hived -d ./hived_…" 23 hours ago Up 23 hours 22/tcp, 0.0.0.0:28090-28091->28090-28091/tcp, :::28090-28091->28090-28091/tcp peerplays-qa-environment_hive-for-peerplays_1 a6c2ad2b21f7 ubuntu-for-peerplays "bash" 23 hours ago Exited (0) 12 hours ago peerplays-qa-environment_ubuntu-for-peerplays_1 45ae97dc9d9c bitcoin-for-peerplays "./bitcoind -datadir…" 23 hours ago Up 23 hours 0.0.0.0:8332->8332/tcp, :::8332->8332/tcp, 0.0.0.0:11111->11111/tcp, :::11111->11111/tcp, 22/tcp, 0.0.0.0:18444->18444/tcp, :::18444->18444/tcp peerplays-qa-environment_bitcoin-for-peerplays_1 qa@PBSA-Dev:~/07042022/peerplays-utils/peerplays-qa-environment$ ``` @serkixenos @vampik
vampik commented 2022-04-15 08:54:40 +00:00 (Migrated from gitlab.com)

@prandnum
Create new ticket for this issue:
https://gitlab.com/PBSA/peerplays/-/issues/345

@prandnum Create new ticket for this issue: https://gitlab.com/PBSA/peerplays/-/issues/345
vampik commented 2022-04-18 06:04:42 +00:00 (Migrated from gitlab.com)

mentioned in issue #345

mentioned in issue #345
prandnum commented 2022-04-27 13:31:10 +00:00 (Migrated from gitlab.com)

@vampik The following exception is seen while running the bitcoin init script.

As the exception is caught now, the bug can be closed or the bug was raised to fix the error scenario also?

719859ms th_�       sidechain_net_handler_bitcoin.cpp:516 getblock             ] Bitcoin RPC call getblock with body {"jsonrpc": "1.0", "id":"getblock", "method": "getblock", "params": ["521D366BE7C60D37279E91AD500E074111E2FDC344350513E0806559992790CD", 2] } generate exception: '/usr/include/boost/property_tree/json_parser/detail/parser.hpp(46): Throw in function void boost::property_tree::json_parser::detail::source<Encoding, Iterator, Sentinel>::parse_error(const char*) [with Encoding = boost::property_tree::json_parser::detail::encoding<char>; Iterator = std::istreambuf_iterator<char, std::char_traits<char> >; Sentinel = std::istreambuf_iterator<char, std::char_traits<char> >]
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::json_parser::json_parser_error> >
std::exception::what: <unspecified file>(1): expected value
'
@vampik The following exception is seen while running the bitcoin init script. As the exception is caught now, the bug can be closed or the bug was raised to fix the error scenario also? ``` 719859ms th_� sidechain_net_handler_bitcoin.cpp:516 getblock ] Bitcoin RPC call getblock with body {"jsonrpc": "1.0", "id":"getblock", "method": "getblock", "params": ["521D366BE7C60D37279E91AD500E074111E2FDC344350513E0806559992790CD", 2] } generate exception: '/usr/include/boost/property_tree/json_parser/detail/parser.hpp(46): Throw in function void boost::property_tree::json_parser::detail::source<Encoding, Iterator, Sentinel>::parse_error(const char*) [with Encoding = boost::property_tree::json_parser::detail::encoding<char>; Iterator = std::istreambuf_iterator<char, std::char_traits<char> >; Sentinel = std::istreambuf_iterator<char, std::char_traits<char> >] Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::json_parser::json_parser_error> > std::exception::what: <unspecified file>(1): expected value ' ```
vampik commented 2022-04-27 13:49:06 +00:00 (Migrated from gitlab.com)

@prandnum
As I mentioned earlier in my reply, we receive message from bitcoin that is not a json.
So we skip this message.
I think this issue can be closed.

@prandnum As I mentioned earlier in my reply, we receive message from bitcoin that is not a json. So we skip this message. I think this issue can be closed.
prandnum commented 2022-04-27 14:36:22 +00:00 (Migrated from gitlab.com)

closing with above comment.

closing with above comment.
prandnum (Migrated from gitlab.com) closed this issue 2022-04-27 14:36:23 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#336
No description provided.