Music with invalid year field (-1) in metadata causes mediascanner to crash
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | Canonical System Image |
Undecided
|
Unassigned | ||
| | Ubuntu Music App |
Undecided
|
Unassigned | ||
| | mediascanner2 |
Fix Released
|
High
|
James Henstridge | |
| | mediascanner2 (Ubuntu) |
Undecided
|
Unassigned | ||
Bug Description
Music which has the value -1 in the year field causes mediascanner2 to crash. This then causes problems to the clients, eg Music-app, as they cannot read the tracks in the store or add tracks via a content-hub import.
-- Original bug report--
When I use the file manager application to open a mp3 file from SD card Music says "waiting for file" and then "imported file not found" even though it plays that file normally when opened directly from Music.
BQ Aquaris HD4.5 Ubuntu Edition fully updated and running on 14.10 r20.
Related branches
- Michi Henning (community): Approve on 2015-06-04
-
Diff: 189 lines (+102/-6)4 files modifiedCMakeLists.txt (+1/-1)
src/daemon/MetadataExtractor.cc (+3/-0)
test/basic.cc (+9/-3)
test/test_metadataextractor.cc (+89/-2)
| Andrew Hayzen (ahayzen) wrote : | #1 |
| Andrew Hayzen (ahayzen) wrote : | #2 |
Oh sorry I missed "even though it plays that file normally when opened directly from Music".
So this is more interesting that the file failed to import, are you able to provide a copy of the logs?
From the location /home/phablet/
| SB (emehntehtt) wrote : | #3 |
I retried the same operation and then checked the log but com.ubuntu.music is not found anywhere within the log, but numerous errors are seen:
Mediascanner service starting at 2015-03-25 2:33:09.
Volume /media/
0 files deleted from disk or in scanblocked directories.
In subdir /media/
In subdir /media/
In subdir /media/
In subdir /media/
In subdir /media/
In subdir /media/
In subdir /media/
In subdir /media/
In subdir /media/
Extracting metadata from /media/
(mediascanner-
(mediascanner-
(mediascanner-
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string:
Mediascanner service starting at 2015-03-25 2:33:12.
Volume /media/
The thing is, the track that seems to throw these errors (or so it seems) is not the track I attempted to open via File Manager. The mediascanner log is filled with this error concerning 4. In Course of Time.mp3 track, maybe its corrupted or something, but there is no mention of com.ubuntu.music, attaching the whole log if that helps.
| Andrew Hayzen (ahayzen) wrote : | #4 |
Thanks :) It would be useful if you could provide the music app log as well, usually I run this command to find the filename
$ ls -ltr /home/phablet/
Then take the bottom entry (should be along the lines of application-
| SB (emehntehtt) wrote : | #5 |
OK I attached the requested log.
| Andrew Hayzen (ahayzen) wrote : | #6 |
Thanks :)
I spot lots of "Error finalising statement: Could not finalize statement: database is locked" this is likely due to mediascanner still attempting to scan your SD while you are running the import (or mediascanner has crashed and has locked the db somehow).
Therefore could you try again importing the file via the file manager, as the import scan has likely finished.
If that fails could you try restarting the device in case mediascanner has crashed and then wait a period after rebooting to ensure the scan has finished.
If this still fails it could be possible the "what(): basic_string:
| SB (emehntehtt) wrote : | #7 |
I will try those steps but I think I tried rebooting already, will do it again and wait for a while and try again. If the case is that "what(): basic_string:
| Andrew Hayzen (ahayzen) wrote : | #8 |
Looking again at the mediascanner logs every time the following errors/warnings appear the service restarts itself directly after, this is probably what is causing the database to be left locked. Therefore I am adding mediascanner2 as also affects to this bug.
(mediascanner-
(mediascanner-
(mediascanner-
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string:
Mediascanner service starting at 2015-03-25 12:43:07.
To answer, "What can I do to prevent that?", it looks like alot of your audio files have none/invalid metadata for the year field so you could manually set these and then try importing again. However for testing purposes for this bug it would be useful to keep a copy of the original files that were causing the error (maybe you could pm one of them to me?) so we know that is the issue has been fixed.
| SB (emehntehtt) wrote : | #9 |
I emailed you the track that seems to be causing a lot of errors, hope that helps.
| James Henstridge (jamesh) wrote : | #10 |
So, the problem code in MetadataExtract
} else if (G_VALUE_HOLDS(val, GST_TYPE_
if (tagname == GST_TAG_DATE_TIME) {
}
Where we aren't checking that the value stored in the GValue is NULL. I'd be interested to know what the date is set to in the problem file's metadata (e.g. as printed by the id3v2 utility).
| Changed in mediascanner2: | |
| status: | New → Confirmed |
| Andrew Hayzen (ahayzen) wrote : | #11 |
@James I've just forwarded you a mail with a link to a file that Edward messaged me :) Please let us know if you need any further info.
| James Henstridge (jamesh) wrote : | #12 |
Looking at the file forwarded on by Andrew, the metadata is:
id3v1 tag info for 4. In Course of Time.mp3:
Title : In Course of Time Artist: Zanov
Album : In Course Of Time Year: -1 , Genre: Ambient (26)
Comment: 0 Track: 0
4. In Course of Time.mp3: No ID3v2 tag
And -1 is certainly out of the range of what GStreamer's date type is expecting. Media scanner should be fixed to treat this as a missing date.
In the short term, you can correct this by updating the tags on your music: either remove the year tag or set it to a valid year in the range 0...9999
| Changed in music-app: | |
| status: | New → Invalid |
| SB (emehntehtt) wrote : | #13 |
Yes it is -1 in ID3v2, like you said mediascanner should treat such dates as missing or ignore them as there will be more people with incorrect tags in some of their music. Still dont know why Music does not want to play files opened via File Manager, I tried again with multiple files and it is always "waiting for file" and then reports "file not found", maybe not a bug but a feature request but it should be able to play music opened via File Manager, makes no sense that it doesnt support that.
| summary: |
- Music refuses to play file opened via file manager + Music with invalid year field (-1) in metadata causes mediascanner to + crash |
| Thomas Muguet (tmuguet) wrote : | #14 |
Same problem (and same cause) happened to me when dropping a bunch of tracks on my SD Card.
To me, this is a big issue because mediascanner goes into an infinite loop, draining the battery silently, and preventing other files to be scanned. And because no errors are reported directly to the user, users can't know there is something wrong without checking the CPU usage and the mediascanner logs.
| description: | updated |
| Miguel (migueltejel-i) wrote : | #15 |
Same problem here
| Changed in mediascanner2: | |
| assignee: | nobody → James Henstridge (jamesh) |
| Changed in mediascanner2: | |
| importance: | Undecided → Medium |
| importance: | Medium → High |
| Changed in mediascanner2: | |
| status: | Confirmed → In Progress |
| Launchpad Janitor (janitor) wrote : | #16 |
This bug was fixed in the package mediascanner2 - 0.105+15.
---------------
mediascanner2 (0.105+
[ James Henstridge ]
* Treat invalid dates in MP3s as missing metadata. (LP: #1436110)
-- CI Train Bot <email address hidden> Thu, 04 Jun 2015 06:51:43 +0000
| Changed in mediascanner2 (Ubuntu): | |
| status: | New → Fix Released |
| Changed in mediascanner2: | |
| status: | In Progress → Fix Released |
| Changed in canonical-devices-system-image: | |
| status: | New → Fix Released |
This bug is still present in my newly bought Aquaris E5, though it is newly updated. The Music app doesn't play mp3 files at all.
And there is no app for playing mp4 videos.
| Pat McGowan (pat-mcgowan) wrote : | #18 |
@Torstein could you please open a new bug with the specifics of your issues.
The music-app certainly plays m3s and mp4 Videos can be played directly from the Video scope.


Thank you for taking the time to report this bug and helping to make Ubuntu better.
Personally I believe the file manager should be using url-handler instead of content-hub in this case as the music already exists in the target location (on SD card/Music or in ~/Music) and does not need to be imported.
However mediascanner should have scanned the audio files on your SD card already. So if you open the music-app by itself the tracks should be there already and you shouldn't have to use file manager to play them, can you confirm if this is true?