Skip to content

zipfile extractall is not multi-threading safe #112998

Closed

Description

@pbsds

Bug report

Bug description:

I ran into the following traceback when extracting multiple zipfiles into the same directory with concurrent.futures:

Traceback (most recent call last):
  File "/home/pbsds/ntnu/ifield/ifield/mldata/processing.py", line 252, in run
    res, start, end = future.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/pbsds/ntnu/ifield/ifield/mldata/processing.py", line 290, in _run_job
    retval = job.do(pre_args=a)
  File "/home/pbsds/ntnu/ifield/ifield/mldata/processing.py", line 41, in do
    f(*a, **kw)
  File "/home/pbsds/ntnu/ifield/ifield/mldata/extract_file.py", line 21, in extract
    f.extractall(path=dest)
  File "/usr/lib/python3.10/zipfile.py", line 1647, in extractall
    self._extract_member(zipinfo, path, pwd)
  File "/usr/lib/python3.10/zipfile.py", line 1693, in _extract_member
    os.makedirs(upperdirs)
  File "/usr/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)

CPython versions tested on:

3.10

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Dec 12, 2023
  2. pbsds commented on Dec 12, 2023

    @pbsds
    ContributorAuthor

    related: #67837

  3. added 4 commits that reference this issue on Dec 12, 2023
  4. added 2 commits that reference this issue on Feb 6, 2024
  5. added a commit that references this issue on Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions