{"action":"created","issue":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4923","repository_url":"https://api.github.com/repos/qbittorrent/qBittorrent","labels_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4923/labels{/name}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4923/comments","events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4923/events","html_url":"https://github.com/qbittorrent/qBittorrent/issues/4923","id":139067519,"number":4923,"title":"Integer division by zero exception on Windows","user":{"login":"tomikaa87","id":15613825,"avatar_url":"https://avatars.githubusercontent.com/u/15613825?v=3","gravatar_id":"","url":"https://api.github.com/users/tomikaa87","html_url":"https://github.com/tomikaa87","followers_url":"https://api.github.com/users/tomikaa87/followers","following_url":"https://api.github.com/users/tomikaa87/following{/other_user}","gists_url":"https://api.github.com/users/tomikaa87/gists{/gist_id}","starred_url":"https://api.github.com/users/tomikaa87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomikaa87/subscriptions","organizations_url":"https://api.github.com/users/tomikaa87/orgs","repos_url":"https://api.github.com/users/tomikaa87/repos","events_url":"https://api.github.com/users/tomikaa87/events{/privacy}","received_events_url":"https://api.github.com/users/tomikaa87/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/labels/Crashes","name":"Crashes","color":"A52A2A"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-07T19:20:05Z","updated_at":"2016-03-07T20:56:37Z","closed_at":null,"body":"Hi,\r\n\r\nAfter using qBittorent for almost a month, I got 200 torrents loaded, and today it began to crash after ~5 minutes of running with the following error:\r\n\r\n`Exception thrown at 0x0176B33C in qbittorrent.exe: 0xC0000094: Integer division by zero.\r\nUnhandled exception at 0x0176B33C in qbittorrent.exe: 0xC0000094: Integer division by zero.`\r\n\r\nBecause the client was working fine until today, the only way I can reproduce the issue is starting the client with the already mentioned 200 torrents and wait for a few minutes. The crash came when 11 torrents became active, but this number is not fixed.\r\n\r\nI have managed to get the call stack:\r\n\r\n```\r\n       qbittorrent.exe!libtorrent::torrent::get_piece_to_super_seed(const libtorrent::bitfield & bits) Line 3698\tC++\r\n \tqbittorrent.exe!libtorrent::peer_connection::second_tick(int tick_interval_ms) Line 4219\tC++\r\n \tqbittorrent.exe!libtorrent::torrent::second_tick(libtorrent::stat & accumulator, int tick_interval_ms) Line 8194\tC++\r\n \tqbittorrent.exe!libtorrent::aux::session_impl::on_tick(const boost::system::error_code & e) Line 3336\tC++\r\n \tqbittorrent.exe!boost::asio::asio_handler_invoke<boost::asio::detail::binder1<boost::_bi::bind_t<void,boost::_mfi::mf1<void,libtorrent::aux::session_impl,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<libtorrent::aux::session_impl *>,boost::arg<1> > >,boost::system::error_code> >(boost::asio::detail::binder1<boost::_bi::bind_t<void,boost::_mfi::mf1<void,libtorrent::aux::session_impl,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<libtorrent::aux::session_impl *>,boost::arg<1> > >,boost::system::error_code> & function, ...) Line 70\tC++\r\n \tqbittorrent.exe!boost::asio::detail::wait_handler<boost::_bi::bind_t<void,boost::_mfi::mf1<void,libtorrent::aux::session_impl,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<libtorrent::aux::session_impl *>,boost::arg<1> > > >::do_complete(boost::asio::detail::win_iocp_io_service * owner, boost::asio::detail::win_iocp_operation * base, const boost::system::error_code & __formal, unsigned int __formal) Line 70\tC++\r\n \tqbittorrent.exe!boost::asio::detail::win_iocp_io_service::do_one(bool block, boost::system::error_code & ec) Line 405\tC++\r\n \tqbittorrent.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code & ec) Line 164\tC++\r\n \tqbittorrent.exe!libtorrent::aux::session_impl::main_thread() Line 4916\tC++\r\n \tqbittorrent.exe!boost::asio::detail::win_thread_function(void * arg) Line 121\tC++\r\n \tqbittorrent.exe!thread_start<unsigned int (__stdcall*)(void *)>(void * const parameter) Line 115\tC++\r\n \t[External Code]\t\r\n \t[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]\t\r\n````\r\n\r\nI also have created a minidump file which can be downloaded from the following link, since it's 161 MiB: https://onedrive.live.com/redir?resid=F3265FAD5FB276FD!13654&authkey=!ADNuExJiJI5K6AU&ithint=file%2cdmp\r\n\r\nSome basic information:\r\nOS: Windows Server 2012 R2 Standard (6.3, build 9600), x64\r\nqBittorrent: 3.3.3\r\n\r\nCheers,\r\nTamas"},"comment":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/comments/193445473","html_url":"https://github.com/qbittorrent/qBittorrent/issues/4923#issuecomment-193445473","issue_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4923","id":193445473,"user":{"login":"tomikaa87","id":15613825,"avatar_url":"https://avatars.githubusercontent.com/u/15613825?v=3","gravatar_id":"","url":"https://api.github.com/users/tomikaa87","html_url":"https://github.com/tomikaa87","followers_url":"https://api.github.com/users/tomikaa87/followers","following_url":"https://api.github.com/users/tomikaa87/following{/other_user}","gists_url":"https://api.github.com/users/tomikaa87/gists{/gist_id}","starred_url":"https://api.github.com/users/tomikaa87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomikaa87/subscriptions","organizations_url":"https://api.github.com/users/tomikaa87/orgs","repos_url":"https://api.github.com/users/tomikaa87/repos","events_url":"https://api.github.com/users/tomikaa87/events{/privacy}","received_events_url":"https://api.github.com/users/tomikaa87/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T20:56:37Z","updated_at":"2016-03-07T20:56:37Z","body":"After a quick look, I have found out that in case of some torrents, `avail_vec` was empty and the end of `int torrent::get_piece_to_super_seed(bitfield const& bits)` when `return avail_vec[random() % avail_vec.size()];` is being executed.\r\n\r\nAs a quick workaround, I have paused this torrent and since then then client seems to be working fine."}}