Socket Mode: reconnects behind NAT leak server-side connection registrations → too_many_websockets cap → silent loss of interactive payloads; mitigation proposals
Mantenedores costumam responder em até 5 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Ativa
- Stack de tecnologia
- python
- Domínio
- backend, networking
Direção de pesquisa
Comece rastreando run_message_listeners e SocketModeRequest.from_dict, concentrando-se em como os metadados de hello e os motivos de desconexão são tratados antes que os listeners de mensagens recebam frames. Reproduza o comportamento de reconexão, se possível, e então defina diagnósticos que exponham a contagem de conexões no lado do servidor e os motivos com clareza suficiente para alertar sobre um pool não saudável.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Slack SDK version: slack-sdk 3.43.0, slack-bolt 1.29.0
Python: 3.13 (aiohttp Socket Mode client)
OS/platform: Linux container (Docker) on macOS host, behind NAT
Summary
This is part bug report, part mitigation proposal, backed by wire-level data.
When SocketModeClient reconnects while the network path is degraded (half-open
TCP: the close frame never reaches Slack), the old connection remains registered
server-side for an extended period. Repeated reconnects therefore accumulate
"ghost" registrations up to Slack's 10-connection cap (disconnect: too_many_websockets). Slack then delivers envelopes across all registered
connections, so most interactive (block_actions) payloads — which unlike
events are not retried on non-ack — are silently lost. From the app's
perspective the client looks perfectly healthy: ping/pong fine, events flowing.
Wire evidence
(from a run_message_listeners wrapper logging hello and disconnect frames)
- fresh start:
helloreportsnum_connections=1 - ~1.5 h later, on a reconnect: 3x
disconnect reason=too_many_websockets,
thenhello num_connections=10— while the process verifiably held ONE
established TCP connection to Slack the whole time - ghost registrations age out at roughly one per 30-45 minutes
- while
num_connectionsis high, most button clicks never arrive on any
connection we hold; with a clean pool, every click arrives (tested across
message sizes 0.5-5 KB — size is irrelevant) - reproduced on a SECOND app in the same workspace: first
helloafter a
process restart reportednum_connections=7for an app that also runs as a
single instance - observed
approximate_connection_time(insidehello.debug_info) is
consistently18060(~5 h), which sets the ghost age-out horizon
Why this is hard to see with the current SDK
- The
helloenvelope (carryingnum_connections) never reaches
message_listeners—SocketModeRequest.from_dictrequires
type+envelope_id+payload, so apps cannot observe the most important signal
without wrapping internals. disconnectframes (includingtoo_many_websockets) are handled by
run_message_listenersbefore the listener loop and only visible at debug
logging.- A degraded connection still passes
is_connected()/ ping-pong checks, so
client-side health monitoring cannot detect the server-side pool state.
Proposals (any subset would help)
- Surface
hellometadata (num_connections,approximate_connection_time,
host) anddisconnectreasons via a public callback or at INFO logging. - Emit a loud warning when
num_connectionsinhelloexceeds a threshold
(e.g., 4) while the client manages fewer connections — this is direct
evidence of ghost registrations and imminent interactive-payload loss. - Consider make-before-break reconnects with close-confirmation, or documenting
that reconnect-heavy operation behind NAT can poison the server-side pool. - Still-open PRs #1914 / #1926 address orphaned client-side sessions in the
same failure family — this issue is their server-side counterpart, and since
neither is merged/released (latest release is 3.43.0), apps currently have no
upstream remedy at all; that raises the priority of surfacing the diagnostics
from proposals 1-2.
Happy to share full logs and reproduction notes. We have also filed a parallel
report with Slack developer support regarding the server-side routing/eviction
behavior; will cross-link.
- Linguagem predominante
- Python
- Estrelas
- 4k
- Forks
- 861
- Merge médio
- 3d 17h
- PRs com merge (30d)
- 10
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de slackapi/python-slack-sdk
-
Missing method from SDK // admin.users.getExpirationTalvez já em andamento @srtaalej assumiu há 3 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
slackapi/python-slack-sdk#1982 · 1 comentário ·
Mantenedores costumam responder em até 5 dias
-
auto-triage-stale needs info server-side-issue
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
slackapi/python-slack-sdk#1961 · 4 comentários ·
Mantenedores costumam responder em até 5 dias
-
chat_postMessage silently forwards thread_id to the API, so a threaded reply posts to the channelAbertaauto-triage-skip enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
slackapi/python-slack-sdk#1923 · 2 comentários ·
Mantenedores costumam responder em até 5 dias
-
files_upload_v2 should respect the retry handlersTalvez já em andamento @DSeaStar assumiu há 59 dias. Abertaauto-triage-skip bug python web-client
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 52/100
slackapi/python-slack-sdk#1853 · 2 comentários ·
Mantenedores costumam responder em até 5 dias
-
auto-triage-skip bug server-side-issue
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
slackapi/python-slack-sdk#1847 · 5 comentários ·
Mantenedores costumam responder em até 5 dias
Todas as issues de slackapi/python-slack-sdk
Issues semelhantes
-
enhancement from-review
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
khuisman/mcp-gee-sweet#1010 ·
Mantenedores costumam responder em até 1 dia
-
bug confirmed issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
open-webui/open-webui#32333 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ll7/robot_sf_ll7#10368 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
-
mcp: a write that loses its answer is reported as "cannot reach", although it may have landedAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
flop-labs/technocore-chat#982 ·
Mantenedores costumam responder em até 1 dia