Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
79b3cf3e
Commit
79b3cf3e
authored
7 years ago
by
Richard van der Hoff
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix logcontxt leak in keyclient (#2465)
preserve_context_over_function doesn't do what you want it to do.
parent
f65e31d2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/crypto/keyclient.py
+5
-12
5 additions, 12 deletions
synapse/crypto/keyclient.py
with
5 additions
and
12 deletions
synapse/crypto/keyclient.py
+
5
−
12
View file @
79b3cf3e
...
...
@@ -13,14 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
synapse.util
import
logcontext
from
twisted.web.http
import
HTTPClient
from
twisted.internet.protocol
import
Factory
from
twisted.internet
import
defer
,
reactor
from
synapse.http.endpoint
import
matrix_federation_endpoint
from
synapse.util.logcontext
import
(
preserve_context_over_fn
,
preserve_context_over_deferred
)
import
simplejson
as
json
import
logging
...
...
@@ -43,14 +40,10 @@ def fetch_server_key(server_name, ssl_context_factory, path=KEY_API_V1):
for
i
in
range
(
5
):
try
:
protocol
=
yield
preserve_context_over_fn
(
endpoint
.
connect
,
factory
)
server_response
,
server_certificate
=
yield
preserve_context_over_deferred
(
protocol
.
remote_key
)
defer
.
returnValue
((
server_response
,
server_certificate
))
return
with
logcontext
.
PreserveLoggingContext
():
protocol
=
yield
endpoint
.
connect
(
factory
)
server_response
,
server_certificate
=
yield
protocol
.
remote_key
defer
.
returnValue
((
server_response
,
server_certificate
))
except
SynapseKeyClientError
as
e
:
logger
.
exception
(
"
Error getting key for %r
"
%
(
server_name
,))
if
e
.
status
.
startswith
(
"
4
"
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment