processone / processone/ejabberd

Room messages not received on reconnection after app swipes out

Open
#3,919 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Note:Cannot reproduce
Dominant language
Erlang
Stars
6.7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Environment

  • ejabberd version: 22.05 or 21.12
  • Erlang version: Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.6.4
  • OS: Linux (Ubuntu)
  • Installed from: source

Bug description

Pre-condition:

Alice is connected and subscribed to room X
Bob is connected and subscribed to room X
Alice and Bob can successfully exchange room messages on their mobile devices (Android)

Scenario:

1. Bob swipes out its app

ejabberd realises client's connection dropped:

2022-10-20 13:26:42.913919+00:00 [debug] Running hook c2s_closed: mod_stream_mgmt:c2s_closed/2
2022-10-20 13:26:42.914344+00:00 [info] (tls|<0.595.0>) Closing c2s connection for 001@192.168.1.28/MDAxQHRlc3Q=: Connection failed: connection closed; waiting 30 seconds for stream resumption

2. Alice sends a message to room X

3. Bob re-connects to the server WITHIN the resumption timeout

ejabberd logs:
2022-10-20 13:33:27.846812+00:00 [info] (<0.585.0>) Accepted connection hidden_by_ejabberd -> [::ffff:182.3.2.17]:5222
2022-10-20 13:33:27.894433+00:00 [info] (tls|<0.585.0>) Accepted c2s PLAIN authentication for 001@192.168.1.28 by external backend from hidden_by_ejabberd
2022-10-20 13:33:27.915918+00:00 [info] (tls|<0.585.0>) Opened c2s session for 001@192.168.1.28/MDAxQHRlc3Q=
2022-10-20 13:33:27.919572+00:00 [info] (unknown) Closing c2s session for 001@192.168.1.28/MDAxQHRlc3Q=: Stream closed by local host: Replaced by new connection (conflict)

Problem:

4. Bob doesn't receive the message sent by Alice in step 2

Expected behaviour:

Bob receives the message sent by Alice

Note that:

  • if Bob after step 4, disconnects and reconnects to the server, he WILL receive the expected message.
  • if Alice send the message AFTER the resumption timeout, Bob will receive the message at the first re-connection in step 3
  • the issue doesn't seem to be reproducible with ejabberd 19.02
  • the issue doesn't seem to be reproducible if client disables stream resumption

Have you ever experienced something similar ?

Thanks
Nakkore

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing mod_stream_mgmt:c2s_closed/2 and the stream-resumption path involved after the Android client is swiped out. Reproduce the stated room-message and reconnection sequence within the resumption timeout, then verify that Bob receives Alice's message on the first reconnection while stream resumption remains enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.