Fwd: Unusual behaviour of taglib using threads.

Yogesh M yogeshm02 at gmail.com
Tue May 1 18:21:44 CEST 2007


On 01/05/07, Michael Pyne <michael.pyne at kdemail.net> wrote:
> On Monday 30 April 2007 11:49, William Pitcock wrote:
> > This is a double free. You are probably calling delete on the same
> > resource in both threads.
> >
> > You should set the resource to NULL (if it is a pointer), and then check
> > to make sure that the resource is not NULL before calling delete on it. If
> > you do this, you shouldn't encounter this problem.
> >
> > It is possible that TagLib has a bug, but as far as I know it is
> > reentrant.
>
> reentrant does not imply thread-safe.  AFAIK TagLib is not designed for
> multithreading, but Scott would have to say for sure.
>
> Also, the delete operator in C++ checks that pointers are not 0 (the
> C++ "null") before deleting them, so don't code the check yourself.  You
> should, of course, always set pointers to 0 after deleting them so that you
> can take advantage of that fact.
>
> In other words, it may perhaps be a double-free somewhere in Taglib code,
> where if the delete and zero-assignment operations are not done atomically
> (i.e. both actions are executed by one thread before any other thread may
> execute those actions) then you can get a double-free.
>
> Regards,
>  - Michael Pyne
If TagLib is not threadsafe, then my application is going to have
*complete* design change (means hardwork of more than 1 yr becomes
zero).

I have created a small (QT4 based) programme which scans given
directories for media files and then try to read meta information from
the the list in two separate threads. And problem continues

Attached are
1) the test application (tt.tar.bz2)
2) output+backtrace of programme (output.tar.bz2)

(It seems that the error is generated when taglib has read tags from
same file in separate thread, so you may need to try several times to
get the error, along with sufficiently large set of media files)

Thanks.


-- 
Yogesh M
Chandigarh, India
http://mr-yogi.blogspot.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tt.tar.bz2
Type: application/x-bzip2
Size: 23000 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20070501/a0339250/attachment-0002.bz2 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: output.tar.bz2
Type: application/x-bzip2
Size: 3762 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20070501/a0339250/attachment-0003.bz2 


More information about the taglib-devel mailing list