Skip to content

[hotfix] Increase dtlsConnectTimeout to 5 minutes - #77

Merged
mprymek merged 2 commits into
mainfrom
dtls-timeout
Sep 20, 2025
Merged

[hotfix] Increase dtlsConnectTimeout to 5 minutes#77
mprymek merged 2 commits into
mainfrom
dtls-timeout

Conversation

@mprymek

@mprymek mprymek commented Sep 20, 2025

Copy link
Copy Markdown
Contributor

I'm increasing the DTLS handshake timeout as a supposed ugly hotfix to a
bug in the DTLS handshake we are experiencing in production. We will
investigate the problem further and solve it better in subsequent
commits.

We are experiencing a connect timeout in production:

[ERROR][gw] Client TLS handshake error: handshake error: context
deadline exceeded

This probably leads to some strange condition where the listener is not
able to accept further connections. Error we get:

[ERROR][gw] Client TLS handshake error: handshake error: write udp
[::]:8883->10.0.0.2:31103: sendto: operation not permitted

This could be somehow related to pion/dtls's handshakes serialization:

Before /v2 Pion DTLS would handshake on Server or Client creation. This
design caused the Accept implementation to be blocking. A new connection
couldn't be accept until the previous one had finished.

but we have not investigated this yet.

Summary by CodeRabbit

  • Bug Fixes

    • Reduced premature DTLS connection failures by increasing the connection establishment timeout, improving reliability in slower networks.
  • Chores

    • Bumped version to 0.9.1.

I'm increasing the DTLS handshake timeout as a supposed ugly hotfix to a
bug in the DTLS handshake we are experiencing in production. We will
investigate the problem further and solve it better in subsequent
commits.

We are experiencing a connect timeout in production:

```
[ERROR][gw] Client TLS handshake error: handshake error: context
deadline exceeded
```

This probably leads to some strange condition where the listener is not
able to accept further connections. Error we get:

```
[ERROR][gw] Client TLS handshake error: handshake error: write udp
[::]:8883->10.0.0.2:31103: sendto: operation not permitted
```

This could be somehow related to `pion/dtls`'s handshakes serialization:

```
Before /v2 Pion DTLS would handshake on Server or Client creation. This
design caused the Accept implementation to be blocking. A new connection
couldn't be accept until the previous one had finished.
```

but we have not investigated this yet.
@coderabbitai

coderabbitai Bot commented Sep 20, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Increased an internal DTLS connection timeout from 30s to 300s in the gateway component. Updated the project version from 0.9.0 to 0.9.1. No public APIs or control flow were modified.

Changes

Cohort / File(s) Summary of Changes
Gateway DTLS timeout
gateway/gateway.go
Increased unexported dtlsConnectTimeout from 30s to 300s; no other logic changes.
Version bump
version.txt
Updated version string from 0.9.0 to 0.9.1.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I thump my paws: a timeout grows,
From thirty ticks to five-minute flows.
A hop to nine-one—version light,
The gateway waits a longer night.
Carrot logs green, builds are bright—
Onward we bound, connections tight! 🥕🐇

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dtls-timeout

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 1953e14 and fa6ae19.

📒 Files selected for processing (2)
  • gateway/gateway.go (1 hunks)
  • version.txt (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mprymek
mprymek merged commit b16e992 into main Sep 20, 2025
0 of 8 checks passed
@mprymek
mprymek deleted the dtls-timeout branch September 20, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant