Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Correctly retry replication HTTP requests on timeout #8412

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8412.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix retries of HTTP requests between Synapse workers when the requests time out.
1 change: 1 addition & 0 deletions synapse/config/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ from synapse.config import (
workers,
)


class ConfigError(Exception): ...

MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS: str
Expand Down
5 changes: 4 additions & 1 deletion synapse/replication/http/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import abc
import logging
import re
Expand All @@ -26,6 +25,7 @@
RequestSendFailed,
SynapseError,
)
from synapse.http import RequestTimedOutError
from synapse.logging.opentracing import inject_active_span_byte_dict, trace
from synapse.util.caches.response_cache import ResponseCache
from synapse.util.stringutils import random_string
Expand Down Expand Up @@ -196,6 +196,9 @@ async def send_request(instance_name="master", **kwargs):
except CodeMessageException as e:
if e.code != 504 or not cls.RETRY_ON_TIMEOUT:
raise
except RequestTimedOutError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RequestTimedOutError is a CodeMessageException, so this won't get hit (and is redundant)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah, I'm getting confused with how the federation client works :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

if not cls.RETRY_ON_TIMEOUT:
raise

logger.warning("%s request timed out", cls.NAME)

Expand Down