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

TestArtifactCache.test_restful_cache_failover is flaky #6838

Closed
baroquebobcat opened this issue Nov 29, 2018 · 7 comments
Closed

TestArtifactCache.test_restful_cache_failover is flaky #6838

baroquebobcat opened this issue Nov 29, 2018 · 7 comments

Comments

@baroquebobcat
Copy link
Contributor

Ran into this, a re-run of the shard fixed it.

                     _ TestArtifactCache.test_restful_cache_failover __
                     
                     self = <pants_test.cache.test_artifact_cache.TestArtifactCache testMethod=test_restful_cache_failover>
                     
                         def test_restful_cache_failover(self):
                           bad_url = 'http://badhost:123'
                         
                           with temporary_dir() as artifact_root:
                             local = TempLocalArtifactCache(artifact_root, 0)
                         
                             # With fail-over, rest call second time will succeed
                             with self.setup_server() as good_server:
                               artifact_cache = RESTfulArtifactCache(artifact_root,
                                                                     BestUrlSelector([bad_url, good_server.url], max_failures=0),
                                                                     local)
                               with self.assertRaises(NonfatalArtifactCacheError) as ex:
                                 self.do_test_artifact_cache(artifact_cache)
                               self.assertIn('Failed to HEAD', str(ex.exception))
                         
                     >         self.do_test_artifact_cache(artifact_cache)
                     
                     pants_test/cache/test_artifact_cache.py:88: 
                     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                     pants_test/cache/test_artifact_cache.py:97: in do_test_artifact_cache
                         self.assertTrue(artifact_cache.has(key))
                     pants/cache/restful_artifact_cache.py:67: in has
                         return self._request('HEAD', cache_key) is not None
                     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                     
                     self = <pants.cache.restful_artifact_cache.RESTfulArtifactCache object at 0x7f01bcba8550>
                     method = 'HEAD'
                     cache_key = CacheKey(id=u'muppet_key', hash=u'fake_hash')
                     body = None
                     
                         def _request(self, method, cache_key, body=None):
                         
                           session = RequestsSession.instance()
                           with self.best_url_selector.select_best_url() as best_url:
                             url = self._url_for_key(best_url, cache_key)
                             logger.debug('Sending {0} request to {1}'.format(method, url))
                             try:
                               if 'PUT' == method:
                                 response = session.put(url,
                                                        data=body,
                                                        timeout=self._write_timeout_secs,
                                                        allow_redirects=True)
                               elif 'GET' == method:
                                 response = session.get(url,
                                                        timeout=self._read_timeout_secs,
                                                        stream=True,
                                                        allow_redirects=True)
                               elif 'HEAD' == method:
                                 response = session.head(url,
                                                         timeout=self._read_timeout_secs,
                                                         allow_redirects=True)
                               elif 'DELETE' == method:
                                 response = session.delete(url,
                                                           timeout=self._write_timeout_secs,
                                                           allow_redirects=True)
                               else:
                                 raise ValueError('Unknown request method {0}'.format(method))
                             except RequestException as e:
                               raise NonfatalArtifactCacheError('Failed to {0} {1}. Error: {2}'
                     >                                          .format(method, url, e))
                     E         NonfatalArtifactCacheError: Failed to HEAD http://badhost:123/muppet_key/fake_hash.tgz. Error: HTTPConnectionPool(host='badhost', port=123): Max retries exceeded with url: /muppet_key/fake_hash.tgz (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f01b8084f50>: Failed to establish a new connection: [Errno -2] Name or service not known',))
                     
                     pants/cache/restful_artifact_cache.py:132: NonfatalArtifactCacheError
                     -------------- Captured stderr call --------------
                     127.0.0.1 - - [28/Nov/2018 22:38:00] "HEAD /muppet_key/fake_hash.tgz HTTP/1.1" 307 -
                     127.0.0.1 - - [28/Nov/2018 22:38:00] code 404, message File not found
                     127.0.0.1 - - [28/Nov/2018 22:38:00] "HEAD /muppet_key/fake_hash.tgz/__redir__ HTTP/1.1" 404 -
                     127.0.0.1 - - [28/Nov/2018 22:38:00] "GET /muppet_key/fake_hash.tgz HTTP/1.1" 307 -
                     127.0.0.1 - - [28/Nov/2018 22:38:00] code 404, message File not found
                     127.0.0.1 - - [28/Nov/2018 22:38:00] "GET /muppet_key/fake_hash.tgz/__redir__ HTTP/1.1" 404 -
                     127.0.0.1 - - [28/Nov/2018 22:38:00] "HEAD /muppet_key/fake_hash.tgz HTTP/1.1" 307 -
                     127.0.0.1 - - [28/Nov/2018 22:38:00] code 404, message File not found
                     127.0.0.1 - - [28/Nov/2018 22:38:00] "HEAD /muppet_key/fake_hash.tgz/__redir__ HTTP/1.1" 404 -
                     127.0.0.1 - - [28/Nov/2018 22:38:00] "PUT /muppet_key/fake_hash.tgz HTTP/1.1" 307 -
                     --------------- Captured log call ----------------
                     artifact_cache.py          103 ERROR    Error while writing to artifact cache: Failed to PUT http://localhost:50631/muppet_key/fake_hash.tgz. Error: ('Connection aborted.', error(32, 'Broken pipe'))
                      generated xml file: /home/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.cache.artifact_cache/junitxml/TEST-tests.python.pants_test.cache.artifact_cache.xml 
