airsonic-advanced / airsonic-advanced/airsonic-advanced

Out of memory despite 1G heap space assigned

Đang mở
#967 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
159
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Problem description

*Describe your problem here. Describe what you want to happen, and what happens
if you try to do it. If you have a stack trace or any logs, please format them using
github's triple-backquote notation, or if they are large you may also consider
attaching them as a file or gist.*

My playlists are stored as m3u files in the Media file tree, and they contain relative paths.
I wondered why they didn't show up in Airsonic (advanced), and checked the log.

Amongst others, I discovered an out-of-memory error related to playlist scanning.
Unfortunately, the error message doesn't tell the problematic file.
And even more unfortunate, the scan seems to stop after this error!

Hence, I'd like to report 3 issues here:
1. Please enhance the error message shown below to print the file name.
2. 1G of heap space should be enough to scan a library of 62,000 music files and a handful of playlists.
3. If running out of memory when scanning a file, skip it and continue with the next on.

This is my docker-compose.yml:
```
root@server:/mnt/data/var/airsonic# cat docker-compose.yml
version: "3"

services:
airsonic-advanced:
container_name: airsonic-advanced
image: airsonicadvanced/airsonic-advanced:latest
restart: unless-stopped
ports:
- 4040:4040
- 4041:4041 # UPnP
expose:
- 4040
- 4041
user: 1002:users
environment:
TZ: ***
CONTEXT_PATH: "/airsonic/"
JAVA_OPTS: '-Xmx1024M -Dserver.forward-headers-strategy=native -Dserver.use-forward-headers=true'
volumes:
- /mnt/data/share/Multimedia:/var/playlists
- /mnt/data/var/airsonic/podcasts:/var/podcasts
- /mnt/data/var/airsonic/data:/var/airsonic
- /mnt/data/share/Multimedia:/var/music
```

And this is the error I get:
```
2023-01-20 18:12:26.987 WARN --- o.a.p.service.PlaylistService : Failed to import playlists: java.lang.OutOfMemoryError: Java heap space

java.lang.OutOfMemoryError: Java heap space
at org.apache.commons.io.IOUtils.byteArray(IOUtils.java:338) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.output.AbstractByteArrayOutputStream.needNewBuffer(AbstractByteArrayOutputStream.java:104) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.output.AbstractByteArrayOutputStream.writeImpl(AbstractByteArrayOutputStream.java:133) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.write(UnsynchronizedByteArrayOutputStream.java:62) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.output.ThresholdingOutputStream.write(ThresholdingOutputStream.java:232) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1310) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.IOUtils.copy(IOUtils.java:978) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1282) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.IOUtils.copy(IOUtils.java:953) ~[commons-io-2.10.0.jar:2.10.0]
at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:2407) ~[commons-io-2.10.0.jar:2.10.0]
at chameleon.playlist.SpecificPlaylistFactory.readFrom(SpecificPlaylistFactory.java:131) ~[core-2.0.0-RELEASE.jar:na]
at org.airsonic.player.service.PlaylistService.importPlaylist(PlaylistService.java:340) ~[classes/:na]
at org.airsonic.player.service.PlaylistService.importPlaylistIfUpdated(PlaylistService.java:385) ~[classes/:na]
at org.airsonic.player.service.PlaylistService.importPlaylist(PlaylistService.java:330) ~[classes/:na]
at org.airsonic.player.service.PlaylistService.lambda$14(PlaylistService.java:321) ~[classes/:na]
at org.airsonic.player.service.PlaylistService$$Lambda$1814/0x0000000801901c40.accept(Unknown Source) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) ~[na:na]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:na]
at java.base/java.util.Iterator.forEachRemaining(Unknown Source) ~[na:na]
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source) ~[na:na]
at org.airsonic.player.service.PlaylistService.doImportPlaylists(PlaylistService.java:321) ~[classes/:na]
at org.airsonic.player.service.PlaylistService.importPlaylists(PlaylistService.java:302) ~[classes/:na]
at org.airsonic.player.service.MediaScannerService.lambda$3(MediaScannerService.java:192) ~[classes/:na]
at org.airsonic.player.service.MediaScannerService$$Lambda$1636/0x0000000801895c40.run(Unknown Source) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(Unknown Source) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source) ~[na:na]

```

### Steps to reproduce

*Describe how somebody else could observe the same behavior you do. If possible,
include relevant configuration or files that cause the problem. If sharing media
files, ensure you are legally permitted to share copies!*

1. *Frobnicate the Quux widget*
4. *Enable the turbo encabulator*
5. *Wait between 5 and 30 minutes for it to crash*

## System information

* **Airsonic version**: *the version listed on the About page*
Version | 11.0.0-SNAPSHOT.20220625052932 – 25. Juni 2022 um 07:29:32 MESZ [Commit: 89e6fe9aec80daf8224c6696f8f86bfcf22c6e0a]
Server | Apache Tomcat/9.0.60, java 14.0.2, Linux (333,5 MB / 554,0 MB)

* **Operating system**: *the operating system you're running Airsonic on.
Linux, what distribution; Windows or Mac, what version?*
```
# uname -a
Linux *** 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
```
* **Java version**: *the Java version you are using to run Airsonic.*
Provided within Docker container....

* **Proxy server**: *if running Airsonic behind a proxy, what server and
version? Otherwise,* None
* **Client**: *what browser and version you use to access the Airsonic web
interface, or the name and version of another app you're using.*
* **Language**: *which langauge/internationalization is in use*

## Additional notes

*Include any extra notes here. Otherwise you may remove this section.*

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.