Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | Subsonic: Now runs as own user "subsonic" + failsafe FFmpeg transcoder creation #2705

Merged
merged 6 commits into from
Apr 16, 2019

Conversation

MichaIng
Copy link
Owner

@MichaIng MichaIng commented Apr 9, 2019

Status: Ready

  • Patch
  • DietPi-Software list in Wiki
  • Changelog

Reference: #2697

Commit list/description:

  • DietPi-Software | Subsonic: Failsafe FFmpeg transcoder symlink creation, similar how we did on Airsonic
  • DietPi-Software | Subsonic: Now runs as it's own user
  • DietPi-Patch | Prevent initial service stops and final service starts during DietPi-Software reinstalls. This new variable needs to implemented into DietPi-Software and in case other scripts, where applicable
  • DietPi-Software | Skip initial stop and final start of services, if $G_SERVICE_CONTROL == 0 was exported. Currently this is done by patch_file (DietPi-Update) which already has services stopped and starts or reboots after finished. As DietPi-Update as well sends survey, skip this too.
  • DietPi-Software | Visual-only syntax fix
  • DietPi-Software | Minor coding and wording

+ DietPi-Software | Subsonic: Failsafe FFmpeg transcoder symlink creation, similar how we did on Airsonic
+ DietPi-Software | Subsonic: Now runs as it's own user
@MichaIng MichaIng added this to the v6.23 milestone Apr 9, 2019
@MichaIng MichaIng self-assigned this Apr 9, 2019
Dev > "subsonic"
+ DietPi-Patch | Reinstall Subsonic to apply "subsonic" run user and transcoder fix
+ CHANGELOG | Subsonic run user and transcoder fix
@MichaIng
Copy link
Owner Author

🈴 Web UI does not open after reinstall during patch:

HTTP ERROR: 503
SERVICE_UNAVAILABLE
RequestURI=/index.view

Powered by jetty://

Stack trace from subsonic_sh.log:

2312 [main] ERROR org.mortbay.log - Failed startup of context org.mortbay.jetty.webapp.WebAppContext@ec756bd{/,jar:file:/usr/share/subsonic/subsonic.war!/}
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext-service.xml]; nested exception is java.io.FileNotFoundException: Could not open...
  • /var/subsonic/jetty/759abe/webapp/WEB-INF/applicationContext-service.xml indeed does not exist.
  • Strange is that fresh install within this branch (subsonic user etc) works fine.
  • dev branch already installs v6.1.5 as well, so this is not the issue. Also reinstall there works fine.
  • Switching back to root user does not resolve the issue.

Similar issue: http://forum.subsonic.org/forum/viewtopic.php?p=76065

@MichaIng
Copy link
Owner Author

MichaIng commented Apr 14, 2019

Retest:
🈯️ Fresh install on current dev branch
🈯️ Reinstall on current dev branch
🈯️ Switch to subsonic user on current dev branch
🈴 After testing G_CONFIG_INJECT commands we switched to with this branch, web UI broke again, even after reverting with previous cat and switching --max-memory.

  • Error log is now different:
