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

Partial fix for issue 303 #336

Merged
merged 2 commits into from
Aug 14, 2017
Merged

Conversation

pmconrad
Copy link
Contributor

This PR gets rid of the "no blocks to pop" message in witness_node and some unit tests.

IMO a better fix would be to define a clear distinction between "open" and "closed" states in the database, and handle state transitions within the database code. Feel free to reject this PR if you agree. :-)

@oxarbitrage oxarbitrage self-requested a review July 28, 2017 16:34
@oxarbitrage
Copy link
Member

tested and works good in the witness node, nice output:

...
1533270ms th_a       application.cpp:538           handle_block         ] Got block: #18670362 time: 2017-07-28T19:25:33 latency: 270 ms from: bhuz  irreversible
: 18670337 (-25)
1534008ms asio       main.cpp:170                  operator()           ] Caught SIGINT attempting to exit cleanly
1534033ms th_a       main.cpp:183                  main                 ] Exiting from signal 2
1534132ms th_a       db_management.cpp:153         close                ] Rewinding from 18670362 to 18670342
root@NC-PH-1346-07:~/bitshares/pull336/bitshares-core# 

However in the tests running a random one as:

./chain_test -t operation_tests/worker_create_test -l all

...
/root/bitshares/pull336/bitshares-core/tests/common/database_fixture.cpp(125): info: check db.get_node_properties().skip_flags == database::skip_nothing passed
2335372ms th_a       db_management.cpp:153         close                ] Rewinding from 2 to 0
2335372ms th_a       db_management.cpp:171         close                ] Database close unexpected exception: {"code":10,"name":"assert_exception","message":"As
sert Exception","stack":[{"context":{"level":"error","file":"fork_database.cpp","line":41,"method":"pop_block","hostname":"","thread_name":"th_a","timestamp":"20
17-07-28T19:38:55"},"format":"_head: no blocks to pop","data":{}},{"context":{"level":"warn","file":"db_block.cpp","line":431,"method":"pop_block","hostname":"",
"thread_name":"th_a","timestamp":"2017-07-28T19:38:55"},"format":"","data":{}}]}
Leaving test case "worker_create_test"; testing time: 33046mks
Leaving test suite "operation_tests"

We could just remove the exception log at https://github.com/pmconrad/graphene/blob/165c914308b8b6df915b9fbd79a3279a1bf2ae2e/libraries/chain/db_management.cpp#L171

It will not be the first catch with no log in the code, there is actually one just above at https://github.com/pmconrad/graphene/blob/165c914308b8b6df915b9fbd79a3279a1bf2ae2e/libraries/chain/db_management.cpp#L164

Output with that change in the same test case will be:

/root/bitshares/pull336/bitshares-core/tests/common/database_fixture.cpp(211): info: check core_in_orders.value == reported_core_in_orders.value passed
/root/bitshares/pull336/bitshares-core/tests/common/database_fixture.cpp(125): info: check db.get_node_properties().skip_flags == database::skip_nothing passed
3275391ms th_a       db_management.cpp:153         close                ] Rewinding from 2 to 0
Leaving test case "worker_create_test"; testing time: 35791mks
Leaving test suite "operation_tests"
Leaving test suite "Master Test Suite"

*** No errors detected
root@NC-PH-1346-07:~/bitshares/pull336/bitshares-core/tests# 

I will approve it as it is with a commit to remove the exception wlog is that is not a problem.

adding @abitmore so he can take another look. good job :)

@pmconrad
Copy link
Contributor Author

The message still appears in those unit tests that don't create a sufficient number of blocks. In #303 I identified 2 reasons for the message, and this PR fixes only the first.
I'm against removing the log message because the message indicates a problem that should be fixed, see my original comment above.

Copy link
Member

@abitmore abitmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Copy link
Member

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good enough, i am merging it.

@oxarbitrage oxarbitrage merged commit 999bb46 into bitshares:develop Aug 14, 2017
yoyowd referenced this pull request in yoyow-org/yoyow-core Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants