Got 403 FORBIDDEN when posting resultset to treeherder API



3 years ago
2 years ago


(Reporter: shinglyu, Unassigned)





3 years ago
When I attempted to push data to with this script (, I got a 403 forbidden. 

The client ID is "servo". 

This error starts at my May 16 01:05:50 (GMT+8) build. The previous build (May 14) was fine.

Is there any security policy update to the server or is my client secret invalidated? 

Full error message:
(venv) vagrant@vagrant-ubuntu-trusty-64:~/buildbot/slave/runtests/build/servo-perf$ python output/perf-1463503799.json  servo/revision.json 
[DEBUG] performance data:
{'performance_data': {'framework': {'name': 'servo-perf'}, 'suites': [{'subtests': [{'name': u'', 'value': 3700}, {'name': u'', 'value': 4893}, {'name': u'', 'value': 1433}, {'name': u'', 'value': 1006}, {'name': u'', 'value': 2623}, {'name': u'', 'value': 462}, {'name': u'', 'value': 5801}, {'name': u'', 'value': 1789}, {'name': u'', 'value': 602}, {'name': u'', 'value': 7069}, {'name': u'', 'value': 859}, {'name': u'', 'value': 1337}, {'name': u'', 'value': 2442}, {'name': u'', 'value': 3659}, {'name': u'', 'value': 1851}, {'name': u'', 'value': 3086}, {'name': u'', 'value': 1664}, {'name': u'', 'value': 6923}, {'name': u'', 'value': 2195}, {'name': u'', 'value': 3923}, {'name': u'', 'value': 3038}, {'name': u'', 'value': 2531}, {'name': u'', 'value': 855}, {'name': u'', 'value': 3510.0}, {'name': u'', 'value': 2287}, {'name': u'', 'value': 3468}, {'name': u'', 'value': 1565}], 'name': 'domComplete', 'value': 2222.8695297694426}]}}
/home/vagrant/buildbot/venv/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see
/home/vagrant/buildbot/venv/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see
No handlers could be found for logger "thclient.client"
Traceback (most recent call last):
  File "", line 322, in <module>
  File "", line 317, in main
    submit(perf_data, revision)
  File "", line 293, in submit
    client.post_collection('servo', trsc)
  File "/home/vagrant/buildbot/venv/local/lib/python2.7/site-packages/thclient/", line 929, in post_collection
    collection_inst.get_collection_data(), timeout)
  File "/home/vagrant/buildbot/venv/local/lib/python2.7/site-packages/thclient/", line 712, in _post_json
  File "/home/vagrant/buildbot/venv/local/lib/python2.7/site-packages/requests/", line 844, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: FORBIDDEN for url:

Comment 1

3 years ago
@wlach: Sorry to bother you again.
Flags: needinfo?(wlachance)

Comment 2

3 years ago
Looking at the logs our side I see:

[2016-05-18 00:01:14,361] ERROR [treeherder.webapp.api.exceptions:25] Traceback (most recent call last):
  File "/data/www/", line 454, in dispatch
    self.initial(request, *args, **kwargs)
  File "/data/www/", line 376, in initial
  File "/data/www/", line 310, in perform_authentication
  File "/data/www/", line 353, in __getattribute__
    return super(Request, self).__getattribute__(attr)
  File "/data/www/", line 193, in user
  File "/data/www/", line 316, in _authenticate
    user_auth_tuple = authenticator.authenticate(self)
  File "/data/www/", line 90, in authenticate
    raise AuthenticationFailed(msg)
AuthenticationFailed: Hawk authentication failed: The token has expired. Is your system clock correct?

The string "Hawk authentication failed: The token has expired. Is your system clock correct?" would have been shown in your logs, however it looks like you don't have logging set up:
`No handlers could be found for logger "thclient.client"`
(see eg

Bug 1229025 is filed to add some logging tips to the docs, but for now add something like this to

import logging


# ...

As for the root cause:
"Note: The system clock on the machines making submissions must be correct (or more specifically, within 60 seconds of the Treeherder server time), otherwise authentication will fail."
Flags: needinfo?(wlachance)

Comment 3

3 years ago
Ah it's 9 mins out:

[2016-05-18 00:01:14,361] WARNING [hawkrest:81] access denied: TokenExpired: token with UTC timestamp 1463554379 has expired; it was compared to 1463554874


3 years ago
Flags: needinfo?(slyu)

Comment 4

3 years ago
Geee! Let me sync my PC's time.
Flags: needinfo?(slyu)

Comment 5

2 years ago
A reminder about logging is being added to the docs in:
Last Resolved: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.