kagemomiji / airsonic-advanced

airsonic-advanced
GNU General Public License v3.0
157 stars 14 forks source link

[Bug]: When a transcode is empty, Airsonic loops indefinitely. #220

Open DutchComputerKid opened 1 year ago

DutchComputerKid commented 1 year ago

What happened?

So I have been trying to program some transcoders for use in Airsonic, but found that there's a funky bug.

Whenever a transcoding tool does not output Airsonic seems to retry accessing the file indefinitely, resulting in: (900+ plays within seconds) image image

'Too long didnt read': A failing transcode catched Airsonic in an infinite loop, accessing the file forever.

The software in question is dsf2flac, I have also tried implementing MIDI but that didnt work for another transcoder input problem. Compared to ffmpeg this would result in a much more efficient and clearer transcode but no luck:

When dsf2flac seems to get a DSD128 file as input or any other transcoder does 'something' wrong resulting in an empty file, Airsonic keeps trying until stopped manually by playing something else. Maybe this bug could be catched with some kind of popup for the user, or something similar. "This file could not be transcoded", something like that. Instead of endlessly trying to play, messing up the play counter and possibly other aspects.

I have also tried doing this in a script with a conditional statement, but that made me think there is something deeper inside Airsonic that makes it mess up when there is no file to play.

with 'bash /var/airsonic/transcode/dsf.sh' in the transcoder text box:

#!/bin/bash
[[ $(mediainfo %s) =~ "DSD64" ]] && dsf2flac -i %s -o -

This only executes if a DSD64 file is found, since Airsonic's transcoder window does not accept ] or ' in its transcoder text box. Anyway, I thought having this would prevent it from playing DSD128 files, but alas.

Now this is quite complicated but if any corrupt file appears or inplayable the same result would/could appear.

Steps to reproduce

  1. Install dsf2flac into /var/airsonic/transcoders or other accessible place.
  2. Add a DSD128 and DSD64 file to your library. (You can get demo files, also you might need to add dsf to scannable files in General > Music Files)
  3. Add a transcoder rule: dsf2flac -i %s -o -
  4. See if DSD64 does play just fine (Output should be a 88.2Khz FLAC), and the DSD128 file should fail completely, engaging the loop.

There are probably easier ways to trigger this but still.

Version

11.1.x (Edge)

Version Detail

11.1.3-SNAPSHOT.20230503053148

Operating System

Debian 11

Java Version

openjdk 17.0.6 2023-01-17 (build 17.0.6+10-Debian-1deb11u1)

Database

Other

DB Detail

Built-In

Configuration paramter

Default, other than the aforementioned addition of dsf to Airsonic's scanning list.

Proxy Server

NGiNX

client detail

Web players, external as well, probably.

language

English

Relevant log output

Nothing