Device Storage returning null object

VERIFIED FIXED in mozilla17

Status

()

Core
DOM: Device Interfaces
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: onecyrenus, Assigned: dhylands)

Tracking

unspecified
mozilla17
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(blocking-basecamp:+)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Environment: 

otoro- 7/24/2012 build 
gaia app - Music

Device Storage is returning null.  

The repro case is to load audio in /sdcard/Music, and then start the Music app


E/GeckoConsole(  106): Content JS ERROR at app://music.thisdomaindoesnotexist.org/js/MediaDB.js:197 in MediaDB: MediaDB(): can't get DeviceStorage object TypeError: navigator.getDeviceStorage(mediaType) is null

This might also not be a device storage error as much as a permsissions error, unsure, but i verified the permissions to device storage are correct in permissions.sqlite


173|music.thisdomaindoesnotexist.org|indexedDB-unlimited|1|0|0
174|music.thisdomaindoesnotexist.org|webapps-manage|1|0|0
175|music.thisdomaindoesnotexist.org|offline-app|1|0|0
176|music.thisdomaindoesnotexist.org|pin-app|1|0|0
177|music.thisdomaindoesnotexist.org|websettings-read|1|0|0
178|music.thisdomaindoesnotexist.org|websettings-readwrite|1|0|0
179|music.thisdomaindoesnotexist.org|content-camera|1|0|0
180|music.thisdomaindoesnotexist.org|webcontacts-manage|1|0|0
181|music.thisdomaindoesnotexist.org|wifi-manage|1|0|0
182|music.thisdomaindoesnotexist.org|desktop-notification|1|0|0
183|music.thisdomaindoesnotexist.org|geolocation|1|0|0
184|music.thisdomaindoesnotexist.org|device-storage|1|0|0
185|music.thisdomaindoesnotexist.org|alarms|1|0|0
(Reporter)

Updated

5 years ago
blocking-basecamp: --- → ?
(Reporter)

Comment 1

5 years ago
Verified this is happening with Video App as well, and a similar error is being returned.
(Reporter)

Updated

5 years ago
Blocks: 761936
(Reporter)

Comment 2

5 years ago
logcat output: 

I/Vold    (  100): /dev/block/vold/179:1 being considered for volume sdcard
D/Vold    (  100): Volume sdcard state changing 1 (Idle-Unmounted) -> 3 (Checking)
W/SocketClient(  100): write error (Broken pipe)
W/SocketClient(  100): Unable to send msg '605 Volume sdcard /mnt/sdcard state changed from 1 (Idle-Unmounted) to 3 (Checking)'
W/SocketListener(  100): Error sending broadcast (Broken pipe)

Comment 3

5 years ago
dclarke, does your device have a sdcard installed?  If not, then everything is working as expected.

Updated

5 years ago
Depends on: 751951
(Reporter)

Comment 4

5 years ago
Yes it does.  I can adb shell cd /sdcard/Music 
ls -al shows many files
(Reporter)

Comment 5

5 years ago
Doug are you running the latest otoro build from releases.mozilla ? 


Taht would be a good place to start.
(Reporter)

Comment 6

5 years ago
Doug are you running the latest otoro build from releases.mozilla ? 


that would be a good place to start.
(Reporter)

Updated

5 years ago
Duplicate of this bug: 777921
blocking-basecamp: ? → +

Updated

5 years ago
Assignee: nobody → doug.turner

Comment 8

5 years ago
if the volume manager says that the sdcard isn't present, we return a null storage object for all types (video, pictures, music)
Assignee: doug.turner → dhylands
(Assignee)

Comment 9

5 years ago
I figured out the problem.

The nsVolumeService class doesn't get instantiated until the very first time that:

do_GetService(NS_VOLUMESERVICE_CONTRACTID)

is called. The nsVolumeService constructor then fires off some IOTHread initialization. If the call to GetVolumeByPath comes in before the iothread has had a chance to finish, then it see no volume.

So I see a few potential solutions:

1 - Have the VolumeManager do a call to do_GetService to have the nsVolumeService instantiated earlier.
2 - Have the nsVolumeService do some type of synchronization so that GetVolumeByPath blocks until the iothread is finished
3 - Move the main thread data out of nsVolumeService and have the main thread data initialized earlier, so that nsVolumeService can access it immediately.

I'm inclined to do #3. Comments?
4 - You could just add the volume service to app-startup.  This would create your service on startup and you don't have to do anything else.

Not sure about the impact on startup perf though.
(Assignee)

Comment 11

5 years ago
Created attachment 650347 [details] [diff] [review]
Bug 777259 - Launch VolumeService earlier to prevent races on retrieving Volume information
Attachment #650347 - Flags: review?(doug.turner)
Comment on attachment 650347 [details] [diff] [review]
Bug 777259 - Launch VolumeService earlier to prevent races on retrieving Volume information

works great.
Attachment #650347 - Flags: review?(doug.turner) → review+
(Reporter)

Comment 13

5 years ago
Let us know when this makes it into the tree
(Assignee)

Comment 14

5 years ago
I pushed it to mozilla-inbound: 
https://hg.mozilla.org/integration/mozilla-inbound/rev/4a08177931d2

As long as no build failures occur, it should be on mozilla-central tomorrow morning.
https://hg.mozilla.org/mozilla-central/rev/4a08177931d2
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
(Reporter)

Updated

5 years ago
Duplicate of this bug: 781004
(Reporter)

Updated

5 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.