unickorn / discordtidal

tidal discord rich presence for windows
24 stars 2 forks source link

App panicking and crashing after a couple of song refreshes #7

Closed AleksandarN-BG closed 2 years ago

AleksandarN-BG commented 2 years ago

Seems I'm having the same issue as #3, log attached below. I'm running Windows 11 on the latest Insider dev build, if that helps any.

2022-09-03T13:37:49.366+0200 INFO discord/assets.go:64 syncing discord 2022-09-03T13:37:49.404+0200 INFO rpc/presence.go:45 logged out of discord panic: runtime error: slice bounds out of range [:19] with length 0

goroutine 1 [running]: discordtidal/discord.unhash(0x8377b0, 0x0, 0x0, 0x20, 0x0, 0x8377b0, 0x0) C:/Dev/go/discord-tidal/discord/assets.go:207 +0x11d discordtidal/discord.Sync() C:/Dev/go/discord-tidal/discord/assets.go:86 +0x44a discordtidal.Start() C:/Dev/go/discord-tidal/tidal.go:106 +0x4d1 main.main() C:/Dev/go/discord-tidal/examples/main.go:8 +0x27

unickorn commented 2 years ago

Hmm. Any idea what song this could be?

AleksandarN-BG commented 2 years ago

I think it has something to do with the title length or the fact some tracks I play have accent characters in them. I attached a full log until the crash.

2022-09-04T14:28:45.914+0200 INFO log/log.go:13 initialized logger 2022-09-04T14:28:45.920+0200 INFO discord/endpoints.go:45 config loaded! 2022-09-04T14:28:46.120+0200 INFO rpc/presence.go:36 logged into discord 2022-09-04T14:28:46.146+0200 INFO discord/assets.go:57 opened database 2022-09-04T14:28:46.146+0200 INFO discord/assets.go:64 syncing discord 2022-09-04T14:28:46.249+0200 INFO discord/assets.go:95 loaded 70 assets 2022-09-04T14:28:46.308+0200 INFO tidal/track.go:57 searching Himna Generacije by Dubioza Kolektiv 2022-09-04T14:28:46.526+0200 INFO tidal/track.go:100 result: Himna Generacije by Dubioza Kolektiv 2022-09-04T14:28:46.795+0200 INFO discord/update_info.go:30 200 OK | update name: Himna Generacije 2022-09-04T14:28:46.795+0200 INFO rpc/presence.go:50 reloading presence 2022-09-04T14:28:59.967+0200 INFO tidal/track.go:57 searching Kažu by Dubioza Kolektiv 2022-09-04T14:29:00.102+0200 INFO tidal/track.go:100 result: Kažu by Dubioza Kolektiv 2022-09-04T14:29:00.102+0200 INFO discord/assets.go:190 asset for album Apsurdistan not found, uploading new... 2022-09-04T14:29:00.102+0200 INFO tidal/album.go:24 https://resources.tidal.com/images/892a42c1/1da7/4eec/b4d0/ce98aea96288/640x640.jpg 2022-09-04T14:29:00.738+0200 INFO discord/upload_asset.go:39 201 Created | upload asset (id: 1015961682088046752, name: 94649167) 2022-09-04T14:29:01.025+0200 INFO discord/update_info.go:30 200 OK | update name: Kažu 2022-09-04T14:29:01.025+0200 INFO rpc/presence.go:50 reloading presence 2022-09-04T14:29:17.231+0200 INFO tidal/track.go:57 searching Ti Tusen Tommeltotta by Halvdan Sivertsen 2022-09-04T14:29:17.430+0200 INFO tidal/track.go:100 result: Ti Tusen Tommeltotta by Halvdan Sivertsen 2022-09-04T14:29:17.430+0200 INFO discord/assets.go:190 asset for album Hilsen Halvdan not found, uploading new... 2022-09-04T14:29:17.430+0200 INFO tidal/album.go:24 https://resources.tidal.com/images/da2fa961/3b84/4a0b/99fd/338a99da0233/640x640.jpg 2022-09-04T14:29:18.360+0200 INFO discord/upload_asset.go:39 201 Created | upload asset (id: 1015961755769389166, name: 2402866) 2022-09-04T14:29:18.576+0200 INFO discord/update_info.go:30 200 OK | update name: Ti Tusen Tommeltotta 2022-09-04T14:29:18.577+0200 INFO rpc/presence.go:50 reloading presence 2022-09-04T14:30:07.121+0200 INFO discord/assets.go:64 syncing discord 2022-09-04T14:30:07.148+0200 INFO rpc/presence.go:45 logged out of discord panic: runtime error: slice bounds out of range [:19] with length 0

