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 trying copying more than one pdf #19

Closed
f3fora opened this issue Mar 10, 2021 · 5 comments
Closed

Crash when trying copying more than one pdf #19

f3fora opened this issue Mar 10, 2021 · 5 comments

Comments

@f3fora
Copy link
Contributor

f3fora commented Mar 10, 2021

When copying with

cp /path/to/*.pdf remarkable/

I get

cp: cannot stat '/path/to/file.pdf': Transport endpoint is not connected

and rmfuse crashes with

WARNING:root:Getting Item e945f1a0-740b-4735-9e20-96134bb1948e during upload.  This may lead to odd behavior!
   unique: 78, success, outsize: 16

Multiple selection works with filemanager instead.

@rschroll
Copy link
Owner

I was worried about this, as you can probably tell from the warning message. There's a little gap in time between when a file upload starts and it finishes where your system will obviously expect a file to exist, but the RM cloud doesn't yet have a entry for that file. It's short, and I hadn't managed to trigger that state. But it looks like you found a way!

One thing to try would be to remove the for item in self.uploading.values(): block in get_by_id, starting here: https://github.com/rschroll/rmfuse/blob/master/rmfuse/fuse.py#L146. This will cause rmfuse to immediate return an error in this case, instead of returning an object in a possibly inconsistent state. This doesn't solve the problem, per se, but the failure may be something that the system can deal with in a not-too-broken way.

(This is how rmfuse used to work, but in #2, I was worried that this might be a problem. Turned out it wasn't the issue, so we might be able to just undo the fix.)

If that doesn't produce satisfactory behavior, do you get any traceback from the current code? Or does it just die without any message other than the warning. (Annoyingly, this does happen, which makes figuring out where the failure actually is pretty annoying.) I'll keep trying to reproduce the failure, but I've had no luck so far. I suspect it's an issue of OS + shell + upload size + upload speed.

One possible solution would be to put a lock files being uploaded, and then wait for that lock to be released in get_by_id before responding. Blocking access isn't great, but it's probably better than trying to pretend everything's okay.

@f3fora
Copy link
Contributor Author

f3fora commented Mar 15, 2021

One thing to try would be to remove the for item in self.uploading.values(): block in get_by_id, starting here: https://github.com/rschroll/rmfuse/blob/master/rmfuse/fuse.py#L146. This will cause rmfuse to immediate return an error in this case, instead of returning an object in a possibly inconsistent state. This doesn't solve the problem, per se, but the failure may be something that the system can deal with in a not-too-broken way.

Removing this part of code actually seems to solve the issue, for me. But I don't know if it is useful somewhere else.

If that doesn't produce satisfactory behavior, do you get any traceback from the current code? Or does it just die without any message other than the warning. (Annoyingly, this does happen, which makes figuring out where the failure actually is pretty annoying.) I

It just crash. I have report all the output I got. No traceback.

I'll keep trying to reproduce the failure, but I've had no luck so far. I suspect it's an issue of OS + shell + upload size + upload speed.

I use Arch Linux + Bash 5.1.4 + 2 PDF of 20K and 25K. I haven't checked the upload speed. How can I eventually get the data you are interested in? I can reproduce the issue with pip and poetry.

One possible solution would be to put a lock files being uploaded, and then wait for that lock to be released in get_by_id before responding. Blocking access isn't great, but it's probably better than trying to pretend everything's okay.

I think that actually showing a file such test.pdf.uploading can be useful especially when uploading a large file and the file manager takes a while before display the actual document.

@rschroll
Copy link
Owner

rschroll commented Mar 19, 2021 via email

@f3fora
Copy link
Contributor Author

f3fora commented Mar 20, 2021

Thanks for checking! The uploading file state was put in to try to solve a Mac problem, but that turns out to be unrelated. So getting rid of it is a reasonable solution.

I sent a PR.

  1. Make an empty file at filename.uploading. Pros: Won't be confused with eventual real file, file browsers won't try to open with a PDF viewer. Cons: Files will appear and disappear during upload, won't help tools that are trying to check whether the new file just got created.

I will go with this. Easy and do not touch in anyway final files.

@rschroll
Copy link
Owner

I think the reversion should solve this problem. If we want to add a placeholder file, I'm still open to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants