plietar / librespot

Open Source Spotify client library
MIT License
1.14k stars 185 forks source link

Panic with message "No space left on device" #166

Closed joerg-krause closed 6 years ago

joerg-krause commented 7 years ago

When playling long tracks on my embedded device with about 36MB of free RAM, librespot panics with: thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: Error { repr: Os { code: 28, message: "No space left on device" } }'.

For example using this track (45:31). Is there a way not to load the whole song into RAM?

plietar commented 7 years ago

Interesting, I never really considered very large tracks. librespot doesn't load the whole song into RAM, but it downloads it into /tmp, which may be the same thing if that is mounted as a tmpfs.

As a temporary workaround, you can change this line from NamedTempFile::new() to NamedTempFile::new_in("/somewhere/not/in/ram").

Ideally, if a cache directory is specified we can just use $CACHE/temp automatically for that.

joerg-krause commented 7 years ago

Thanks, I will try this. In fact, this track is an extreme. It my also happen for tracks having a length of six or seven minutes, depending on the free RAM left.

joerg-krause commented 7 years ago

On second thought, my system is NAND flash based. So, using anything else than the RAM for caching is not a good idea. So, I need a bigger RAM?

plietar commented 7 years ago

Pretty much. A solution would be to change librespot to break up the files in blocks of say 500KB, and delete them automatically (if cache is disabled) once it has moved on to the next one. This is a large-ish change, so it's unlikely I'll be able to implement it anytime soon unfortunately.

michaelherger commented 7 years ago

I've modified librespot to disable the audio file-cache. See pull request #181.

joerg-krause commented 6 years ago

Closed due to lack of maintenance of the project.