stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
9.17k stars 790 forks source link

[Bug Report] DLNA is broken for the dev version (file-refactor) #2911

Closed PsychoSid closed 2 years ago

PsychoSid commented 2 years ago

Describe the bug Panics with latest develop release (so expected !) when trying to access via DNLA

To Reproduce Steps to reproduce the behavior:

  1. Enable DLNA
  2. Try to access

Expected behavior Videos play

Error

2022/09/15 07:06:45 http: panic serving 192.168.68.122:61281: relationship has not been loaded
goroutine 6953 [running]:
net/http.(*conn).serve.func1()
    net/http/server.go:1801 +0xb9
panic({0x4fef8c0, 0x5703750})
    runtime/panic.go:1047 +0x266
github.com/stashapp/stash/pkg/txn.WithTxn.func1()
    github.com/stashapp/stash/pkg/txn/transaction.go:38 +0xf2
panic({0x4fef8c0, 0x5703750})
    runtime/panic.go:1038 +0x215
github.com/stashapp/stash/pkg/models.RelatedVideoFiles.Primary(...)
    github.com/stashapp/stash/pkg/models/relationships.go:264
github.com/stashapp/stash/internal/dlna.sceneToContainer(0xc0000e2780, {0xc000b66270, 0xd}, {0xc000f362d0, 0x13})
    github.com/stashapp/stash/internal/dlna/cds.go:117 +0xa36
github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getVideos.func1({0x57563c0, 0xc001022540})
    github.com/stashapp/stash/internal/dlna/cds.go:470 +0x2a5
github.com/stashapp/stash/pkg/txn.WithTxn({0x5756350, 0xc0001aa010}, {0x575c3d8, 0xc0004fe000}, 0xc001781428)
    github.com/stashapp/stash/pkg/txn/transaction.go:50 +0x10f
github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getVideos(0xc000f2b0f0, 0x51f4549, {0xc000b66270, 0xc000b661bb}, {0xc000f362d0, 0x67393c8})
    github.com/stashapp/stash/internal/dlna/cds.go:446 +0xca
github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getPerformerScenes(0xc000b661b0, {0xc000f2b0f0, 0x1, 0x1}, {0xc000f362d0, 0x13})
    github.com/stashapp/stash/internal/dlna/cds.go:637 +0x1ca
github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).handleBrowseDirectChildren(0xc00140a570, {{0xc000b661b0, 0xd}, {0x57010d8, 0x1}}, {0xc000f362d0, 0x13})
    github.com/stashapp/stash/internal/dlna/cds.go:318 +0x5f0
github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).Handle(0xc000405c80, {0xc0000406f1, 0x12}, {0xc000362240, 0x122, 0x207}, 0x29)
    github.com/stashapp/stash/internal/dlna/cds.go:202 +0x36f
github.com/stashapp/stash/internal/dlna.(*Server).soapActionResponse(0x10, {{{0xc0000406de, 0x10}, 0x1}, {0xc0000406f1, 0x6}}, {0xc000362240, 0x122, 0x207}, 0xc000e3a000)
    github.com/stashapp/stash/internal/dlna/dms.go:382 +0x205
github.com/stashapp/stash/internal/dlna.(*Server).serviceControlHandler.func1(0x512baa0, {{{0xc0000406de, 0x10}, 0x1}, {0xc0000406f1, 0x6}}, 0xc00139e7e0, 0xc00139e940)
    github.com/stashapp/stash/internal/dlna/dms.go:421 +0x67
github.com/stashapp/stash/internal/dlna.(*Server).serviceControlHandler(0xc00076af20, {0x5739458, 0xc000d8e018}, 0xc000e3a000)
    github.com/stashapp/stash/internal/dlna/dms.go:427 +0x3f1
net/http.HandlerFunc.ServeHTTP(0xc000d8e018, {0x5739458, 0xc000d8e018}, 0xc00139e990)
    net/http/server.go:2046 +0x2f
net/http.(*ServeMux).ServeHTTP(0x512baa0, {0x5739458, 0xc000d8e018}, 0xc000e3a000)
    net/http/server.go:2424 +0x149
github.com/stashapp/stash/internal/dlna.(*Server).serveHTTP.func1({0x5739d28, 0xc0000e61c0}, 0xc000e3a000)
    github.com/stashapp/stash/internal/dlna/dms.go:166 +0x318
net/http.HandlerFunc.ServeHTTP(0x0, {0x5739d28, 0xc0000e61c0}, 0x1addfe4c1f362)
    net/http/server.go:2046 +0x2f
net/http.serverHandler.ServeHTTP({0x57362e0}, {0x5739d28, 0xc0000e61c0}, 0xc000e3a000)
    net/http/server.go:2878 +0x43b
net/http.(*conn).serve(0xc000b02280, {0x57563c0, 0xc0015a7e00})
    net/http/server.go:1929 +0xb08
created by net/http.(*Server).Serve
    net/http/server.go:3033 +0x4e8

Stash Version: (from Settings -> About): v0.16.1-47-g781a767f

JanJastrow commented 2 years ago

Same issue for me. But I only have the following errors in the stash logs:

2022-09-15 20:06:23Error   Could not notify http://192.168.142.142:1109/5bb2990f-c95a-da8c-7bbb-0e6f3036e6b3/urn:upnp-org:serviceId:ContentDirectory: Notify "http://192.168.142.142:1109/5bb2990f-c95a-da8c-7bbb-0e6f3036e6b3/urn:upnp-org:serviceId:ContentDirectory": context canceled
2022-09-15 20:06:22Error   Could not notify http://192.168.142.57:1319/5bb2990f-c95a-da8c-7bbb-0e6f3036e6b3/urn:upnp-org:serviceId:ContentDirectory: Notify "http://192.168.142.57:1319/5bb2990f-c95a-da8c-7bbb-0e6f3036e6b3/urn:upnp-org:serviceId:ContentDirectory": context canceled

(the IPs are from Kodi Clients)

Edit: the error in the docker logs

2022/09/15 20:12:36 http: panic serving 192.168.142.57:38460: relationship has not been loaded

goroutine 9940009 [running]:

net/http.(*conn).serve.func1()

    net/http/server.go:1801 +0xb9

panic({0x1442d40, 0x1b54380})

    runtime/panic.go:1047 +0x266

github.com/stashapp/stash/pkg/txn.WithTxn.func1()

    github.com/stashapp/stash/pkg/txn/transaction.go:38 +0xf2

panic({0x1442d40, 0x1b54380})

    runtime/panic.go:1038 +0x215

github.com/stashapp/stash/pkg/models.RelatedVideoFiles.Primary(...)

    github.com/stashapp/stash/pkg/models/relationships.go:264

github.com/stashapp/stash/internal/dlna.sceneToContainer(0xc00080c180, {0xc001467da0, 0xb}, {0xc000e63fc8, 0x14})

    github.com/stashapp/stash/internal/dlna/cds.go:117 +0xa36

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getVideos.func1({0x1ba6ce0, 0xc0010802a0})

    github.com/stashapp/stash/internal/dlna/cds.go:470 +0x2a5

github.com/stashapp/stash/pkg/txn.WithTxn({0x1ba6c70, 0xc00012a008}, {0x1bacd38, 0xc000299110}, 0xc001443428)

    github.com/stashapp/stash/pkg/txn/transaction.go:50 +0x10f

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getVideos(0xc002830710, 0x16417a3, {0xc001467da0, 0xc001467ce8}, {0xc000e63fc8, 0x7f69fae3a5b8})

    github.com/stashapp/stash/internal/dlna/cds.go:446 +0xca

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getStudioScenes(0xc001467ce0, {0xc002830710, 0x1, 0x1}, {0xc000e63fc8, 0x14})

    github.com/stashapp/stash/internal/dlna/cds.go:559 +0x1ca

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).handleBrowseDirectChildren(0xc0025f4b60, {{0xc001467ce0, 0xb}, {0x1b51ee8, 0x1}}, {0xc000e63fc8, 0x14})

    github.com/stashapp/stash/internal/dlna/cds.go:300 +0x39b

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).Handle(0xc0003bfc00, {0xc001cd6331, 0x12}, {0xc001034d80, 0x32f, 0x40f}, 0x29)

    github.com/stashapp/stash/internal/dlna/cds.go:202 +0x36f

github.com/stashapp/stash/internal/dlna.(*Server).soapActionResponse(0x10, {{{0xc001cd631e, 0x10}, 0x1}, {0xc001cd6331, 0x6}}, {0xc001034d80, 0x32f, 0x40f}, 0xc000c33100)

    github.com/stashapp/stash/internal/dlna/dms.go:382 +0x205

github.com/stashapp/stash/internal/dlna.(*Server).serviceControlHandler.func1(0x157d5e0, {{{0xc001cd631e, 0x10}, 0x1}, {0xc001cd6331, 0x6}}, 0xc0014437e0, 0xc001443940)

    github.com/stashapp/stash/internal/dlna/dms.go:421 +0x67

github.com/stashapp/stash/internal/dlna.(*Server).serviceControlHandler(0xc000ee6580, {0x1b89f38, 0xc0012c2660}, 0xc000c33100)

    github.com/stashapp/stash/internal/dlna/dms.go:427 +0x3f1

net/http.HandlerFunc.ServeHTTP(0xc0012c2660, {0x1b89f38, 0xc0012c2660}, 0xc001443990)

    net/http/server.go:2046 +0x2f

net/http.(*ServeMux).ServeHTTP(0x157d5e0, {0x1b89f38, 0xc0012c2660}, 0xc000c33100)

    net/http/server.go:2424 +0x149
AdultSun commented 2 years ago

DLNA isn't working for me anymore either. It was working just fine using the build immediately before the files refactor merged into the develop branch, so the bug is likely related to that. I don't have any logging to add though, Stash doesn't show any errors and I don't know how to pull logs out of the Roku TV I'm using. I'm just using the built-in media player app for Roku.

DLNA starts up fine in Stash, the server is visible on the TV, I can connect and navigate the folder structure, but the app hangs when I try to enter a folder with videos in it. Meaning, the video list won't load.

Same Stash build as OP: v0.16.1-47-g781a767f

JanJastrow commented 2 years ago

Hi, this is not fully fixed yet. It still crashes for lists that have pages. Shorts lists are working fine.

(Also thanks for the quick fix)

2022/09/17 13:49:50 http: panic serving 192.168.142.139:46354: relationship has not been loaded

goroutine 13304651 [running]:

net/http.(*conn).serve.func1()

    net/http/server.go:1801 +0xb9

panic({0x1442d40, 0x1b548e0})

    runtime/panic.go:1047 +0x266

github.com/stashapp/stash/pkg/txn.WithTxn.func1()

    github.com/stashapp/stash/pkg/txn/transaction.go:38 +0xf2

panic({0x1442d40, 0x1b548e0})

    runtime/panic.go:1038 +0x215

github.com/stashapp/stash/pkg/models.RelatedVideoFiles.Primary(...)

    github.com/stashapp/stash/pkg/models/relationships.go:264

github.com/stashapp/stash/internal/dlna.sceneToContainer(0xc001620600, {0xc001524b20, 0xd}, {0xc00151e240, 0x13})

    github.com/stashapp/stash/internal/dlna/cds.go:117 +0xa36

github.com/stashapp/stash/internal/dlna.(*scenePager).getPageVideos(0xc001041328, {0x1ba7240, 0xc000c8bf20}, {0x7f7b25521a80, 0xc000447d00}, 0x1, {0xc00151e240, 0x13})

    github.com/stashapp/stash/internal/dlna/paging.go:78 +0x1ec

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getPageVideos.func1({0x1ba7240, 0xc000c8bf20})

    github.com/stashapp/stash/internal/dlna/cds.go:496 +0x8b

github.com/stashapp/stash/pkg/txn.WithTxn({0x1ba71d0, 0xc000132008}, {0x1bad298, 0xc00029fa00}, 0xc0014ab420)

    github.com/stashapp/stash/pkg/txn/transaction.go:50 +0x10f

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getPageVideos(0xc0010a0810, 0x163cfdc, {0xc001524b20, 0xc001524b18}, 0x1b52450, {0xc00151e240, 0x2})

    github.com/stashapp/stash/internal/dlna/cds.go:489 +0xe5

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).getTagScenes(0xc001524a60, {0xc0010a0810, 0x3, 0x3}, {0xc00151e240, 0x13})

    github.com/stashapp/stash/internal/dlna/cds.go:599 +0x196

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).handleBrowseDirectChildren(0xc0006a21c0, {{0xc001524a60, 0xd}, {0x1b52448, 0x1}}, {0xc00151e240, 0x13})

    github.com/stashapp/stash/internal/dlna/cds.go:309 +0x4bf

github.com/stashapp/stash/internal/dlna.(*contentDirectoryService).Handle(0xc000413880, {0xc001506831, 0x12}, {0xc001a246c0, 0x111, 0x207}, 0x29)

    github.com/stashapp/stash/internal/dlna/cds.go:202 +0x36f

github.com/stashapp/stash/internal/dlna.(*Server).soapActionResponse(0x10, {{{0xc00150681e, 0x10}, 0x1}, {0xc001506831, 0x6}}, {0xc001a246c0, 0x111, 0x207}, 0xc0009bca00)

    github.com/stashapp/stash/internal/dlna/dms.go:382 +0x205

github.com/stashapp/stash/internal/dlna.(*Server).serviceControlHandler.func1(0x157d5e0, {{{0xc00150681e, 0x10}, 0x1}, {0xc001506831, 0x6}}, 0xc0008da7e0, 0xc0008da940)

    github.com/stashapp/stash/internal/dlna/dms.go:421 +0x67

github.com/stashapp/stash/internal/dlna.(*Server).serviceControlHandler(0xc00045a000, {0x1b8a498, 0xc0039d73c8}, 0xc0009bca00)

    github.com/stashapp/stash/internal/dlna/dms.go:427 +0x3f1

net/http.HandlerFunc.ServeHTTP(0xc0039d73c8, {0x1b8a498, 0xc0039d73c8}, 0xc0008da990)

    net/http/server.go:2046 +0x2f

net/http.(*ServeMux).ServeHTTP(0x157d5e0, {0x1b8a498, 0xc0039d73c8}, 0xc0009bca00)

    net/http/server.go:2424 +0x149

github.com/stashapp/stash/internal/dlna.(*Server).serveHTTP.func1({0x1b8ad68, 0xc000f89960}, 0xc0009bca00)
WithoutPants commented 2 years ago

Hi, this is not fully fixed yet. It still crashes for lists that have pages. Shorts lists are working fine.

Thanks for the report. Build b74428c should fix this issue.