Opened 5 years ago

Closed 5 years ago

Last modified 2 years ago

#30603 closed Bug (duplicate)

Stored file locking issue when using Django on Windows with the youtube_dl package.

Reported by: ManicEatsWorld Owned by: nobody
Component: File uploads/storage Version: dev
Severity: Normal Keywords:
Cc: Kevin Christopher Henry Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by ManicEatsWorld)

When using the FileSystemStorage.save() functions in a Windows installation of Django with the youtube_dl package installed, an error is thrown in locks.py upon trying to unlock the newly stored file:

  Internal Server Error: /
Traceback (most recent call last):
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\move.py", line 61, in file_move_safe
    locks.lock(fd, locks.LOCK_EX)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\locks.py", line 80, in lock
    ret = LockFileEx(hfile, flags, 0, 0, 0xFFFF0000, byref(overlapped))
ctypes.ArgumentError: argument 6: <class 'TypeError'>: expected LP_OVERLAPPED instance instead of pointer to OVERLAPPED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response = get_response(request)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "<<Project base directory removed for privacy>>\GenreClassificationWeb\webClassification\views.py", line 29, in upload
    name = fs.save(uploaded_file.name, uploaded_file)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\storage.py", line 52, in save
    return self._save(name, content)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\storage.py", line 261, in _save
    file_move_safe(content.temporary_file_path(), full_path)
  File "<<Project base directory removed for privacy>>\venv\lib\site-packages\django\core\files\move.py", line 67, in file_move_safe
    locks.unlock(fd)
  File " <<Project Directory>>\venv\lib\site-packages\django\core\files\locks.py", line 86, in unlock
    ret = UnlockFileEx(hfile, 0, 0, 0xFFFF0000, byref(overlapped))
ctypes.ArgumentError: argument 5: <class 'TypeError'>: expected LP_OVERLAPPED instance instead of pointer to OVERLAPPED

Removing the youtube_dl package does immediately resolve this issue. Sadly, youtube-dl is necessary for this project due to a lack of working cross-platform alternatives.

This issue has been recreated with a Windows 10 and a Windows 7 machine using different VENVs.

I do believe this is a bug and have cross-posted an issue at the youtube-dl issue page: https://github.com/ytdl-org/youtube-dl/issues/21545.

Change History (5)

comment:1 by ManicEatsWorld, 5 years ago

Summary: Stored file locking issue when using Django on Windows and youtube_dl package is installedStored file locking issue when using Django on Windows with the youtube_dl package installed

comment:2 by ManicEatsWorld, 5 years ago

Description: modified (diff)

comment:3 by Mariusz Felisiak, 5 years ago

Cc: Kevin Christopher Henry added
Summary: Stored file locking issue when using Django on Windows with the youtube_dl package installedStored file locking issue when using Django on Windows with the youtube_dl package.
Version: 2.2master

Thanks for the report. Puzzled, I'm not sure if there is much we can do, maybe an issue is with django-compressor not with Django (see stackoverflow.).

comment:4 by Mariusz Felisiak, 5 years ago

Resolution: needsinfo
Status: newclosed

comment:5 by Mariusz Felisiak, 2 years ago

Resolution: needsinfoduplicate

Duplicate of #34294.

Note: See TracTickets for help on using tickets.
Back to Top