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

test_logging test_race failed with PermissionError #63889

Closed
ned-deily opened this issue Nov 22, 2013 · 8 comments
Closed

test_logging test_race failed with PermissionError #63889

ned-deily opened this issue Nov 22, 2013 · 8 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@ned-deily
Copy link
Member

BPO 19690
Nosy @vsajip, @vstinner, @ned-deily

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2013-11-22.07:31:15.913>
labels = ['type-bug', 'tests']
title = 'test_logging test_race failed with PermissionError'
updated_at = <Date 2014-09-18.03:21:06.562>
user = 'https://github.com/ned-deily'

bugs.python.org fields:

activity = <Date 2014-09-18.03:21:06.562>
actor = 'berker.peksag'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Tests']
creation = <Date 2013-11-22.07:31:15.913>
creator = 'ned.deily'
dependencies = []
files = []
hgrepos = []
issue_num = 19690
keywords = []
message_count = 7.0
messages = ['203727', '205112', '205113', '205536', '213694', '226334', '226338']
nosy_count = 4.0
nosy_names = ['vinay.sajip', 'vstinner', 'ned.deily', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue19690'
versions = ['Python 3.4', 'Python 3.5']

@ned-deily
Copy link
Member Author

http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.x/builds/568/steps/test/logs/stdio

======================================================================
ERROR: test_race (test.test_logging.HandlerTest)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test_logging.py", line 613, in test_race
    h.handle(r)
  File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/logging/__init__.py", line 835, in handle
    self.emit(record)
  File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/logging/handlers.py", line 468, in emit
    self.stream = self._open()
  File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/logging/__init__.py", line 1005, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 1] Operation not permitted: '/tmp/test_logging-3-i5haxx_n.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test_logging.py", line 616, in test_race
    h.close()
  File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/logging/__init__.py", line 990, in close
    self.flush()
  File "/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/logging/__init__.py", line 937, in flush
    self.stream.flush()
ValueError: I/O operation on closed file.

The test passed when rerun by regrtest. This looks similar to the failures in bpo-14632.

@ned-deily ned-deily added the tests Tests in the Lib/test dir label Nov 22, 2013
@vsajip
Copy link
Member

vsajip commented Dec 3, 2013

Unfortunately, the race condition can't be removed completely - it was reduced by the patch in bpo-14632 but could not be eliminated altogether. So this test can fail sporadically - tweaking the timeouts might give some temporary respite, but doesn't guarantee the issue won't return when e.g. machines are unusually heavily loaded.

I'll add some diagnostics for now and see what they show.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Dec 3, 2013

New changeset 8fe3022af4b3 by Vinay Sajip in branch 'default':
Added some diagnostics to help with bpo-19690.
http://hg.python.org/cpython/rev/8fe3022af4b3

@vsajip
Copy link
Member

vsajip commented Dec 8, 2013

I'll close this for now as the failures seem to have stopped. Though I only added some diagnostics, that might have changed the relative timings enough so the race doesn't surface (for now).

@vsajip vsajip closed this as completed Dec 8, 2013
@ned-deily
Copy link
Member Author

I've just seen another instance of this failure, this time using a 3.4.0 release test OS X installer build (non-debug, built on and running on OS X 10.5). The added diagnostics show up:

[186/389/1] test_logging
Deleted at 1394930826.466016, opened at 1394930826.456779
test test_logging failed -- Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_logging.py", line 618, in test_race
    h.handle(r)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 837, in handle
    self.emit(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/handlers.py", line 468, in emit
    self.stream = self._open()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1007, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 1] Operation not permitted: '/tmp/test_logging-3-92xfhrsa.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_logging.py", line 626, in test_race
    h.close()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 992, in close
    self.flush()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 939, in flush
    self.stream.flush()
ValueError: I/O operation on closed file.

@ned-deily ned-deily reopened this Mar 16, 2014
@vstinner
Copy link
Member

vstinner commented Sep 3, 2014

What is the status of this issue? The failure is still common on the buildbot:

http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.4/builds/458/steps/test/logs/stdio

======================================================================
ERROR: test_race (test.test_logging.HandlerTest)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.4.murray-snowleopard/build/Lib/test/test_logging.py", line 618, in test_race
    h.handle(r)
  File "/Users/buildbot/buildarea/3.4.murray-snowleopard/build/Lib/logging/__init__.py", line 852, in handle
    self.emit(record)
  File "/Users/buildbot/buildarea/3.4.murray-snowleopard/build/Lib/logging/handlers.py", line 468, in emit
    self.stream = self._open()
  File "/Users/buildbot/buildarea/3.4.murray-snowleopard/build/Lib/logging/__init__.py", line 1029, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 1] Operation not permitted: '/tmp/test_logging-3-vrpj_wts.log'

@vsajip
Copy link
Member

vsajip commented Sep 4, 2014

What is the status of this issue?

Sorry, it's been off my radar - I wonder if it has become more common recently. It's hard to reproduce, and tweaking timeouts might make it disappear, but it's a trial-and-error situation because I can hardly ever get the error to occur. The base race condition can't be eliminated, unfortunately.

@berkerpeksag berkerpeksag added the type-bug An unexpected behavior, bug, or error label Sep 18, 2014
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@kumaraditya303
Copy link
Contributor

Closing as the failures seem to have stopped.

@kumaraditya303 kumaraditya303 closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
Development

No branches or pull requests

5 participants