pytest: FileExistsError: [Errno 17] File exists: '/tmp/pytest-of-jenkins/pytest-0/.lock'

Hi there -

Just need to know what’s happening on this one, this seems to be new code in py.test in version 3.9.1, my other build server running 3.8.2 doesn’t have this issue.

is there…some kind of revolving numeric scheme such that more than one runner (I’m using pytest-xdist, 1.23.2 on both environments) is conflicting on this?

this is SQLAlchemy’s test suite running on jenkins.

stack trace:


INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/pathlib.py", line 127, in create_cleanup_lock
INTERNALERROR>     fd = os.open(str(lock_path), os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o644)
INTERNALERROR> FileExistsError: [Errno 17] File exists: '/tmp/pytest-of-jenkins/pytest-0/.lock'
INTERNALERROR> 
INTERNALERROR> The above exception was the direct cause of the following exception:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/main.py", line 179, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/pluggy/hooks.py", line 284, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/pluggy/manager.py", line 67, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/pluggy/manager.py", line 61, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/xdist/dsession.py", line 81, in pytest_sessionstart
INTERNALERROR>     nodes = self.nodemanager.setup_nodes(putevent=self.queue.put)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/xdist/workermanage.py", line 67, in setup_nodes
INTERNALERROR>     nodes.append(self.setup_node(spec, putevent))
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/xdist/workermanage.py", line 76, in setup_node
INTERNALERROR>     node.setup()
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/xdist/workermanage.py", line 242, in setup
INTERNALERROR>     basetemp = self.config._tmpdirhandler.getbasetemp()
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/tmpdir.py", line 107, in getbasetemp
INTERNALERROR>     return py.path.local(self._tmppath_factory.getbasetemp().resolve())
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/tmpdir.py", line 66, in getbasetemp
INTERNALERROR>     prefix="pytest-", root=rootdir, keep=3, lock_timeout=LOCK_TIMEOUT
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/pathlib.py", line 235, in make_numbered_dir_with_cleanup
INTERNALERROR>     consider_lock_dead_if_created_before=consider_lock_dead_if_created_before,
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/pathlib.py", line 214, in cleanup_numbered_dir
INTERNALERROR>     try_cleanup(path, consider_lock_dead_if_created_before)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/pathlib.py", line 196, in try_cleanup
INTERNALERROR>     delete_a_numbered_dir(path)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/pathlib.py", line 166, in delete_a_numbered_dir
INTERNALERROR>     create_cleanup_lock(path)
INTERNALERROR>   File "/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/_pytest/pathlib.py", line 131, in create_cleanup_lock
INTERNALERROR>     EnvironmentError("cannot create lockfile in {path}".format(path=p)), e
INTERNALERROR>   File "<string>", line 3, in raise_from
INTERNALERROR> OSError: cannot create lockfile in /tmp/pytest-of-jenkins/pytest-0
/home/jenkins/workspace/sqlalchemy_gerrit/b3d9d1a2/.tox/py37-cext-sqlite-postgresql/lib/python3.7/site-packages/psycopg2

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

New occurrence of the same issue. Opened a separate issue since this was already resolved: https://github.com/pytest-dev/pytest/issues/5456

@otrejoso is definitely related, but is blowing up in a different place now it seems. Could you please open a new issue? Thanks!