### What happened?
After many days working, device is disconnected from broker …and when try to reconnect, it can.
Kicking out the connection from dashboard, removes connection, but connection appears again but as disconnected.
After many Kick Outs, client connect again.
### What did you expect to happen?
Keep connection, or at least, get in dashboard information about what's happened.
### How can we reproduce it (as minimally and precisely as possible)?
_No response_
### Anything else we need to know?
Reading logs, I've seen messages about `emqx_persistent_session_ds.erl`. Because I have enabled the durable sessions using the env variable `EMQX_DURABLE_SESSIONS__ENABLE=true`, I've disabled setting false to see if this is the origin, but for my surprise, it's still enabled, and I can't disable it now: logs shows `EMQX_DURABLE_SESSIONS__ENABLE [durable_sessions.enable]: false` at boot, but dashboard shows it's enabled.
I'm running the official 5.7.2 Docker container.
### EMQX version
<details>
```console
$ ./bin/emqx_ctl broker
sysdescr  : EMQX
version   : 5.7.2
datetime  : 2024-10-21T14:33:53.944611768+00:00
uptime    : 3 hours, 35 minutes, 18 seconds
```
</details>
### OS version
<details>
```console
# On Linux:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ uname -a
Linux myserver 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 GNU/Linux
```
</details>
### Log files
<details>
```console
2024-10-21 11:50:16.731	2024-10-21T09:50:16.731132+00:00 [error] supervisor: {esockd_connection_sup,<0.49605485.0>}, errorContext: connection_crashed, reason: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, offender: [{pid,<0.49605485.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{listener => {tcp,default},limiter => #{connection => #{initial => 0,rate => infinity,burst => 0}},zone => default,enable_authn => true}]}}]
2024-10-21 11:50:16.731	2024-10-21T09:50:16.730560+00:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.49605485.0>, registered_name: [], error: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, ancestors: [<0.3020.0>,<0.3019.0>,esockd_sup,<0.2570.0>], message_queue_len: 0, messages: [], links: [<0.3020.0>], dictionary: [{guid,{1729504216729628,276548698827629,1}},{incoming_bytes,85},{rand_seed,{#{type => exsss,next => #Fun<rand.0.65977474>,bits => 58,uniform => #Fun<rand.1.65977474>,uniform_n => #Fun<rand.2.65977474>,jump => #Fun<rand.3.65977474>},[244790123677088410|154998052449828585]}},{send_pkt,1},{'$logger_metadata$',#{peername => "192.168.0.123:37226",username => <<"clientX">>,clientid => <<"prisma@clientX">>}},{outgoing_bytes,24},{recv_pkt,1}], trap_exit: false, status: running, heap_size: 2586, stack_size: 28, reductions: 9598; neighbours:
2024-10-21 11:50:13.371	2024-10-21T09:50:13.369651+00:00 [error] supervisor: {esockd_connection_sup,<0.49605277.0>}, errorContext: connection_crashed, reason: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, offender: [{pid,<0.49605277.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{listener => {tcp,default},limiter => #{connection => #{initial => 0,rate => infinity,burst => 0}},zone => default,enable_authn => true}]}}]
2024-10-21 11:50:13.370	2024-10-21T09:50:13.367776+00:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.49605277.0>, registered_name: [], error: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, ancestors: [<0.3020.0>,<0.3019.0>,esockd_sup,<0.2570.0>], message_queue_len: 0, messages: [], links: [<0.3020.0>], dictionary: [{guid,{1729504213366256,276548698827421,1}},{incoming_bytes,85},{rand_seed,{#{type => exsss,next => #Fun<rand.0.65977474>,bits => 58,uniform => #Fun<rand.1.65977474>,uniform_n => #Fun<rand.2.65977474>,jump => #Fun<rand.3.65977474>},[113572621628665302|209806117163712901]}},{send_pkt,1},{'$logger_metadata$',#{peername => "192.168.0.123:37223",username => <<"clientX">>,clientid => <<"prisma@clientX">>}},{outgoing_bytes,24},{recv_pkt,1}], trap_exit: false, status: running, heap_size: 2586, stack_size: 28, reductions: 9598; neighbours:
2024-10-21 11:50:10.027	2024-10-21T09:50:10.026925+00:00 [error] supervisor: {esockd_connection_sup,<0.49605075.0>}, errorContext: connection_crashed, reason: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, offender: [{pid,<0.49605075.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{listener => {tcp,default},limiter => #{connection => #{initial => 0,rate => infinity,burst => 0}},zone => default,enable_authn => true}]}}]
2024-10-21 11:50:10.027	2024-10-21T09:50:10.026476+00:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.49605075.0>, registered_name: [], error: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, ancestors: [<0.3020.0>,<0.3019.0>,esockd_sup,<0.2570.0>], message_queue_len: 0, messages: [], links: [<0.3020.0>], dictionary: [{guid,{1729504210025528,276548698827219,1}},{incoming_bytes,85},{rand_seed,{#{type => exsss,next => #Fun<rand.0.65977474>,bits => 58,uniform => #Fun<rand.1.65977474>,uniform_n => #Fun<rand.2.65977474>,jump => #Fun<rand.3.65977474>},[18976567826371808|275345235622793423]}},{send_pkt,1},{'$logger_metadata$',#{peername => "192.168.0.123:37220",username => <<"clientX">>,clientid => <<"prisma@clientX">>}},{outgoing_bytes,24},{recv_pkt,1}], trap_exit: false, status: running, heap_size: 2586, stack_size: 28, reductions: 9601; neighbours:
2024-10-21 11:50:06.733	2024-10-21T09:50:06.731834+00:00 [error] supervisor: {esockd_connection_sup,<0.49604874.0>}, errorContext: connection_crashed, reason: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, offender: [{pid,<0.49604874.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{listener => {tcp,default},limiter => #{connection => #{initial => 0,rate => infinity,burst => 0}},zone => default,enable_authn => true}]}}]
2024-10-21 11:50:06.732	2024-10-21T09:50:06.729626+00:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.49604874.0>, registered_name: [], error: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, ancestors: [<0.3020.0>,<0.3019.0>,esockd_sup,<0.2570.0>], message_queue_len: 0, messages: [], links: [<0.3020.0>], dictionary: [{guid,{1729504206726076,276548698827018,1}},{incoming_bytes,85},{rand_seed,{#{type => exsss,next => #Fun<rand.0.65977474>,bits => 58,uniform => #Fun<rand.1.65977474>,uniform_n => #Fun<rand.2.65977474>,jump => #Fun<rand.3.65977474>},[74220660892271500|63696716518824218]}},{send_pkt,1},{'$logger_metadata$',#{peername => "192.168.0.123:37218",username => <<"clientX">>,clientid => <<"prisma@clientX">>}},{outgoing_bytes,24},{recv_pkt,1}], trap_exit: false, status: running, heap_size: 2586, stack_size: 28, reductions: 9635; neighbours:
2024-10-21 11:50:03.425	2024-10-21T09:50:03.423447+00:00 [error] supervisor: {esockd_connection_sup,<0.49604672.0>}, errorContext: connection_crashed, reason: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, offender: [{pid,<0.49604672.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{listener => {tcp,default},limiter => #{connection => #{initial => 0,rate => infinity,burst => 0}},zone => default,enable_authn => true}]}}]
2024-10-21 11:50:03.423	2024-10-21T09:50:03.421652+00:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.49604672.0>, registered_name: [], error: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, ancestors: [<0.3020.0>,<0.3019.0>,esockd_sup,<0.2570.0>], message_queue_len: 0, messages: [], links: [<0.3020.0>], dictionary: [{guid,{1729504203420264,276548698826816,1}},{incoming_bytes,85},{rand_seed,{#{type => exsss,next => #Fun<rand.0.65977474>,bits => 58,uniform => #Fun<rand.1.65977474>,uniform_n => #Fun<rand.2.65977474>,jump => #Fun<rand.3.65977474>},[259415790788519276|163759554314641238]}},{send_pkt,1},{'$logger_metadata$',#{peername => "192.168.0.123:37214",username => <<"clientX">>,clientid => <<"prisma@clientX">>}},{outgoing_bytes,24},{recv_pkt,1}], trap_exit: false, status: running, heap_size: 2586, stack_size: 28, reductions: 9631; neighbours:
2024-10-21 11:50:00.115	2024-10-21T09:50:00.115049+00:00 [error] supervisor: {esockd_connection_sup,<0.49604450.0>}, errorContext: connection_crashed, reason: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, offender: [{pid,<0.49604450.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{listener => {tcp,default},limiter => #{connection => #{initial => 0,rate => infinity,burst => 0}},zone => default,enable_authn => true}]}}]
2024-10-21 11:50:00.115	2024-10-21T09:50:00.114629+00:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.49604450.0>, registered_name: [], error: {{badmatch,undefined},[{emqx_persistent_session_ds,enqueue_batch,5,[{file,"emqx_persistent_session_ds.erl"},{line,986}]},{emqx_persistent_session_ds,new_batch,4,[{file,"emqx_persistent_session_ds.erl"},{line,947}]},{emqx_persistent_session_ds,fetch_new_messages,3,[{file,"emqx_persistent_session_ds.erl"},{line,933}]},{emqx_persistent_session_ds,handle_timeout,3,[{file,"emqx_persistent_session_ds.erl"},{line,560}]},{emqx_channel,handle_timeout,3,[{file,"emqx_channel.erl"},{line,1439}]},{emqx_connection,with_channel,3,[{file,"emqx_connection.erl"},{line,811}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,472}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,434}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,251}]}]}, ancestors: [<0.3020.0>,<0.3019.0>,esockd_sup,<0.2570.0>], message_queue_len: 0, messages: [], links: [<0.3020.0>], dictionary: [{guid,{1729504200113829,276548698826594,1}},{incoming_bytes,85},{rand_seed,{#{type => exsss,next => #Fun<rand.0.65977474>,bits => 58,uniform => #Fun<rand.1.65977474>,uniform_n => #Fun<rand.2.65977474>,jump => #Fun<rand.3.65977474>},[216262068242532747|75851512213166844]}},{send_pkt,1},{'$logger_metadata$',#{peername => "192.168.0.123:37211",username => <<"clientX">>,clientid => <<"prisma@clientX">>}},{outgoing_bytes,24},{recv_pkt,1}], trap_exit: false, status: running, heap_size: 4185, stack_size: 28, reductions: 9488; neighbours:
```
</details>