Closed cisiqo closed 1 year ago
That would fix that problem, but that's not correct solution here. I think this is result of buggy client, looks like it start sending message, before it finishes session initialization (looks like it didn't send bind requests). Do you know what client is that?
That fix will only paperback this problem, but there will be problem later on, this session is not properly registered, so it for example can't receive messages from other client/services. Probably correct thing to do here would be closing that session with error.
We use a client developed by ourselves, and the android library uses the Smack.
The problem is that after xep-0198 ack_timeout
times out, xep-0198 will send the queued message again.
Hm, interesting, would you be able to capture session traffic when this happen, so i could see when we are receiving this? At this point session i think shouldn't be registered in session manager so it shouldn't even know where send those messages, so i wonder how those messages got there...
When the ack_timeout set by the xep-1098 module times out, the socket connection will be forcibly disconnected. At this point, the xep-0198 module will re-send the messages in the queue that are not acked through ejabberd_router:route
.
After the ack_timeout set by the xep-0198 module times out, the c2s_terminated
of mod_stream_mgmt
will be triggered, and then the method route_unacked_stanzas
will be executed to resend all messages in the queue. Then these messages are routed to the ejabberd_sm
module, and the route_message
method is executed. Since the current user socket is disconnected, the current resource is not online, and then the message is executed before the offline_message_hook
hook, you need to check the packet, and then The hook privacy_check_packet is triggered.
Sorry for a delay, it seems i missed your message.
So i still don't know how that is possible. We register session in database only after bind call (which would make sure there is jid field in state and there would not be stream_state => wait_for_bind
in it), so ejabberd_router:route() shouldn't be able to send anything to that process before that is called. Do you have some custom modules in your system that could affect this? Could you show modules sections from your config?
This is config https://gist.github.com/cisiqo/edb81ebc63db9be661f0ac2fd2019102 of my test ejabberd.
I don't use custom modules, the problem still occurs.
The configuration related to this problem is mod_stream_mgmt
.
There were some stream issues fixed in 22.05 or HEAD, did you test with these too?
@licaon-kter No.
@cisiqo then please do test :)
@licaon-kter OK, if I upgrade to this version or above.
Fix no match the socket. The error log: