BUG: MTP connection hangs in a corner case with many files
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:
- cd /home/nemo/Documents && for f in `seq 1 5000`; do touch "$f".dummy; done
- 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, andmtp-detect
reports a failure after a couple of minutes. - 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.
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 +0200 )edit