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

Locked files in upload directory abort/halt a refresh #2294

Closed
chambm opened this issue Dec 16, 2017 · 2 comments
Closed

Locked files in upload directory abort/halt a refresh #2294

chambm opened this issue Dec 16, 2017 · 2 comments
Labels
bug Issue describes a bug done Done but not yet released
Milestone

Comments

@chambm
Copy link

chambm commented Dec 16, 2017

What were you doing?

Running on Windows 7, I set my Octoprint upload folder to a folder where I also save and edit gcode. I had a gcode file in this directory open in my text editor, but was trying to refresh Octoprint to get it to show a different file. Because the file I had open in the editor was locked (and had not yet been scanned by Octoprint), Octoprint was getting permission denied. Apparently, it stopped scanning at that point. It did not find/scan the other gcode file I had saved there, which was not open/locked.

This should be reproducible by saving a new file in the upload folder but keeping that file open with an exclusive lock. Then copy/save another file in the folder and release that file's lock. Octoprint will fail to scan the second file. The second file may need to come after the first in scanning order (which I guess is lexigraphical).

What did you expect to happen?

Octoprint should skip the problematic file and continue scanning other files.

What happened instead?

2017-12-16 14:37:34,500 - octoprint - ERROR - Exception on /api/files [GET]
Traceback (most recent call last):
  File "c:\OctoPrint\venv\lib\site-packages\flask-0.10.1-py2.7.egg\flask\app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "c:\OctoPrint\venv\lib\site-packages\flask-0.10.1-py2.7.egg\flask\app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "c:\OctoPrint\venv\lib\site-packages\flask-0.10.1-py2.7.egg\flask\app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "c:\OctoPrint\venv\lib\site-packages\flask-0.10.1-py2.7.egg\flask\app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "c:\OctoPrint\venv\lib\site-packages\flask-0.10.1-py2.7.egg\flask\app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\server\util\flask.py", line 964, in decorated_function
    response = f(*args, **kwargs)
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\server\api\files.py", line 102, in readGcodeFiles
    files = _getFileList(FileDestinations.LOCAL, filter=filter, recursive=recursive, allow_from_cache=not force)
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\server\api\files.py", line 174, in _getFileList
    files = fileManager.list_files(origin, path=path, filter=filter_func, recursive=recursive)[origin].values()
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\filemanager\__init__.py", line 455, in list_files
    result[dst] = self._storage_managers[dst].list_files(path=path, filter=filter, recursive=recursive)
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\filemanager\storage.py", line 603, in list_files
    return self._list_folder(path, base=base, entry_filter=filter, recursive=recursive)
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\filemanager\storage.py", line 1338, in _list_folder
    metadata=metadata)
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\filemanager\storage.py", line 1424, in _add_basic_metadata
    hash=self._create_hash(os.path.join(path, entry)),
  File "c:\OctoPrint\venv\lib\site-packages\octoprint-1.3.6-py2.7.egg\octoprint\filemanager\storage.py", line 1454, in _create_hash
    with open(path, "rb") as f:
IOError: [Errno 13] Permission denied: u'D:\\Downloads\\Things\\WTTSP_medium_res_continued.gcode'

Did the same happen when running OctoPrint in safe mode?

I didn't try.

Version of OctoPrint

1.3.6

Operating System running OctoPrint

Windows 7 64-bit

Printer model & used firmware incl. version

Flsun i3c, Marlin 1.1.6

Browser and Version of Browser, Operating System running Browser

Chrome 63

Link to octoprint.log

https://gist.github.com/chambm/eadb3b64c0635c5d3b6a5b6b3904b661

Link to contents of terminal tab or serial.log

n/a

Link to contents of Javascript console in the browser

n/a

I have read the FAQ.

@GitIssueBot GitIssueBot added the triage This issue needs triage label Dec 16, 2017
@foosel
Copy link
Member

foosel commented Dec 18, 2017

As I'm wrapping things up for 2017, I'll take a look at this come January! 🎄

@foosel foosel added this to the 1.3.7 milestone Dec 18, 2017
@foosel foosel added bug Issue describes a bug and removed triage This issue needs triage labels Jan 22, 2018
@foosel foosel added the done Done but not yet released label Jan 22, 2018
@foosel
Copy link
Member

foosel commented Jan 22, 2018

Solved by the above commit, already available on maintenance, soon devel and to be rolled out with 1.3.7

@foosel foosel closed this as completed in b5aae0b Apr 9, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue describes a bug done Done but not yet released
Projects
None yet
Development

No branches or pull requests

3 participants