#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
This is a proposed evolution that adds socket timestamping of received UDP packets (using SO_TIMESTAMPNS).
It computes the delay between this timestamp and the time at which the packet is read by Kamailio.
This can then be accessed using pv "$TV(RD)" (RD for "receive relay").
Rationale :
The Kamailio server is handling traffic that is irregular and can temporarily spike to a point where all children are still busy when new packets are incoming on the network interface.
Consequently, these packets have to wait until a worker is available. The client will see a higher response time, that currently cannot be monitored by Kamailio itself.
This evolution allows to make this wait time observable by Kamailio, allowing to log or write the information to CDR for example.
If this is possible, I'd like to merge this feature in Kamailio.
Of course, I'm ready to discuss the PR and make any necessary changes.
All comments and reviews are most welcome.
I've tested this locally on Linux (3.10.0-957.10.1.el7.x86_64) with the latest Kamailio master as of 2023/03/23.
Thanks!
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3404
-- Commit Summary --
* core: add socket timestamp of received packets and keep track of receive delay
* pv: add $TV(RD) to get the new information "receive delay"
-- File Changes --
M src/core/ip_addr.h (1)
M src/core/parser/msg_parser.h (1)
M src/core/receive.c (8)
M src/core/udp_server.c (60)
M src/core/ut.h (34)
M src/modules/pv/pv_time.c (15)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3404.patchhttps://github.com/kamailio/kamailio/pull/3404.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3404
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3404(a)github.com>
Module: kamailio
Branch: master
Commit: 34edbfa0194ba29e0e671551d44df3710beb93b6
URL: https://github.com/kamailio/kamailio/commit/34edbfa0194ba29e0e671551d44df37…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-11-20T10:18:58+01:00
core: tcp_main - remove old comments
---
Modified: src/core/tcp_main.c
---
Diff: https://github.com/kamailio/kamailio/commit/34edbfa0194ba29e0e671551d44df37…
Patch: https://github.com/kamailio/kamailio/commit/34edbfa0194ba29e0e671551d44df37…
---
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 00a1796ec5a..855b2d80617 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -4373,7 +4373,6 @@ inline static int send2child(struct tcp_connection *tcpconn)
tcpconn->s)
<= 0)) {
if((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
- /* FIXME: remove after debugging */
LM_CRIT("tcp child %d, socket %d: queue full, %d requests queued "
"(total handled %d)\n",
idx, tcp_children[idx].unix_sock, min_busy,
@@ -4556,23 +4555,7 @@ inline static int handle_tcpconn_ev(
int empty_q;
int bytes;
#endif /* TCP_ASYNC */
- /* is refcnt!=0 really necessary?
- * No, in fact it's a bug: I can have the following situation: a send only
- * tcp connection used by n processes simultaneously => refcnt = n. In
- * the same time I can have a read event and this situation is perfectly
- * valid. -- andrei
- */
-#if 0
- if ((tcpconn->refcnt!=0)){
- /* FIXME: might be valid for sigio_rt iff fd flags are not cleared
- * (there is a short window in which it could generate a sig
- * that would be caught by tcp_main) */
- LM_CRIT("handle_tcpconn_ev: io event on referenced"
- " tcpconn (%p), refcnt=%d, fd=%d\n",
- tcpconn, tcpconn->refcnt, tcpconn->s);
- return -1;
- }
-#endif
+
/* pass it to child, so remove it from the io watch list and the local
* timer */
#ifdef TCP_ASYNC
@@ -4627,7 +4610,7 @@ inline static int handle_tcpconn_ev(
(void)dst_blocklist_su(BLST_ERR_SEND, tcpconn->rcv.proto,
&tcpconn->rcv.src_su, &tcpconn->send_flags, 0);
#endif /* USE_DST_BLOCKLIST */
- TCP_STATS_CON_RESET(); /* FIXME: it could != RST */
+ TCP_STATS_CON_RESET(); /* note: it could != RST */
}
}
if(unlikely(!tcpconn_try_unhash(tcpconn))) {