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

PDF indexing should be paused when adding a file via drag and drop #8182

Closed
2 tasks done
koppor opened this issue Oct 24, 2021 · 4 comments · Fixed by #8334
Closed
2 tasks done

PDF indexing should be paused when adding a file via drag and drop #8182

koppor opened this issue Oct 24, 2021 · 4 comments · Fixed by #8334
Assignees
Labels
bug Confirmed bugs or reports that are very likely to be bugs
Milestone

Comments

@koppor
Copy link
Member

koppor commented Oct 24, 2021

JabRef version

Latest development branch build (please note build date below)

Operating system

Windows

Details on version and operating system

Windows 10

Checked with the latest development build

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. Configure explicit directory for library (refs "General file directory" is not respected when dropping a file #8179)
  2. Drag a PDF file from c:\temp
  3. Drop file at an existing entry

Expected behavior:

File is moved and renamed

Current behavior:

At first attempt, an IOException is risen:

java.nio.file.FileSystemException: C:\TEMP\xy.pdf -> C:\TEMP\FMC - FMC_ an Approach Towards Architecture Centric System Development.pdf: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird

Then, the user can detach the file from the entry and try again. Then, it works.

Solution propsal

Stop PDF indexing during drop handling. Start indexing again after drop (includes file move!!) is finished

@koppor koppor added this to the v5.4 milestone Oct 25, 2021
@koppor koppor added the bug Confirmed bugs or reports that are very likely to be bugs label Oct 25, 2021
@btut
Copy link
Contributor

btut commented Oct 27, 2021

I think pausing the indexing does not solve this problem. The indexer is triggered by the change in the list of linked files. The file will be added to the indexing queue when the list changes. If the indexer is paused during the drop, the task will still be added to the queue. After unpausing, the indexer would try to index the file at the old location, because that's what was added to the queue.

IMO it would be better to add the file-link only after the file was moved and renamed, is that possible?

@btut
Copy link
Contributor

btut commented Dec 13, 2021

Note: I am experiencing different behavior when testing this. For me, the indexer starts after moving the file, but before renaming it.
So lets say I have a file "Downloads/abcd.pdf" and I drag it onto an entry, the indexer tries to read "mypdfdirectory/abcd.pdf" when the file was already renamed to "mypdfdirectory/mynamingconventionapplied.pdf".
Don't know if that is operating-system related or just a roll of the dice. There is one important piece of information that can be obtained from this observation: the indexer stores a reference to the path. That path is changed from the move/renaming operation. This means actually pausing the indexer before the drag and restarting afterwards could actually be a solution.

@koppor
Copy link
Member Author

koppor commented Dec 13, 2021

I am on Windows with a strong file locking build-in. 😅

@btut
Copy link
Contributor

btut commented Dec 14, 2021

This means actually pausing the indexer before the drag and restarting afterwards could actually be a solution.

Does not work :(

Instead of pausing the indexer, we avoid the addition of the new pdf to the indexing task list by blocking new tasks during the drag&drop operation. Once the drop happened, we create a new task to index the entry that the pdf was dropped on.

Does #8334 fix your issue @koppor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants