Discussion:
[libtorrent] async_add_torrent crash on duplicate
Michael Mckeown
2016-05-13 17:20:30 UTC
Permalink
Was expecting to be able to catch a duplicate torrent error with this:

if ( auto at = libtorrent::alert_cast<
libtorrent::add_torrent_alert >( a ) )
{
int er = at->error.value();
if ( er == errors::error_code_enum::no_error )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : ok \n";
}
else if ( er == errors::error_code_enum::duplicate_torrent )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : duplicate_torrent\n";
}
}

but when I add the same magnet link again Libtorrent crashes with no
explanation, matters not if I use the add_torrent_alert or not.

Duplicates did work without crash with latest released build but I
rebuilt with the master today and the issue started when I was doing my
dupe dialog.

Thanks.
Arvid Norberg
2016-05-13 22:39:23 UTC
Permalink
It's clearly not supposed to crash. I'll take a look at that. This happens
in master only? or RC_1_1 too?
Post by Michael Mckeown
if ( auto at = libtorrent::alert_cast<
libtorrent::add_torrent_alert >( a ) )
{
int er = at->error.value();
if ( er == errors::error_code_enum::no_error )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : ok \n";
}
else if ( er == errors::error_code_enum::duplicate_torrent )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : duplicate_torrent\n";
}
}
but when I add the same magnet link again Libtorrent crashes with no
explanation, matters not if I use the add_torrent_alert or not.
Duplicates did work without crash with latest released build but I
rebuilt with the master today and the issue started when I was doing my
dupe dialog.
Thanks.
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
Arvid Norberg
2016-05-14 06:40:01 UTC
Permalink
I wrote a test which passes locally. let's see how it does in CI.
https://github.com/arvidn/libtorrent/pull/728
Post by Arvid Norberg
It's clearly not supposed to crash. I'll take a look at that. This happens
in master only? or RC_1_1 too?
On Fri, May 13, 2016 at 1:20 PM, Michael Mckeown <
Post by Michael Mckeown
if ( auto at = libtorrent::alert_cast<
libtorrent::add_torrent_alert >( a ) )
{
int er = at->error.value();
if ( er == errors::error_code_enum::no_error )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : ok \n";
}
else if ( er == errors::error_code_enum::duplicate_torrent )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : duplicate_torrent\n";
}
}
but when I add the same magnet link again Libtorrent crashes with no
explanation, matters not if I use the add_torrent_alert or not.
Duplicates did work without crash with latest released build but I
rebuilt with the master today and the issue started when I was doing my
dupe dialog.
Thanks.
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
--
Arvid Norberg
Michael Mckeown
2016-05-14 13:27:26 UTC
Permalink
Hi there, so this is only happening in the master, I've got it working
now though with:

p.flags = add_torrent_params::flag_duplicate_is_error;

perhaps I should have used this by default in the first place, sorry for
any inconvenience.
Post by Arvid Norberg
I wrote a test which passes locally. let's see how it does in CI.
https://github.com/arvidn/libtorrent/pull/728
Post by Arvid Norberg
It's clearly not supposed to crash. I'll take a look at that. This happens
in master only? or RC_1_1 too?
On Fri, May 13, 2016 at 1:20 PM, Michael Mckeown <
Post by Michael Mckeown
if ( auto at = libtorrent::alert_cast<
libtorrent::add_torrent_alert >( a ) )
{
int er = at->error.value();
if ( er == errors::error_code_enum::no_error )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : ok \n";
}
else if ( er == errors::error_code_enum::duplicate_torrent )
{
std::cout << "add_torrent_alert " << a->message ( ) <<
" : duplicate_torrent\n";
}
}
but when I add the same magnet link again Libtorrent crashes with no
explanation, matters not if I use the add_torrent_alert or not.
Duplicates did work without crash with latest released build but I
rebuilt with the master today and the issue started when I was doing my
dupe dialog.
Thanks.
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
Arvid Norberg
2016-05-14 14:09:46 UTC
Permalink
That test is running in master, and it covers both the case where
flag_duplicate_is_error is set and cleared. It sounds like it still crashes
for you if you don't set this flag, is that right?

Can you provide any other information about your system? Which platform are
you on? compiler and other settings in the add_torrent_params.
Post by Michael Mckeown
Hi there, so this is only happening in the master, I've got it working
p.flags = add_torrent_params::flag_duplicate_is_error;
keep in mind that there are other flags set by default which you are
clearing by that assignment. It's possible clearing those flags may be
what's preventing the crash too.
--
Arvid Norberg
Michael Mckeown
2016-05-14 15:52:47 UTC
Permalink
Hi there, yes as long as the flag is set everything is fine:

