Skip to content

Commit

Permalink
retry hashing on FileNotFoundExceptions, GitHub issue #167
Browse files Browse the repository at this point in the history
  • Loading branch information
zlatinb committed Aug 29, 2022
1 parent f05d2c7 commit c833d5e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/main/groovy/com/muwire/core/files/FileHasher.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ class FileHasher {

byte[] hashList = output.toByteArray()
return InfoHash.fromHashList(hashList)
} catch (FileNotFoundException weird) {
if (file.exists()) {
// this is apparently possible on some systems while the file is being used
// by another process, see GitHub issue 167. So we try again.
Thread.sleep(10)
} else
break // give up
} catch (InternalError bad) {
// nothing we can but try again. Happens on jre 18.0.1
log.log(Level.SEVERE,"internal error while hashing", bad)
Expand Down

7 comments on commit c833d5e

@Searinox
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to reproduce the problem but couldn't. It may or may not be fixed, because I've moved files in and out of share before while the app was running and didn't have the issue. BTW the recursive tree list download is a huge improvement!

@zlatinb
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, there are still some small server-side issues with it but they are fixed in 0.8.14-beta1 which should be out later today.

@Searinox
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a trade-off however, because you can't search for files that haven't loaded yet.

@zlatinb
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the filtering functionality only works for loaded files, but you can right-click on the top-level folders and select "Expand fully". That will load everything

@Searinox
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Thanks for the clarification.

@Searinox
Copy link

@Searinox Searinox commented on c833d5e Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think MuWire likes expanding multiple folders simultaneously. Not asking for right now, but please keep a "Retry" option in the cards for the future.

Also: +UseParallelGC seems fine so far.

@zlatinb
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Failed" while trying to expand multiple folders simultaneously is a server-side bug. When the person you're browsing upgrades to 0.8.14-beta1 it should go away, at least I wasn't able to reproduce it. Retrying while remembering what has been fetched is going to be very difficult.

Regarding parallel GC - I have a report of someone sharing 2 million files with that garbage collector, so yes it is working well :)

Please sign in to comment.