goroutine 1 [running]: discordtidal/discord.unhash(0x12c77b0, 0x0, 0x0, 0x20, 0x0, 0x12c77b0, 0x0) C:/Dev/go/discord-tidal/discord/assets.go:207 +0x11d discordtidal/discord.Sync() C:/Dev/go/discord-tidal/discord/assets.go:86 +0x44a discordtidal.Start() C:/Dev/go/discord-tidal/tidal.go:106 +0x4d1 main.main() C:/Dev/go/discord-tidal/examples/main.go:8 +0x27

File path used for the executable has no spaces or special characters.

unickorn commented 2 years ago

Can you test with the safer branch and let me know if the issue persists?

AleksandarN-BG commented 2 years ago

Safer branch doesn't appear to have the issue. I tried the exact same order of songs just now and no errors or crashes have appeared.

unickorn commented 2 years ago

I see. Can you try and figure out if the crash consistently happens on a certain song? If you can find the song, can you check your Discord dev panel to see if the album cover has uploaded?

AleksandarN-BG commented 2 years ago

Is it usual to see duplicate assets in the dev panel?

unickorn commented 2 years ago

Nope, that shouldn't happen. Does Discord even allow that?

AleksandarN-BG commented 2 years ago

image

unickorn commented 2 years ago

That looks quite broken. I couldn't maintain this project for long since TIDAL no longer functions in my country, I'll try to add some debug lines to figure out this issue for you ASAP. Help testing the debug builds would be much appreciated!

AleksandarN-BG commented 2 years ago

I'd love to help wherever I can, I really appreciate the work you've done so far, as this is the most comprehensive TIDAL RPC I've seen yet.

unickorn commented 2 years ago

Quick status update: I've signed up for a 30 day TIDAL trial and set up a testing environment in a virtual Windows machine on my Mac. My code from last year looks beyond terrible, I'm working on a general cleanup and rewrite which will hopefully fix this issue as well as #3.

unickorn commented 2 years ago

Hey @Minozen, could you try the latest release?

AleksandarN-BG commented 2 years ago

Trying now, all I'm getting is a;

panic: json: cannot unmarshal object into Go value of type []discord.Asset

goroutine 1 [running]: github.com/unickorn/discordtidal/discord.Sync() /Users/ilhanates/work/go/discordtidal/discord/assets.go:75 +0xc13 github.com/unickorn/discordtidal.Start() /Users/ilhanates/work/go/discordtidal/tidal.go:35 +0xaa main.main() /Users/ilhanates/work/go/discordtidal/cmd/main.go:8 +0x17

I did delete the db folder.

Update: Must've been some sort of issue on my end as it's running fine now. I'll give 'er a run and let you know what happens.

unickorn commented 2 years ago

Hey! Any update on this?

AleksandarN-BG commented 2 years ago

Hey, sorry for the slow responses. I'm happy to say that I couldn't get the new release to crash after a whole night of listening. Fantastic work, seriously.

On Thu, Sep 8, 2022, 08:28 Ilhan @.***> wrote:

Hey! Any update on this?

— Reply to this email directly, view it on GitHub https://github.com/Unickorn/discordtidal/issues/7#issuecomment-1240279930, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXLMCFD6J5QCWC7S3ZV5UTLV5GBQBANCNFSM6AAAAAAQD3VX5M . You are receiving this because you were mentioned.Message ID: @.***>

unickorn commented 2 years ago

Awesome! Thank you for the support, I'd appreciate if you starred the repo as well :)

AleksandarN-BG commented 2 years ago

One last thing; It seems the name of the track is slow to update. Song previously played was "Overkill" and, while the album, artist and art did update, the title did not. The name should be "Krivo Je More 2".

image

2022-09-08T21:28:05.537+0200 INFO log/log.go:16 Initialized logger 2022-09-08T21:28:05.547+0200 INFO discord/config.go:42 Config loaded! 2022-09-08T21:28:05.816+0200 INFO rpc/presence.go:38 Logged into discord 2022-09-08T21:28:05.856+0200 INFO discord/assets.go:58 Opened database 2022-09-08T21:28:05.856+0200 INFO discord/assets.go:65 Syncing Discord cache 2022-09-08T21:28:06.135+0200 INFO discord/assets.go:100 Loaded 88 assets 2022-09-08T21:28:06.590+0200 INFO tidal/track.go:57 searching Krivo Je More 2 by Dubioza Kolektiv 2022-09-08T21:28:06.862+0200 INFO tidal/track.go:100 result: Krivo Je More 2 by Dubioza Kolektiv

Only after playing a different track and then going back to it does the title update.

unickorn commented 2 years ago

Hmm, this might be because the rpc reload is faster than the request being processed by Discord. Would you mind testing an exe if I sent one with a potential fix to that?

AleksandarN-BG commented 2 years ago

Sure, send it my way.

unickorn commented 2 years ago

discordtidal-rpcdelay.exe.zip This adds a one second delay to give Discord some breathing room when updating your application name, hopefully that's the case and it fixes it.

AleksandarN-BG commented 2 years ago

Thanks, I'll give it a run tomorrow. Will let you know how it goes.