mediascanner-service-2.0 using large amounts of CPU

Bug #1398614 reported by Nizar Kerkeni
36
This bug affects 8 people
Affects Status Importance Assigned to Milestone
mediascanner2 (Ubuntu)
Confirmed
High
Unassigned

Bug Description

Each time I plug my external USB hard disk the mediascanner-service process is activ and is using large amount of CPU for long minutes without interruption.
I have the same problem in utopic and vivid

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: mediascanner2.0 0.105+15.04.20141030.1-0ubuntu1
ProcVersionSignature: Ubuntu 3.16.0-25.33-generic 3.16.7
Uname: Linux 3.16.0-25-generic x86_64
ApportVersion: 2.14.7-0ubuntu10
Architecture: amd64
CurrentDesktop: Unity
Date: Wed Dec 3 00:29:43 2014
InstallationDate: Installed on 2011-05-26 (1286 days ago)
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
SourcePackage: mediascanner2
UpgradeStatus: Upgraded to vivid on 2013-11-26 (371 days ago)

Revision history for this message
Nizar Kerkeni (nizarus) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mediascanner2 (Ubuntu):
status: New → Confirmed
Changed in mediascanner2 (Ubuntu):
importance: Undecided → High
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

This should only happen once: the first time you insert the drive. It might happen again if you unplug the disk before scanning is finished. After the first scan the results are cached and further connections should be fast again.

If you wish to prevent Mediascanner from scanning your external drive, place a file called .nomedia in the root dir of your drive and it won't be scanned.

Revision history for this message
Nizar Kerkeni (nizarus) wrote :

Thanks Jussi for the tip, I confirm that adding .nomedia file prevent the scanning of my external drive.

Revision history for this message
Jussi Lind (jussi-lind) wrote :

Jussi, on my Bq Aquarius the scanning never stops (without .nomedia). I have about 10 GB of music on the SD card and mediascanner-service still takes up to 100% CPU after several hours. At least the scanning shouldn't take that long. It stops if I remove the SD card.

Revision history for this message
Jussi Lind (jussi-lind) wrote :

I think that in my case mediascanner-service is constantly crashing and that's why it seem to never stop.

Revision history for this message
Jussi Lind (jussi-lind) wrote :

Attached .crash file.

Revision history for this message
Anton Yakutovich (dr-akulavich) wrote :

The same bug for me.
Ubuntu 15.04, amd64.
I've installed unity8-desktop-session-mir for testing. I'm using Unity 7 environment, but forget to remove unity8 packages with dependencies.
When I plug-in my 500GB usb harddrive, mediascanner-service eats all resources and I can't use my computer.

Revision history for this message
Vincent Legoll (vincent-legoll) wrote :

Is there a global way to disable that thing other than "apt-get purge" ?

I don't want my CPU to be hogged every time I plug a removable drive.
Please stop blindly abusing our resources without giving us a way to escape from it, pretty please.

What would be acceptable is a (***not hidden away***) config option where one can choose to "always scan", "always ask" or "never scan"...

The same we we can choose to auto-run, auto-launch, auto-open, etc...

Revision history for this message
Cédric Bellegarde (gnumdk) wrote :

Same here on Meizu MX4, crash loop and so
- apport run every seconds...
- CPU/Battery killer

Revision history for this message
Cédric Bellegarde (gnumdk) wrote :
Revision history for this message
Cédric Bellegarde (gnumdk) wrote :

Extracting metadata from /home/phablet/Music/6-Let's go (feat. Takana Zion).mp3.

(mediascanner-service-2.0:3806): GStreamer-CRITICAL **: gst_date_time_new: assertion 'year > 0 && year <= 9999' failed

(mediascanner-service-2.0:3806): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed

(mediascanner-service-2.0:3806): GStreamer-CRITICAL **: gst_date_time_to_iso8601_string: assertion 'datetime != NULL' failed
terminate called after throwing an instance of 'std::logic_error'
  what(): basic_string::_S_construct null not valid
Aborted (core dumped)

Revision history for this message
Cédric Bellegarde (gnumdk) wrote :

On Ubuntu 15.04 for pc i do not get:
terminate called after throwing an instance of 'std::logic_error'

Revision history for this message
Cédric Bellegarde (gnumdk) wrote :

Seems because year is -1 in tags

Revision history for this message
Cédric Bellegarde (gnumdk) wrote :

Fixing tags fix issue

But should be fixed in code

tags: added: rls-w-incoming
Revision history for this message
Neil McPhail (njmcphail) wrote :

Since pulling in mediascanner2.0 on wily with the ubuntu-sdk package, I have mediascanner-service consuming a minimum of 10% of CPU at all times, with frequent spikes to nearly 200%. My CPU is cooking nicely.

To put things in perspective, firefox with 15 open tabs is currently consuming 3.3% of CPU.

Something is badly broken here.

Revision history for this message
Martyn Lloyd-Kelly (martynlloydkelly) wrote :

Every time I plug in my external 1TB HDD this process consumes up to 101.8%(!) of my CPU and prevents me from doing anything on the computer unless I physically turn off the HDD. I thought that after its first scan data is cached? Instead, the issue appears to be ongoing for me. I'm currently using Ubuntu 14.10 LTS and I haven't purged the package since I use the Ubuntu SDK and apparently the "mediascanner-service" package is a dependency? Absolutely abominable programming, whoever released this into the wild needs to be spoken to, urgently.

tags: added: rls-x-incoming
removed: rls-w-incoming
Revision history for this message
James Henstridge (jamesh) wrote :

The recent 0.111 release in xenial and the Ubuntu Phone vivid overlay should improve things somewhat:

1. we are using taglib directly for scanning of music files (videos still go through GStreamer).

2. batch index updates during the "initial scan" phase when the daemon starts up or removable media is mounted, resulting in fewer flushes.

While this might not reduce CPU usage much (although it probably will while scanning music), it reduced flushes should make it play better with other IO on the system. It seems a lot less intrusive when I let it rescan my music collection from scratch.

Revision history for this message
Vincent Legoll (vincent-legoll) wrote :

I was searching for a way to disable this, I hope I have found the right place in configuration settings...

I opened in menus :

Applications
System tools
Preferences
Searching & indexing

I unchecked everything in "semantics"

It looks like there's an option missing in "limits", I would like to choose "never" for "background content indexing", but this option is not provided here...

This is manual translation from my installed lang to english so may not be 100% accurate

tags: added: xenial
Revision history for this message
themusicgod1 (themusicgod1) wrote :

Upgrading to 16.10 (yakkety) seems to have resolved this(?).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.