@stuhood
Copy link
Member

stuhood commented Dec 6, 2018

TestArtifactCache.test_restful_cache as well.

@stuhood
Copy link
Member

stuhood commented Dec 6, 2018

And test_multiproc: see the linked ticket.

@stuhood
Copy link
Member

stuhood commented Dec 6, 2018

Seen again with test_restful_cache in master.

@Eric-Arellano
Copy link
Contributor

Have ran into these multiple times the past week.

@pierrechevalier83
Copy link
Contributor

Hit again in TestArtifactCache.test_local_backed_remote_cache https://travis-ci.org/pantsbuild/pants/jobs/589387228

@Eric-Arellano
Copy link
Contributor

Encountered again, even with the 1 retry. I'm going to bump to 2 retries (it's a cheap test) and then we should remove the test if it happens again.

@jsirois jsirois self-assigned this Mar 24, 2020
jsirois added a commit to jsirois/pants that referenced this issue Mar 25, 2020
This brings our skip count up from 7 python and 2 rust to 25 python and
4 rust, hopefully in the name of stability as outlined in pantsbuild#9386.

Also updates the How to Contribute docs with a pointer to pantsbuild#9386 for
the latest procedure.

Includes flaky tests from:
 pantsbuild#9313 pantsbuild#9312 pantsbuild#8679 pantsbuild#8678 pantsbuild#8520 pantsbuild#8520 pantsbuild#8520 pantsbuild#8405 pantsbuild#8193 pantsbuild#8171 pantsbuild#7836 pantsbuild#7622
 pantsbuild#7573 pantsbuild#7572 pantsbuild#7554 pantsbuild#7547 pantsbuild#7457 pantsbuild#7168 pantsbuild#7149 pantsbuild#6838 pantsbuild#6829 pantsbuild#6787 pantsbuild#6114

[ci skip-jvm-tests]  # No JVM changes made.
jsirois added a commit that referenced this issue Mar 25, 2020
This brings our skip count up from 7 python and 2 rust to 25 python and
4 rust, hopefully in the name of stability as outlined in #9386.

Also updates the How to Contribute docs with a pointer to #9386 for
the latest procedure.

Includes flaky tests from:
 #9313 #9312 #8679 #8678 #8520 #8520 #8520 #8405 #8193 #8171 #7836 #7622
 #7573 #7572 #7554 #7547 #7457 #7168 #7149 #6838 #6829 #6787 #6114
@jsirois jsirois removed their assignment Mar 25, 2020
@Eric-Arellano
Copy link
Contributor

Test was removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants