-
Notifications
You must be signed in to change notification settings - Fork 53
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
Thread Exception when Downloading #81
Comments
Do you have the exact steps you followed before you found the exception? I've never seen it before, what site were you trying to download from? What manga and what chapters? Any particular arguments you passed on to the application? |
First, I'm using the code from the following git commit: As for what I did, here's what it is:
On the last Just in case you were wondering, the alias manga_downloader="~/bin/manga_downloader/src/manga.py" That is, I run the python file as an executable (since it has executable permissions and also starts of the file with |
@jiaweihli can correct me if I'm wrong but while there is (was?) an effort to migrate manga_downloader to Python3 it is my understanding that the migration was never completed, Python2 continues to be the supported interpreter. As for your bug, and prepare yourself for a long post, I'm not able to reproduce it. You do mention that this happens randomly and by looking at your traces it doesn't look like this is related to thread handling code, but rather, something is happening in the underlying code; quite possibly related to a ZIP file getting corrupted somewhere and for some reason. Both Which brings me to the next point. I think you've found a bigger issue with the current code: we're not able to correctly debug the application even in edge cases because we're silencing all Exceptions in the The code that is raising this def run (self):
try:
self.siteParser.processChapter(self, self.chapter)
except Exception as exception:
# Assume semaphore has not been release
# This assumption could be faulty if the error was thrown in the compression function
# The worst case is that releasing the semaphore would allow one more thread to
# begin downloading than it should
#
# If the semaphore was not released before the exception, it could cause deadlock
chapterThreadSemaphore.release()
self.isThreadFailed = True
raise FatalError("Thread crashed while downloading chapter: %s" % str(exception)) If an Exception is raised in any part of the underlying code in While we may not be able to further troubleshoot your problem at least for now I believe we should tag your issue as a bug and proceed to open another issue to take care of the silenced exceptions, maybe then we'll be able to get more information on what is going on. If nobody has any objection, I'll proceed to document that in another ticket. |
I just remembered another issue that may have to do with this (I don't know how your file streaming works, so it's hard for me to say this is part of the problem). My connection to the internet from my room is rather iffy, sometimes it cuts off completely and unexpectedly and then goes back 100%. Could any slight cuts in the connection like this cause for the file stream to be corrupted or in general cause issues with an individual thread? As I said, if one thread has an error downloading it gives me this error, but the the other threads seem to continue. |
My hunch is that you're seeing high packet loss, and that this is causing issues when creating an archive. |
@jiaweihli, that seems like it would be it, but that shouldn't be a problem if these packets were transfered over TCP (which would be normal considering it's a file transfer). I'm not sure as to the workings of manga_downloader (mostly 'cause I don't know any real Python), but it should be able to use TCP. Of course, this is all assuming that the issue is packet loss. |
If your internet is cutting out intermittently, it's possible that the connection to the server is getting closed and you're unable to resume the original connection. In days past when I had a wonky internet setup, I would sometimes end up with incomplete/truncated images. I'm not sure if you're experiencing a similar problem, since I never ran into an issue building the archive. Fixing #82 will help diagnose this issue. |
@jiaweihli, I'm not getting any truncated images, just this thread exception. It seems to have stopped since I created an alias and now it only runs on one thread, but that isn't necessarily fixing the problem but rather avoiding it ('cause I want to download my next chapter of manga). So yeah, it's just the exception. |
Fixed in #90 |
Whoops, not fixed - but should be easier to debug. |
So for quite a while now I've been using only a single thread for downloading manga, which has worked just fine (with my shitty internet), however recently I got a PLC so I can have a much more consistent connection. I'll try using multi-threaded again and see if it works fine, which should also help to see where this is coming from. Have a great New Year's! |
@Deathsbreed And happy holidays! 🎉 |
This is still an issue, I think it may be the same issue anyways:
Workaround is to disable multi-threading as Deathsbreed suggested using e.g.
|
Forgive me if this is a duplicate, but I don't believe I've seen it anywhere when passing through the issues.
Here's the error:
At the same time I also get the following error, which I am not sure if it is related:
The Python version I'm running this on is the default for my system (Debian Testing):
It also seems that although it gives this error it continues to download the next files in the background (not showing any progress), and also continues to have errors every now and then with other files.
I hope this is helpful.
The text was updated successfully, but these errors were encountered: