{"action":"created","issue":{"url":"https://api.github.com/repos/BitShares/bitshares/issues/1504","labels_url":"https://api.github.com/repos/BitShares/bitshares/issues/1504/labels{/name}","comments_url":"https://api.github.com/repos/BitShares/bitshares/issues/1504/comments","events_url":"https://api.github.com/repos/BitShares/bitshares/issues/1504/events","html_url":"https://github.com/BitShares/bitshares/issues/1504","id":69009431,"number":1504,"title":"Crash at exit in get_blockchain_synopsis","user":{"login":"theoreticalbts","id":10215982,"avatar_url":"https://avatars.githubusercontent.com/u/10215982?v=3","gravatar_id":"","url":"https://api.github.com/users/theoreticalbts","html_url":"https://github.com/theoreticalbts","followers_url":"https://api.github.com/users/theoreticalbts/followers","following_url":"https://api.github.com/users/theoreticalbts/following{/other_user}","gists_url":"https://api.github.com/users/theoreticalbts/gists{/gist_id}","starred_url":"https://api.github.com/users/theoreticalbts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theoreticalbts/subscriptions","organizations_url":"https://api.github.com/users/theoreticalbts/orgs","repos_url":"https://api.github.com/users/theoreticalbts/repos","events_url":"https://api.github.com/users/theoreticalbts/events{/privacy}","received_events_url":"https://api.github.com/users/theoreticalbts/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/BitShares/bitshares/labels/dnotestein","name":"dnotestein","color":"5319e7"},{"url":"https://api.github.com/repos/BitShares/bitshares/labels/emfrias","name":"emfrias","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-16T21:04:42Z","updated_at":"2015-04-16T21:05:59Z","closed_at":null,"body":"\r\nHere is the backtrace:\r\n\r\n    #0  0x00007ffff65f6cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56\r\n    #1  0x00007ffff65fa0d8 in __GI_abort () at abort.c:89\r\n    #2  0x00007ffff65efb86 in __assert_fail_base (fmt=0x7ffff6740830 \"%s%s%s:%u: %s%sAssertion `%s' failed.\\n%n\", assertion=assertion@entry=0x395558b \"false\", \r\n        file=file@entry=0x39546d8 \"btsxt/src/bitshares/libraries/client/client.cpp\", line=line@entry=1093, \r\n        function=function@entry=0x395b100 <bts::client::detail::client_impl::get_blockchain_synopsis(unsigned int, fc::ripemd160 const&, unsigned int)::__PRETTY_FUNCTION__> \"virtual std::vector<fc::ripemd160> bts::client::detail::client_impl::get_blockchain_synopsis(uint32_t, const item_hash_t&, uint32_t)\") at assert.c:92\r\n    #3  0x00007ffff65efc32 in __GI___assert_fail (assertion=0x395558b \"false\", file=0x39546d8 \"btsxt/src/bitshares/libraries/client/client.cpp\", line=1093, \r\n        function=0x395b100 <bts::client::detail::client_impl::get_blockchain_synopsis(unsigned int, fc::ripemd160 const&, unsigned int)::__PRETTY_FUNCTION__> \"virtual std::vector<fc::ripemd160> bts::client::detail::client_impl::get_blockchain_synopsis(uint32_t, const item_hash_t&, uint32_t)\") at assert.c:101\r\n    #4  0x000000000153e0ef in bts::client::detail::client_impl::get_blockchain_synopsis (this=0x933a690, item_type=1001, reference_point=..., number_of_blocks_after_reference_point=2305)\r\n        at btsxt/src/bitshares/libraries/client/client.cpp:1093\r\n    #5  0x00000000025f65ae in bts::net::detail::statistics_gathering_node_delegate_wrapper::__lambda59::operator() (__closure=0x7fffac091bc8) at btsxt/src/bitshares/libraries/net/node.cpp:5079\r\n    #6  0x00000000026157c8 in fc::detail::functor_run<bts::net::detail::statistics_gathering_node_delegate_wrapper::get_blockchain_synopsis(uint32_t, const item_hash_t&, uint32_t)::__lambda59>::run(void *, void *) (functor=0x7fffac091bc8, \r\n        prom=0x7fffac091cb8) at btsxt/src/bitshares/libraries/fc/include/fc/thread/task.hpp:77\r\n    #7  0x00000000018a8ad7 in fc::task_base::run_impl (this=0x7fffac091bf0) at btsxt/src/bitshares/libraries/fc/src/thread/task.cpp:43\r\n    #8  0x00000000018a89d4 in fc::task_base::run (this=0x7fffac091bf0) at btsxt/src/bitshares/libraries/fc/src/thread/task.cpp:32\r\n    #9  0x000000000188fe7e in fc::thread_d::run_next_task (this=0x933be20) at btsxt/src/bitshares/libraries/fc/src/thread/thread_d.hpp:498\r\n    #10 0x000000000189077b in fc::thread_d::process_tasks (this=0x933be20) at btsxt/src/bitshares/libraries/fc/src/thread/thread_d.hpp:547\r\n    #11 0x000000000188f32e in fc::thread_d::start_process_tasks (my=154385952) at btsxt/src/bitshares/libraries/fc/src/thread/thread_d.hpp:475\r\n    #12 0x00000000038399de in make_fcontext ()\r\n    #13 0x0000000000000002 in ?? ()\r\n    #14 0x0000000000000000 in ?? ()\r\n\r\nI have these local variables:\r\n\r\n    (gdb) info locals\r\n    __FUNCTION__ = \"get_blockchain_synopsis\"\r\n    synopsis = std::vector of length 0, capacity 0\r\n    __PRETTY_FUNCTION__ = \"virtual std::vector<fc::ripemd160> bts::client::detail::client_impl::get_blockchain_synopsis(uint32_t, const item_hash_t&, uint32_t)\"\r\n    low_block_num = 32767\r\n    high_block_num = 0\r\n    non_fork_high_block_num = 0\r\n    fork_history = std::vector of length 0, capacity 0\r\n    true_high_block_num = 32767\r\n\r\nThe line that is actually failing is https://github.com/BitShares/bitshares/blob/62b37c3b6879d2280f34eff5e6681e703a0fa3cc/libraries/client/client.cpp#L1093\r\n\r\nThis code is looking like it should maybe be refactored to use `FC_ASSERT`, maybe the try/catch block should be more localized to the place that is actually throwing the exception, and maybe we should rethrow the FC exception which might have more useful information attached.  I really am not very familiar with this part of the code but I think it is related to p2p stuff.\r\n\r\nI can't really figure out where it's being called, because it appears the entry point is in the bowels of fc and grepping for `get_blockchain_synopsis` does not reveal anything obvious.  It involves macro `INVOKE_AND_COLLECT_STATISTICS` and also FC multitasking, which are complex \"magical\" code involving macros and C++ stuff.  I don't understand them and they are not documented.\r\n\r\nHopefully someone else can make progress on this ticket (labeling it for @dnotestein and @emfrias because I think it is p2p related and they best understand the p2p code)"},"comment":{"url":"https://api.github.com/repos/BitShares/bitshares/issues/comments/93839533","html_url":"https://github.com/BitShares/bitshares/issues/1504#issuecomment-93839533","issue_url":"https://api.github.com/repos/BitShares/bitshares/issues/1504","id":93839533,"user":{"login":"theoreticalbts","id":10215982,"avatar_url":"https://avatars.githubusercontent.com/u/10215982?v=3","gravatar_id":"","url":"https://api.github.com/users/theoreticalbts","html_url":"https://github.com/theoreticalbts","followers_url":"https://api.github.com/users/theoreticalbts/followers","following_url":"https://api.github.com/users/theoreticalbts/following{/other_user}","gists_url":"https://api.github.com/users/theoreticalbts/gists{/gist_id}","starred_url":"https://api.github.com/users/theoreticalbts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theoreticalbts/subscriptions","organizations_url":"https://api.github.com/users/theoreticalbts/orgs","repos_url":"https://api.github.com/users/theoreticalbts/repos","events_url":"https://api.github.com/users/theoreticalbts/events{/privacy}","received_events_url":"https://api.github.com/users/theoreticalbts/received_events","type":"User","site_admin":false},"created_at":"2015-04-16T21:05:59Z","updated_at":"2015-04-16T21:05:59Z","body":"\r\nNote, this crash occurs at exit randomly."}}