BUG: MTP connection hangs in a corner case with many files

asked 2014-01-02 15:00:10 +0300

vvvv gravatar image

updated 2014-01-02 15:16:21 +0300

veskuh gravatar image

When the Jolla device contains >5000 files that have been created "behind the back" of Tracker, MTP connections via USB stop working.

How to reproduce:

  1. cd /home/nemo/Documents && for f in `seq 1 5000`; do touch "$f".dummy; done
  2. Plug in usb cable and try to create MTP connection (e.g. run mtp-detect on the PC). On the device, tracker-store starts hogging 100% of CPU, and mtp-detect reports a failure after a couple of minutes.
  3. Connection starts working again once the files have been removed.

Another way to arrive at this situation is to have many files on the SD card and create a symlink to the directory containing them under /home/nemo (e.g., to enable Android music player apps to see the SD card files).

I'm not sure if it's possible to end up with this without using the developer mode. If the >5000 files are transferred via MTP to the device rather than just created suddenly or symlinked from SD card, this behavior does not appear to occur, maybe there's caching somewhere.

This is not a question, I can just use SSH for file transfers, but a FYI that there is undesirable behavior in a corner case.

edit retag flag offensive close delete


Yeah, when the host queries the MTP storage, MTP will scan the filesystem and ask tracker for metadata about each file. This takes so long that MTP misses a protocol timeout. There are probably tricks to speed that up, but I think there will always be a limit on how many files it can scan in time.

rbraakman ( 2014-01-29 17:41:25 +0300 )edit