164 [main] INFO org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7cc355be: display name [org.springframework.context.support.ClassPathXmlA$
376 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [applicationContext-deployer.xml]
[GC (Allocation Failure)  4416K->1316K(15872K), 0.0100309 secs]
[GC (Allocation Failure)  5732K->2319K(15872K), 0.0121217 secs]
[GC (Allocation Failure)  6735K->3287K(15872K), 0.0154995 secs]
1481 [main] INFO org.springframework.context.support.ClassPathXmlApplicationContext - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@7cc355be]: org.springframework.beans.factory.$
1513 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3224f60b: defining beans [service,org.springfra$
1590 [main] INFO org.mortbay.log - Logging to org.slf4j.impl.SimpleLogger(org.mortbay.log) via org.mortbay.log.Slf4jLog
Using WAR file: /usr/share/subsonic/subsonic.war
Extracting webapp to /var/subsonic/jetty/759abe
Using WAR file: /usr/share/subsonic/subsonic.war
1698 [main] INFO org.mortbay.log - jetty-6.1.x
[GC (Allocation Failure)  7697K->4288K(15872K), 0.0200232 secs]
[GC (Allocation Failure)  8704K->4849K(15872K), 0.0135590 secs]
[GC (Allocation Failure)  9244K->4761K(15872K), 0.0061298 secs]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/subsonic/subsonic-booter-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/subsonic/jetty/759abe/webapp/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[GC (Allocation Failure)  9177K->5106K(15872K), 0.0060997 secs]
[GC (Allocation Failure)  9522K->5115K(15872K), 0.0063227 secs]
[GC (Allocation Failure)  9531K->5049K(15872K), 0.0039788 secs]
[GC (Allocation Failure)  9465K->5053K(15872K), 0.0080593 secs]
[GC (Allocation Failure)  9469K->5043K(15872K), 0.0041400 secs]
  • Obviously database error. Perhaps stopping the service too quickly, since it takes some seconds before Java loaded everything.

🈴 Full uninstall and reinstall does not even solve it 🤔.
🈯️ Purging Subsonic + Java + reboot + fresh install

  • My goodness... That is really not anything we can do to end users... Did I mention that I don't like Java? 😒...

DLNA: This feature is available until May 15, 2019. After that you must get Subsonic Premium.

  • Why would anyone not switch to Airsonic or another player that offers the same and better features without the overhead and failure affinity (as above) of Java?... However let's get this fixed or simply leave existing installs untouched.

🈺 Verified: systemctl restart subsonic && systemctl restart subsonic and web UI is broken. The init.d service does not give Java enough time to gracefully stop, or Java does not give Subsonic enough time to do so. However this is a bug, the stop/kill request MUST be handled gracefully by Subsonic. We cannot add some random sleep or restart time to the service that might or might be not enough for slow SBCs...

  • Not sure what cache or something is done by Java, but since only purge/reinstall Subsonic does not resolve the issue, this is highly annoying.
  • Hmm strange in this one case now it worked with only Subsonic un+install.

Issue appears a bid randomly. At least 1 second sleep after stopping service was not enough in one case. Also waiting until CPU usage goes back to 0 and then doing restart didn't work in one case...
🈴 Simple fresh install, even waiting 10 seconds longer results in a database corruption.
🈴 Trying with v6.1.4 + v6.1.3: Same issue, seems to be a general one...


🈴 Most clean install:

G_AGI openjdk-8-jre-headless
cd /tmp
wget https://sourceforge.net/projects/subsonic/files/subsonic/6.1.5/subsonic-6.1.5.deb/download -O subsonic-6.1.5.deb
dpkg -i subsonic-6.1.5.deb
sleep 100
systemctl restart subsonic
  • Service broken.... Okay now I am out of ideas. How long should one wait...

Can't get it to work currently. Perhaps just an issue with VM + CPU overload due to Folding@Home on host... Will retry tomorrow...

@MichaIng
Copy link
Owner Author

New day new test:

[  OK  ] DietPi-Survey | Connection test: ssh.dietpi.com
[  OK  ] DietPi-Survey | Successfully sent survey data
[ SUB2 ] DietPi-Software > Installation completed
[ SUB3 ] DietPi-Services > restart
[  OK  ] DietPi-Services | restart : subsonic
[  OK  ] DietPi-Services | restart : cron
[ SUB4 ] DietPi-Process_tool > Apply
[  OK  ] DietPi-Process_tool | Completed
[  OK  ] DietPi-Update | Patching to v6.23.0 completed

[  OK  ] DietPi-Survey | Connection test: ssh.dietpi.com
[  OK  ] DietPi-Survey | Successfully sent survey data

 DietPi-Update
─────────────────────────────────────────────────────
 Mode: Completed

[ INFO ] DietPi-Update | Current version : v6.23.0
[ INFO ] DietPi-Update | Latest version  : v6.23.0
[  OK  ] DietPi-Update | Syncing new DietPi scripts to disk
[ SUB1 ] DietPi-Services > restart
[  OK  ] DietPi-Services | restart : subsonic
[  OK  ] DietPi-Services | restart : cron
[ SUB2 ] DietPi-Process_tool > Apply
[  OK  ] DietPi-Process_tool | Completed
  • 🈴 And broken
  • Hmm when running from patch_file, dietpi-survey and dietpi-services should be skipped. The doubled restart might be the issue here.

+ DietPi-Patch | Prevent initial service stops and final service starts during DietPi-Software reinstalls. This new variable needs to implemented into DietPi-Software and in case other scripts, where applicable
+ DietPi-Software | Skip initial stop and final start of services, if $G_SERVICE_CONTROL == 0 was exported. Currently this is done by patch_file (DietPi-Update) which already has services stopped and starts or reboots after finished. As DietPi-Update as well sends survey, skip this too.
+ DietPi-Software | Visual-only syntax fix
+ DietPi-Software | Minor coding and wording
@MichaIng
Copy link
Owner Author

🈯️ After last commits (preventing doubled service restarts at end of update, when reinstalls are done), it works. Good to remember this failure affinity of Subsonic. Will check Airsonic as well.

@MichaIng MichaIng merged commit f139ad1 into dev Apr 16, 2019
@MichaIng MichaIng deleted the subsonic branch April 16, 2019 02:57
@MichaIng MichaIng mentioned this pull request Apr 29, 2019
@MichaIng MichaIng mentioned this pull request May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant