[Django] #30603: Stored file locking issue when using Django on Windows and youtube_dl package is installed

38 views
Skip to first unread message

Django

unread,
Jun 27, 2019, 2:51:23 PM6/27/19
to django-...@googlegroups.com
#30603: Stored file locking issue when using Django on Windows and youtube_dl
package is installed
------------------------------------------------+------------------------
Reporter: ManicEatsWorld | Owner: nobody
Type: Bug | Status: new
Component: File uploads/storage | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
When using the FileSystemStorage.save() functions in a Windows
installation of Django with the [https://github.com/ytdl-org/youtube-dl/
youtube_dl] package installed, an error is thrown in locks.py upon trying
to unlock the newly stored file:

{{{
#!div style="font-size: 80%"
{{{#!python
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 will cross-post an issue at the youtube-dl
[https://github.com/ytdl-org/youtube-dl/issues/ issue page].

--
Ticket URL: <https://code.djangoproject.com/ticket/30603>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 27, 2019, 2:51:52 PM6/27/19
to django-...@googlegroups.com
#30603: Stored file locking issue when using Django on Windows with the youtube_dl
package installed
-------------------------------------+-------------------------------------

Reporter: ManicEatsWorld | Owner: nobody
Type: Bug | Status: new
Component: File | Version: 2.2
uploads/storage |
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/30603#comment:1>

Django

unread,
Jun 27, 2019, 3:06:30 PM6/27/19
to django-...@googlegroups.com
#30603: Stored file locking issue when using Django on Windows with the youtube_dl
package installed
-------------------------------------+-------------------------------------
Reporter: ManicEatsWorld | Owner: nobody
Type: Bug | Status: new
Component: File | Version: 2.2
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by ManicEatsWorld:

Old description:

New description:

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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/30603#comment:2>

Django

unread,
Jun 28, 2019, 2:30:10 AM6/28/19
to django-...@googlegroups.com
#30603: Stored file locking issue when using Django on Windows with the youtube_dl
package.
-------------------------------------+-------------------------------------

Reporter: ManicEatsWorld | Owner: nobody
Type: Bug | Status: new
Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* cc: Kevin Christopher Henry (added)
* version: 2.2 => master


Comment:

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
[https://stackoverflow.com/questions/50337960/django-1-11-7-django-
compressor-argument-5-class-typeerror-expected-lp stackoverflow.]).

--
Ticket URL: <https://code.djangoproject.com/ticket/30603#comment:3>

Django

unread,
Jun 28, 2019, 2:30:41 AM6/28/19
to django-...@googlegroups.com
#30603: Stored file locking issue when using Django on Windows with the youtube_dl
package.
-------------------------------------+-------------------------------------
Reporter: ManicEatsWorld | Owner: nobody
Type: Bug | Status: closed

Component: File | Version: master
uploads/storage |
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/30603#comment:4>

Django

unread,
Jan 26, 2023, 1:01:05 PM1/26/23
to django-...@googlegroups.com
#30603: Stored file locking issue when using Django on Windows with the youtube_dl
package.
-------------------------------------+-------------------------------------
Reporter: ManicEatsWorld | Owner: nobody
Type: Bug | Status: closed
Component: File | Version: dev
uploads/storage |
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* resolution: needsinfo => duplicate


Comment:

Duplicate of #34294.

--
Ticket URL: <https://code.djangoproject.com/ticket/30603#comment:5>

Reply all
Reply to author
Forward
0 new messages