bitshares / bitshares/bitshares-core

Test case `cli_quit` hang

Open
#2,205 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.2k
Forks
660
Avg merge
8h 17m
Merged PRs (30d)
26

Description

**Bug Description**

Reported in https://github.com/bitshares/bitshares-core/pull/2204#issuecomment-647053618 and then https://github.com/bitshares/bitshares-core/pull/2204#issuecomment-647107612, `cli_test` occasionally hang after finished running the `cli_quit` test case, with some messages or no message at all. Replacing `canceled_exception` with a new exception doesn't fix it. I guess the issue is related to exception handling in task management in FC. Probably #2076 will make it obsolete.

```
Testing wallet connection and quit command.
1435490ms th_a wallet_api_impl.cpp:168 quit ] Quitting Cli Wallet ...
/bts/tests/cli/main.cpp(364): info: check 'exception fc::canceled_exception is caught' passed
Cleanup cli_wallet::boost_fixture_test_case
1435491ms th_a db_management.cpp:243 close ] Rewinding from 0 to 0
1435513ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 163935040
1435513ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 163975424
1435513ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 163986128
1435513ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 163970032
1435513ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 163978432
1435514ms p2p thread.cpp:258 exec ] thread canceled: 9 canceled_exception: Canceled

{}
p2p thread_d.hpp:493 start_next_fiber
unknown location(0): fatal error in "cli_quit": memory access violation at address: 0x00000000: no mapping at fault address
/bts/tests/cli/main.cpp(364): last checkpoint
Test is aborted
Leaving test case "cli_quit"; testing time: 64241mks
Leaving test suite "Test Application"

*** 1 failure detected in test suite "Test Application"
```

```
Testing wallet connection and quit command.
1062625ms th_a wallet_api_impl.cpp:168 quit ] Quitting Cli Wallet ...
/bts/tests/cli/main.cpp(364): info: check 'exception fc::canceled_exception is caught' passed
Cleanup cli_wallet::boost_fixture_test_case
1062626ms th_a db_management.cpp:243 close ] Rewinding from 0 to 0
1062645ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 160498176
1062645ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 160538688
1062645ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 160549264
1062645ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 160533296
1062645ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 160541696
1062646ms p2p thread.cpp:258 exec ] thread canceled: 9 canceled_exception: Canceled

{}
p2p thread_d.hpp:493 start_next_fiber
```

```
Testing wallet connection and quit command.
226674ms th_a wallet_api_impl.cpp:168 quit ] Quitting Cli Wallet ...
/bts/tests/cli/main.cpp(364): info: check 'exception fc::cli_quit_exception is caught' passed
Cleanup cli_wallet::boost_fixture_test_case
226675ms th_a db_management.cpp:243 close ] Rewinding from 0 to 0
226699ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 146940560
226700ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 146981072
226700ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 146991648
226701ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 146975680
226701ms th_a database_api.cpp:91 ~database_api_impl ] freeing database api 146984080
226702ms p2p thread.cpp:258 exec ] thread canceled: 9 canceled_exception: Canceled

{}
p2p thread_d.hpp:493 start_next_fiber
unknown location(0): fatal error in "cli_quit": memory access violation at address: 0x00000000: no mapping at fault address
/bts/tests/cli/main.cpp(364): last checkpoint
Test is aborted
Leaving test case "cli_quit"; testing time: 71191mks
Leaving test suite "Test Application"

*** 1 failure detected in test suite "Test Application"
```

**Impacts**
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.
- [ ] API (the application programming interface)
- [ ] Build (the build process or something prior to compiled code)
- [ ] CLI (the command line wallet)
- [ ] Deployment (the deployment process after building such as Docker, Travis, etc.)
- [ ] DEX (the Decentralized EXchange, market engine, etc.)
- [ ] P2P (the peer-to-peer network for transaction/block propagation)
- [ ] Performance (system or user efficiency, etc.)
- [ ] Protocol (the blockchain logic, consensus, validation, etc.)
- [ ] Security (the security of system or user data, etc.)
- [ ] UX (the User Experience)
- [ ] Other (please add below)

**Steps To Reproduce**

Run `cli_test` repeatedly hundreds of times.

**Expected Behavior**

No error.

**Host Environment**

- Host OS: Ubuntu 16.04 LTS
- Host Physical RAM 16GB
- BitShares Version: develop
- OpenSSL Version: 1.0.2
- Boost Version: 1.58

## CORE TEAM TASK LIST
- [ ] Evaluate / Prioritize Bug Report
- [ ] Refine User Stories / Requirements
- [ ] Define Test Cases
- [ ] Design / Develop Solution
- [ ] Perform QA/Testing
- [ ] Update Documentation

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with tests/cli/main.cpp around line 364 and reproduce the issue by running cli_test repeatedly, as described. Read the reported p2p thread_d.hpp:493 stack location and the cli_quit test cleanup output to trace the intermittent hang or memory access violation. Done means cli_quit completes reliably without an error or aborted test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.