Daemon fails to start up when processing removable media if there are duplicate keys in media and media_attic tables

Bug #1501990 reported by James Henstridge
162
This bug affects 41 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Unassigned
mediascanner2
Fix Released
High
Unassigned
mediascanner2 (Ubuntu)
Fix Released
High
Unassigned

Bug Description

From a report from Mitchell Reese on the ubuntu-phone list, it seems we can hit terminate on startup when processing removable media.

The log extract was:

    Mediascanner service starting at 2015-10-02 6:31:12.

    terminate called after throwing an instance of 'std::runtime_error'
      what(): UNIQUE constraint failed: media_attic.id

This is almost definitely from the MediaStorePrivate::archiveItems() method, indicating that some of the items being moved to the attic were assigned the same primary key ID as other items we'd previously moved to the attic.

Ignoring the ID field when copying between the two tables would probably be the best solution.

As a work around for anyone who encounters this before we roll out a fix, deleting the media index should make the problem go away:

    stop mediascanner-2.0
    rm ~/.cache/mediascanner-2.0/mediastore.db
    start mediascanner-2.0

Related branches

Changed in mediascanner2:
status: New → In Progress
importance: Undecided → High
Changed in canonical-devices-system-image:
milestone: none → ww46-2015
status: New → In Progress
importance: Undecided → High
Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Changed in mediascanner2:
status: In Progress → Fix Released
Changed in mediascanner2 (Ubuntu):
status: New → Fix Released
importance: Undecided → High
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Revision history for this message
MankyGitt (dnadruff) wrote :

Note, the workaround does not fix the problem. Removing the .cache content (in fact I removed all of .cache also in testing, makes no difference. On user login, the same error is presented.

I will retest in due course without any peripherals attached to see if this is a factor. Currently testing with the following:
Dell XPS15 (9530) - which worked flawlessly with 14.04LTS aside from poor support for UltraHD displays.

1. HDMI external monitor
2. USB receiver for Wireless Mouse + KB
2. USB 2.0 external HDD

I have observed the same crashes without some or all of these items.
Again, not an issue with 14.04 - this seems to be a new issue.

Revision history for this message
MankyGitt (dnadruff) wrote :

Just noticed a new patch including media-scanner for 15.04. I'll test and advise.

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.