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

Crash - assertion failed. #429

Open
centaur1 opened this issue Sep 4, 2018 · 4 comments
Open

Crash - assertion failed. #429

centaur1 opened this issue Sep 4, 2018 · 4 comments

Comments

@centaur1
Copy link

centaur1 commented Sep 4, 2018

This happens reasonably often.

assertion failed. Please file a bugreport at https://github.com/miguelfreitas/twister-core/issues
Please include the following information:

version: 1.0.0.0
$Rev: 7680 $
file: 'libtorrent/src/torrent.cpp'
line: 3066
function: void libtorrent::torrent::piece_finished(int, int, boost::uint32_t, int)
expression: !m_picker->have_piece(index)

stack:
1: assert_fail(char const*, int, char const*, char const*, char const*)
2: libtorrent::torrent::piece_finished(int, int, unsigned int, int)
3: boost::detail::function::void_function_obj_invoker2<boost::_bi::bind_t<void, boost::_mfi::mf4<void, libtorrent::torrent, int, int, unsigned int, int>, boost::_bi::list5<boost::_bi::value<boost::shared_ptrlibtorrent::torrent >, boost::_bi::value, boost::arg<1>, boost::arg<2>, boost::_bi::value > >, void, int, unsigned int>::invoke(boost::detail::function::function_buffer&, int, unsigned int)
4: libtorrent::torrent::on_piece_verified(int, libtorrent::disk_io_job const&, boost::function<void (int, unsigned int)>)
5: void boost::_mfi::mf3<void, libtorrent::torrent, int, libtorrent::disk_io_job const&, boost::function<void (int, unsigned int)> >::call<boost::shared_ptrlibtorrent::torrent, int, libtorrent::disk_io_job const, boost::function<void (int, unsigned int)> >(boost::shared_ptrlibtorrent::torrent&, void const*, int&, libtorrent::disk_io_job const&, boost::function<void (int, unsigned int)>&) const
6: void boost::_bi::list4<boost::_bi::value<boost::shared_ptrlibtorrent::torrent >, boost::arg<1>, boost::arg<2>, boost::_bi::value<boost::function<void (int, unsigned int)> > >::operator()<boost::_mfi::mf3<void, libtorrent::torrent, int, libtorrent::disk_io_job const&, boost::function<void (int, unsigned int)> >, boost::_bi::list2<int&, libtorrent::disk_io_job const&> >(boost::_bi::type, boost::_mfi::mf3<void, libtorrent::torrent, int, libtorrent::disk_io_job const&, boost::function<void (int, unsigned int)> >&, boost::_bi::list2<int&, libtorrent::disk_io_job const&>&, int)
7: boost::detail::function::void_function_obj_invoker2<boost::_bi::bind_t<void, boost::_mfi::mf3<void, libtorrent::torrent, int, libtorrent::disk_io_job const&, boost::function<void (int, unsigned int)> >, boost::_bi::list4<boost::_bi::value<boost::shared_ptrlibtorrent::torrent >, boost::arg<1>, boost::arg<2>, boost::_bi::value<boost::function<void (int, unsigned int)> > > >, void, int, libtorrent::disk_io_job const&>::invoke(boost::detail::function::function_buffer&, int, libtorrent::disk_io_job const&)
8: libtorrent::completion_queue_handler(std::__1::list<std::__1::pair<libtorrent::disk_io_job, int>, std::__1::allocator<std::__1::pair<libtorrent::disk_io_job, int> > >)
9: void boost::asio::asio_handler_invoke<boost::_bi::bind_t<void, void (
)(std::__1::list<std::__1::pair<libtorrent::disk_io_job, int>, std::__1::allocator<std::__1::pair<libtorrent::disk_io_job, int> > >), boost::_bi::list1<boost::_bi::value<std::__1::list<std::__1::pair<libtorrent::disk_io_job, int>, std::__1::allocator<std::__1::pair<libtorrent::disk_io_job, int> > >> > > >(boost::_bi::bind_t<void, void ()(std::__1::list<std::__1::pair<libtorrent::disk_io_job, int>, std::__1::allocator<std::__1::pair<libtorrent::disk_io_job, int> > >), boost::_bi::list1<boost::_bi::value<std::__1::list<std::__1::pair<libtorrent::disk_io_job, int>, std::__1::allocator<std::__1::pair<libtorrent::disk_io_job, int> > >> > >&, ...)
10: boost::asio::detail::completion_handler<boost::_bi::bind_t<void, void (
)(std::__1::list<std::__1::pair<libtorrent::disk_io_job, int>, std::__1::allocator<std::__1::pair<libtorrent::disk_io_job, int> > >), boost::_bi::list1<boost::_bi::value<std::__1::list<std::__1::pair<libtorrent::disk_io_job, int>, std::__1::allocator<std::__1::pair<libtorrent::disk_io_job, int> > >> > > >::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long)
11: boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&)
12: boost::asio::detail::scheduler::run(boost::system::error_code&)
13: boost::asio::io_context::run(boost::system::error_code&)
14: libtorrent::aux::session_impl::main_thread()
15: boost::asio::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf0<void, libtorrent::aux::session_impl>, boost::_bi::list1<boost::_bi::valuelibtorrent::aux::session_impl* > > >::run()
16: boost_asio_detail_posix_thread_function
17: _pthread_body
18: _pthread_body
19: thread_start

@centaur1
Copy link
Author

The way to duplicate this is if you do this:
If twisterd has returned null from something like this:
/usr/name/twister-core/twisterd getposts 1 '[{"username":"whateveruser"}]'
[
]

and then you attempt to do a post like this:
/usr/name/twister-core/twisterd newpostmsg whateveruser 1 'something here https://google.com'

It will crash as above. I've duplicated it about a dozen times so far with tests. I presume it is because it is busy fetching information on that user, hence the
"!m_picker->have_piece(index)"

In short, if someone tries to post for a particular user while it is still fetching for that particular user, it crashes from my testing.

So one can mitigate it by checking to see if NULL is returned from a twisterd call checking a user prior to attempting to post their post. It shouldn't crash of course, but at least one can check for the condition prior to doing a post.

In case anyone else sees that, at least it can be mitigated.

@centaur1
Copy link
Author

centaur1 commented Sep 25, 2018

What I ended up doing besides just checking it is to programmatically do a
unfollow <username> '["<username>"]'
followed by a
follow ... as above

This seems to be the same error as is checked in the html interface with the message:
Internal error: lastPostId unknown (following yourself may fix!)": "Internal error: lastPostId unknown (following yourself may fix!)

@centaur1 centaur1 changed the title Crash Crash - assertion failed. Sep 25, 2018
@miguelfreitas
Copy link
Owner

Hi @centaur1. Thank you very much for your investigation!
It is great that you have found a way to reproduce it, as it makes fixing a much easier job :-)
I just can't promise when I'll be able to look into that issue because I'm quite busy at work these days...

@centaur1
Copy link
Author

If I can dig more into the code, I'll post it here. It seems to be really two related issues:

  1. The assertion issue.
  2. The "Internal error: lastPostId unknown" that is found in twister-html.

I think they are related in that if the lastPostId is unknown (the torrent hasn't been fetched yet either) then one would be using an incorrect K value.

My "fix" was doing a dhtget, unfollow, and then follow.

I am not sure about all that though since I am still progressing on it.

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

No branches or pull requests

2 participants