Closed Bug 777259 Opened 12 years ago Closed 12 years ago

Device Storage returning null object

Categories

(Core :: DOM: Device Interfaces, defect)

x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla17
blocking-basecamp +

People

(Reporter: onecyrenus, Assigned: dhylands)

References

Details

Attachments

(1 file)

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
blocking-basecamp: --- → ?
Verified this is happening with Video App as well, and a similar error is being returned.
Blocks: 761936
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)
dclarke, does your device have a sdcard installed?  If not, then everything is working as expected.
Depends on: 751951
Yes it does.  I can adb shell cd /sdcard/Music 
ls -al shows many files
Doug are you running the latest otoro build from releases.mozilla ? 


Taht would be a good place to start.
Doug are you running the latest otoro build from releases.mozilla ? 


that would be a good place to start.
blocking-basecamp: ? → +
Assignee: nobody → doug.turner
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
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.
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+
Let us know when this makes it into the tree
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
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: