Skip to content

test: Wait before cleanup on exit - #15171

Closed
Empact wants to merge 1 commit into
bitcoin:masterfrom
Empact:test-wait-cleanup
Closed

Empact wants to merge 1 commit into
bitcoin:masterfrom
Empact:test-wait-cleanup

Conversation

@Empact

@Empact Empact commented Jan 15, 2019 •

Copy link
Copy Markdown
Contributor

This operation can fail due to log file contention, waiting should reduce this occurance.

An alternative is to retry, but that requires quite a few lines in Python so this seems more
appropriate.

[00:27:35] Traceback (most recent call last):
[00:27:35]   File "C:\projects\bitcoin/test/functional/feature_notifications.py", line 88, in <module>
[00:27:35]     NotificationsTest().main()
[00:27:35]   File "C:\projects\bitcoin\test\functional\test_framework\test_framework.py", line 223, in main
[00:27:35]     shutil.rmtree(self.options.tmpdir)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 507, in rmtree
[00:27:35]     return _rmtree_unsafe(path, onerror)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 386, in _rmtree_unsafe
[00:27:35]     _rmtree_unsafe(fullname, onerror)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 386, in _rmtree_unsafe
[00:27:35]     _rmtree_unsafe(fullname, onerror)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 391, in _rmtree_unsafe
[00:27:35]     onerror(os.unlink, fullname, sys.exc_info())
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 389, in _rmtree_unsafe
[00:27:35]     os.unlink(fullname)
[00:27:35] PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_runner_20190115_020102\\feature_notifications_45\\node0\\regtest\\debug.log'

https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21618398

@fanquake fanquake added the Tests label Jan 15, 2019
@promag

promag commented Jan 15, 2019

Copy link
Copy Markdown
Contributor

but that requires quite a few lines in Python

I think it's preferable.

@laanwj

laanwj commented Jan 15, 2019

Copy link
Copy Markdown
Member

Retrying is definitely preferable—fixed waits are a waste of valuable testing time when they're not necessary, and fragile otherwise.

@maflcko

maflcko commented Jan 15, 2019

Copy link
Copy Markdown
Member

Why is shutdown not blocking until the logs are flushed :(

@Empact
Empact force-pushed the test-wait-cleanup branch 4 times, most recently from c1fcefa to 803c1db Compare January 15, 2019 21:59
Comment thread test/functional/test_framework/util.py Resolved
@Empact
Empact force-pushed the test-wait-cleanup branch from 803c1db to 743d33f Compare January 15, 2019 22:37
This operation can fail due to log file contention, retrying should reduce this occurance.

[00:27:35] Traceback (most recent call last):
[00:27:35]   File "C:\projects\bitcoin/test/functional/feature_notifications.py", line 88, in <module>
[00:27:35]     NotificationsTest().main()
[00:27:35]   File "C:\projects\bitcoin\test\functional\test_framework\test_framework.py", line 223, in main
[00:27:35]     shutil.rmtree(self.options.tmpdir)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 507, in rmtree
[00:27:35]     return _rmtree_unsafe(path, onerror)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 386, in _rmtree_unsafe
[00:27:35]     _rmtree_unsafe(fullname, onerror)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 386, in _rmtree_unsafe
[00:27:35]     _rmtree_unsafe(fullname, onerror)
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 391, in _rmtree_unsafe
[00:27:35]     onerror(os.unlink, fullname, sys.exc_info())
[00:27:35]   File "C:\Python37-x64\lib\shutil.py", line 389, in _rmtree_unsafe
[00:27:35]     os.unlink(fullname)
[00:27:35] PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_runner_20190115_020102\\feature_notifications_45\\node0\\regtest\\debug.log'
https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21618398
@Empact
Empact force-pushed the test-wait-cleanup branch from 743d33f to 2a9d4e5 Compare January 15, 2019 23:27
@Empact

Empact commented Jan 16, 2019

Copy link
Copy Markdown
Contributor Author

The shutdown is unrelated - logging deals with /test_framework.log. This is the debug log for node0, which is apparently still active despite this being the last log entries. Not sure where the access is coming from:

[00:27:35]  node0 2019-01-15T02:08:41.638177Z BerkeleyEnvironment::Flush: wallet.dat checkpoint 
[00:27:35]  node0 2019-01-15T02:08:41.644178Z BerkeleyEnvironment::Flush: wallet.dat detach 
[00:27:35]  node0 2019-01-15T02:08:41.645176Z BerkeleyEnvironment::Flush: wallet.dat closed 
[00:27:35]  node0 2019-01-15T02:08:41.645176Z BerkeleyEnvironment::Flush: Flush(true) took               9ms 
[00:27:35]  node0 2019-01-15T02:08:41.674177Z [default wallet] Releasing wallet 
[00:27:35]  node0 2019-01-15T02:08:41.674177Z Shutdown: done 

@maflcko

maflcko commented Jan 17, 2019

Copy link
Copy Markdown
Member

I mean logging.shutdown https://docs.python.org/3/library/logging.html#logging.shutdown

The doc doesn't really say if it is async or sync

@Empact

Empact commented Jan 17, 2019

Copy link
Copy Markdown
Contributor Author

I think they're distinct concerns, because they concern different files/folders. Seems logging operates ontest_framework.log, at least in this context, vs node0/regtest/debug.log.

self.log = logging.getLogger('TestFramework')
self.log.setLevel(logging.DEBUG)
# Create file handler to log all messages
fh = logging.FileHandler(self.options.tmpdir + '/test_framework.log', encoding='utf-8')

I'm not clear on is what would be accessing the log though. Shutdown has occurred by this point so I don't think it could be node0 bitcoind.

@Empact

Empact commented Jan 25, 2019

Copy link
Copy Markdown
Contributor Author

I haven't seen this since, so we may want to hold on it until it shows up again.

@Empact

Empact commented Jan 30, 2019

Copy link
Copy Markdown
Contributor Author

Closing pending possible future sighting.

@Empact Empact closed this Jan 30, 2019
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants