-
Notifications
You must be signed in to change notification settings - Fork 276
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
Support for multiple FILE commands in CUE. #434
Conversation
Thanks for this patch! I see that you removed most of the |
Hi Michael, I removed |
Will you be around to help out if this change turns out to cause problems to other users? I'm not using CUE sheets myself. And I hesitate to merge a change to (mostly) working functionality, which provides a feature nobody has been asking for in years... |
Yes, I can support it. |
Ok, could you please make sure all the comment around line 126 still makes sense after your changes? We can then give it a try. |
Comment in line 126 actually says nothing about how FILE command is processed. Added small explanation. |
Ok, let's give this a try. Thanks! |
I'm just a user but I think that this change might have broken something. I have Logitech Media Server Version: 8.0.0 - 1604555568 @ Thu Nov 5 2020 and scan now fails on .cue files which previous versions of LMS have been perfectly happy to scan. |
@StuartRob would you mind sharing your scanner.log file after a scan crashed? |
Sample cue sheet from the forum thread:
|
@oleg-kuh there's something wrong with this change. We're seeing crashes in the CUE sheet handling. Please see the forum thread linked above. There are two scanner.log files which don't show any obvious failure, but just end at some point. I'll see whether I can find something. Otherwise I'll have to revert this change. |
I have uploaded a sample flac file with embedded cue sheet to the forum. This does trigger a problem. It may help diagnose. See this forum thread post: |
There indeed seems to be an infinite loop somewhere: I pointed the scanner at a folder with less than a dozen files with CUE sheets. After a short time of no visible activity the scanner used 1.5GB of memory. I guess at some point it crashes after running out of memory. I'll investigate. |
my $lastpos = $tracks->{$currtrack}->{'END'}; | ||
|
||
# If we can't get $lastpos from the cuesheet, try and read it from the original file. | ||
if (!$lastpos && $filename) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oleg-kuh This is where we enter an infinite loop. We must not enter this condition when we're done with a file, or it'll go back to Slim::Formats->readTags()
which in turn will call Slim::Formats::FLAC->getTag()
, which will call the CUE sheet parser again. Here's a snippet from a backtrace:
[20-11-09 20:07:17.2417] Slim::Formats::Playlists::CUE::parse (103) Backtrace:
frame 0: Slim::Utils::Log::logBacktrace (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 103)
frame 1: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 2: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 3: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 4: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 5: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 6: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 7: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 8: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 9: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 10: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 11: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 12: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 13: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 14: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 15: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 16: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 17: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 18: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 19: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 20: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 21: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 22: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 23: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 24: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 25: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 26: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 27: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 28: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 29: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 30: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 31: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 32: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 33: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 34: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 35: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
frame 36: Slim::Formats::readTags (/Users/mh/SynologyDrive/git/server/Slim/Formats/Playlists/CUE.pm line 463)
frame 37: Slim::Formats::Playlists::CUE::parse (/Users/mh/SynologyDrive/git/server/Slim/Formats/FLAC.pm line 124)
frame 38: Slim::Formats::FLAC::getTag (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 191)
frame 39: (eval) (/Users/mh/SynologyDrive/git/server/Slim/Formats.pm line 181)
After only a few seconds there already were thousands of recursions...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-introducing this check would "fix" the recursion for me. @oleg-kuh - any good reason why you removed it?
@oleg-kuh - I've reverted this change for now. I'd like to stabilize LMS 8.0 to be able to release it. Please look into the issues reported here and submit a new PR. I'll be happy to merge to an upcoming 8.1 and give it another try. Thanks for your understanding. |
Pull request #452 should fix the issue. |
Thanks @oleg-kuh! I re-applied both changes. Please everybody give it some good testing. |
This chnage has broken some other users CUE file. They worked from 7.9.2 and broken on 8 Oct in LMS 8.0 |
Thanks @bpa-code for looking into this. Did you manage to create a "disk" to reproduce this issue? |
@oleg-kuh could you please look into this?
|
Cue sheet in question looks like "non-compliant" to me. I guess such cues supported only by EAC. Supporting them will require significant redesign of existing CUE parser. I think best way for now will be to ignore them. It will require some detecting logic. I can take closer look on weekend. |
While they are "non-compliant", they did work before this pull request was merged. |
I believe before this pull request we were ignoring all the CUEs with multiple FILE commands. So CUE was not used at all. |
I'm not too familiar with the full story. But it's been proven that some CUE sheets which did work before now no longer work. So this is a regression, not a buggy new feature. |
Well, the full story is short. Before this pull request all the CUEs that have more then one FILE command were ignored by parser (including non-compliant CUE in question). |
As I mentioned there are cases which worked before and are broken now. I don't know whether @bpa-code can share his with you. |
@oleg-kuh I actually might have been wrong: the test case I have here would indeed previously scan correctly because the CUE sheet was rejected. A solution for the user might be to simply get rid of these useless CUE sheets. Or could there be an easy way to discover "invalid" CUE sheets and skip these? |
I don't have a vested interest in the CUE file - I just chased down the bug in case it was related to Flac and "-skip" but there are users of these CUE files. |
See #474 |
There is (yet) another scenario that's not fully working in 8.1.1: multiple files with multiple tracks each. When scanning these, the files show up in the Album list with file type 'cur'. These tracks can't be played. And shouldn't be visible in the tracklist.
|
The idea is to set last seen filename for current track.