void add_magnet_to_client_session ( std::string& magnet , std::string& saveto )
{
add_torrent_params p;
p.save_path = saveto;
p.url = magnet;
p.flags = add_torrent_params::flag_duplicate_is_error;
Client_Session->async_add_torrent ( p );
}

but omit the flag and it's a crash, it kind of makes seance though as what else is going to happen but the docs say only save_path is mandatory.

Using vs 2015 and build from yesterdays master as:

toolset=msvc-14.0 boost-link=static runtime-link=static deprecated-functions=off encryption=on link=static dht=on logging=off i2p=on variant=release

with:

#define TORRENT_NO_DEPRECATE

Libtorrent builds without a single warning: http://pastebin.com/fcDkS4Xc


On 14/05/2016 15:09, Arvid Norberg wrote:

That test is running in master, and it covers both the case where
flag_duplicate_is_error is set and cleared. It sounds like it still crashes
for you if you don't set this flag, is that right?

Can you provide any other information about your system? Which platform are
you on? compiler and other settings in the add_torrent_params.


On Sat, May 14, 2016 at 9:27 AM, Michael Mckeown <***@outlook.com<mailto:***@outlook.com>


wrote:





Hi there, so this is only happening in the master, I've got it working
now though with:

p.flags = add_torrent_params::flag_duplicate_is_error;




keep in mind that there are other flags set by default which you are
clearing by that assignment. It's possible clearing those flags may be
what's preventing the crash too.
Arvid Norberg
2016-05-14 17:12:50 UTC
Permalink
Does the test pass for you? maybe there's something the test doesn't
capture.

(i.e. test_session.cpp)

On Sat, May 14, 2016 at 11:52 AM, Michael Mckeown <
Post by Michael Mckeown
void add_magnet_to_client_session ( std::string& magnet , std::string& saveto )
{
add_torrent_params p;
p.save_path = saveto;
p.url = magnet;
p.flags = add_torrent_params::flag_duplicate_is_error;
Client_Session->async_add_torrent ( p );
}
but omit the flag and it's a crash, it kind of makes seance though as what
else is going to happen but the docs say only save_path is mandatory.
toolset=msvc-14.0 boost-link=static runtime-link=static
deprecated-functions=off encryption=on link=static dht=on logging=off
i2p=on variant=release
#define TORRENT_NO_DEPRECATE
Libtorrent builds without a single warning: http://pastebin.com/fcDkS4Xc
That test is running in master, and it covers both the case where
flag_duplicate_is_error is set and cleared. It sounds like it still crashes
for you if you don't set this flag, is that right?
Can you provide any other information about your system? Which platform are
you on? compiler and other settings in the add_torrent_params.
On Sat, May 14, 2016 at 9:27 AM, Michael Mckeown <
Hi there, so this is only happening in the master, I've got it working
p.flags = add_torrent_params::flag_duplicate_is_error;
keep in mind that there are other flags set by default which you are
clearing by that assignment. It's possible clearing those flags may be
what's preventing the crash too.
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
Michael Mckeown
2016-05-18 13:05:55 UTC
Permalink
Hi, sorry for the delay, yes your test functions as expected, digging
deeper on my setup now.................
Post by Arvid Norberg
Does the test pass for you? maybe there's something the test doesn't
capture.
(i.e. test_session.cpp)
On Sat, May 14, 2016 at 11:52 AM, Michael Mckeown <
Post by Michael Mckeown
void add_magnet_to_client_session ( std::string& magnet , std::string& saveto )
{
add_torrent_params p;
p.save_path = saveto;
p.url = magnet;
p.flags = add_torrent_params::flag_duplicate_is_error;
Client_Session->async_add_torrent ( p );
}
but omit the flag and it's a crash, it kind of makes seance though as what
else is going to happen but the docs say only save_path is mandatory.
toolset=msvc-14.0 boost-link=static runtime-link=static
deprecated-functions=off encryption=on link=static dht=on logging=off
i2p=on variant=release
#define TORRENT_NO_DEPRECATE
Libtorrent builds without a single warning: http://pastebin.com/fcDkS4Xc
That test is running in master, and it covers both the case where
flag_duplicate_is_error is set and cleared. It sounds like it still crashes
for you if you don't set this flag, is that right?
Can you provide any other information about your system? Which platform are
you on? compiler and other settings in the add_torrent_params.
On Sat, May 14, 2016 at 9:27 AM, Michael Mckeown <
Hi there, so this is only happening in the master, I've got it working
p.flags = add_torrent_params::flag_duplicate_is_error;
keep in mind that there are other flags set by default which you are
clearing by that assignment. It's possible clearing those flags may be
what's preventing the crash too.
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Loading...