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

Crash when downloading pdf without content license #358

Closed
pixil98 opened this issue Aug 13, 2022 · 4 comments
Closed

Crash when downloading pdf without content license #358

pixil98 opened this issue Aug 13, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@pixil98
Copy link
Contributor

pixil98 commented Aug 13, 2022

Describe the bug
When testing out my docker image I attempted to download The Count of Monte Cristo. I believe this used to be an Audible Plus book so I'd expect it to fail to download.

You can see from the logs that the book did fail to download.

DownloadDecryptBook Begin: 05/11/2022 [B005GFQ5WQ] The Count of Monte Cristo
DownloadDecryptBook Completed: 05/11/2022 [B005GFQ5WQ] The Count of Monte Cristo
DownloadPdf Begin: 05/11/2022 [B005GFQ5WQ] The Count of Monte Cristo
Error processing book. Skipping. This book will be tried again on next attempt. For options of skipping or marking as error, retry with main Libation app.. See log for more details.

The PDF however, caused a core dump on it's failure:

Unhandled exception. AudibleApi.ValidationErrorException: Content License denied for asin: [B005GFQ5WQ]
   at AudibleApi.Api.GetDownloadLicenseAsync(String asin, DownloadQuality quality) in /home/runner/work/AudibleApi/AudibleApi/AudibleApi/Api.Download.cs:line 123
   at AudibleApi.Api.GetPdfDownloadLinkAsync(String asin) in /home/runner/work/AudibleApi/AudibleApi/AudibleApi/Api.Download.cs:line 141
   at FileLiberator.DownloadPdf.downloadPdfAsync(LibraryBook libraryBook, String proposedDownloadFilePath) in C:\Dropbox\DinahsFolder\coding\_NET\Visual Studio 2022\Libation\Source\FileLiberator\DownloadPdf.cs:line 61
   at FileLiberator.DownloadPdf.ProcessAsync(LibraryBook libraryBook) in C:\Dropbox\DinahsFolder\coding\_NET\Visual Studio 2022\Libation\Source\FileLiberator\DownloadPdf.cs:line 30
   at FileLiberator.Processable.TryProcessAsync(LibraryBook libraryBook) in C:\Dropbox\DinahsFolder\coding\_NET\Visual Studio 2022\Libation\Source\FileLiberator\Processable.cs:line 61
   at LibationCli.LiberateOptions.<>c__DisplayClass5_0.<<CreateBackupBook>g__onDownloadDecryptBookCompleted|0>d.MoveNext() in C:\Dropbox\DinahsFolder\coding\_NET\Visual Studio 2022\Libation\Source\LibationCli\Options\LiberateOptions.cs:line 30
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
   at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
./liberate.sh: line 11:    36 Aborted                 (core dumped) /libation/LibationCli liberate

Interestingly it says that it finished downloading the PDF right before the exception.

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to download a pdf you don't have the content license for using the cli.

Expected behavior
I'd expect it to gracefully not download the pdf

Platform
Linux

@pixil98 pixil98 added the bug Something isn't working label Aug 13, 2022
@Mbucari
Copy link
Collaborator

Mbucari commented Aug 16, 2022

@rmcrackan This is happening because DownloadPdf.TryProcessAsync is being called inside an async event handler. When DownloadDecryptBook.Completed fires, it runs the event handler on a new thread and so the handler is outside the scope of the OptionsBase.Run exception handler.

async void onDownloadDecryptBookCompleted(object sender, LibraryBook e)
{
await downloadPdf.TryProcessAsync(e);
}

There are a dozen ways to fix this, so I'll let you choose a solution you like.

@rmcrackan
Copy link
Owner

Code is complete. The next version will contain the fix. I'm currently fighting through a publishing issue first.

@rmcrackan rmcrackan reopened this Aug 18, 2022
@rmcrackan
Copy link
Owner

I just released v8.4.2 to address your issue. Please try it and let me know if this fixes your error.

This will not get picked up with auto-update since it's technically a "pre-release". I'm going on vacation soon and I don't want to risk putting out a bad full release then people are stuck with it until I return to angry emails.

@rmcrackan
Copy link
Owner

I changed 8.4.2 to a full release. It should fix your issue. If not, please reply here and we can re-open the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants