Open vanipolnedi opened 4 years ago
Could you provide more details about this problem? What PDU are you sending that comes out as invalid?
When you use sess.Send()
there is no logic that would trigger session shutdown. This can only happen if the receiving side decided to close it. For example they can send unbind response or they closed the tcp connection due to failure on their side. So your PDU could be valid but they could crash because of it and session will be closed because tcp was broken. We can't return resp, err
in that situation.
we are getting Invalid PDU error while decode in serve function (below code in session.go):
`
h, p, err := sess.dec.Decode()
if err != nil {
if err == io.EOF {
sess.conf.Logger.InfoF("decoding pdu: %s %+v", sess, err)
} else {
sess.conf.Logger.ErrorF("decoding pdu: %s %+v", sess, err)
}
sess.shutdown()
return
}`
Internal logs :
2020/02/08 18:58:07 INFO: received request: (SMSC:test:39362819-31AB-8C20) BindTransmitterID&{SystemID:test Password:test SystemType:SMPP InterfaceVersion:52 AddrTon:1 AddrNpi:1 AddressRange:}
2020/02/08 18:58:12 INFO: sent response: (SMSC:test:39362819-31AB-8C20) BindTransmitterRespID &{SystemID:test Options:
Decoding errors are caused by malformed byte sequence. If bytes are malformed in one decoding loop continuing session means that you will be dealing with unpredictable input from that point forward.
For example the error that you are getting is telling you that PDU header is set to the length that is considered to be too long and this behaviour is invalid according to the SMPP specs. Decoding errors are unrecoverable because we no longer can be sure what we are reading from the wire so we have to restart the session. Otherwise we will just be going in the loop and decode invalid PDUs and it will turn into an uncontrollable mess.
There are recoverable errors, like PDUs received in invalid session state, which doesn't result in closed session.
If the sender is not behaving properly you have to solve this with them. If you are sure they are sending proper PDU then please provide byte sequence so we can debug potential problems with decoding. But I don't think this is the reason to change the behaviour of the session.
If client sends invalid PDU, is it possible to notify that client has sent invalid PDU (like sending generic_nack PDU to client ) and then close session ??
Hi, when a message with invalid PDU is submitted, session is shutting down but we want resp,err to be returned without session shutdown. How to handle it??
Thanks in advance