Control: reassign -1 src:udptunnel

Hi Marcos!

On Mon, 10 Mar 2025 16:14:02 -0300 Marcos Talau <ta...@debian.org> wrote:
> Control: reassign 1094138 nmap
> 
> Hi there!
> 
> I ran the udptunnel test in a s390x testbed without udptunnel, I only used
> ncat, and sometimes, it fails.
> 
> I write some scripts [1] to help with the ncat tests. I ran for 100 times
> the script "test-ncat-udp-series.sh", resulting in 10k tests.
> [1] https://people.debian.org/~talau/tmp/test-ncat-udp
> 
> 10k tests (using "test-ncat-udp-series.sh") results in a porterbox s390x:
> - Fail: Avg: 3.01%, StdDev: 2.15636
> 
> 10k tests (using "test-ncat-udp-series.sh") results in a porterbox amd64:
> - Fail: Avg: 0.12%, StdDev: 0.381576
> 
> After the tests, I decided to make tests changing ncat client to socat client,
> scripts (test-ncat-udp_socat-client-series.sh, test-ncat-udp_socat-client.sh).
> Below the results:
> 
> 10k tests (using "test-ncat-udp_socat-client-series.sh") results in a
> porterbox s390x:
> - Fail: Avg: 0.0%, StdDev: 0
> 
> 10k tests (using "test-ncat-udp_socat-client-series.sh") results in a
> porterbox amd64:
> - Fail: Avg: 0.0%, StdDev: 0
> 
> Analyzing the results, it can be seen that communication using ncat-client and
> ncat-server presents failures. By changing ncat-client to socat, 
> communications
> no longer present failures. This indicates to me that ncat (in client mode) 
> has
> some bug.

I cannot confirm you findings. In a VM on my local amd64 machine I see
or don't see failures depending on the number of virtual CPUs when
running either of your scripts. I also noticed that one cycle of test-
ncat-udp_socat-client-series.sh takes more time, about 150%, than a
cycle of test-ncat-udp-series.sh. That makes me assume that socat
mitigates the problem in certain environments by spending more time
internally.

The measure which solves the issue for me is to insert a short delay
after 'transmit_upd_data'. This seems reasonable as one should not
expect data can be sent, received and written to a file in almost no
time. Here's what I changed in both of your scripts:

$ diff -u3 orig/test-ncat-udp_socat-client.sh  test-ncat-udp_socat-client.sh 
--- orig/test-ncat-udp_socat-client.sh  2025-03-10 14:06:55.000000000 +0000
+++ test-ncat-udp_socat-client.sh       2025-03-23 22:07:14.223161539 +0000
@@ -63,6 +63,7 @@
 
 test_communication() {
     transmit_udp_data
+    sleep 0.05
 
     if ! received_udp_data; then
         echo "ncat UDP communication failed"

$ diff -u3 orig/test-ncat-udp.sh  test-ncat-udp.sh 
--- orig/test-ncat-udp.sh       2025-03-10 14:06:56.000000000 +0000
+++ test-ncat-udp.sh    2025-03-23 22:07:22.827289754 +0000
@@ -63,6 +63,7 @@
 
 test_communication() {
     transmit_udp_data
+    sleep 0.05
 
     if ! received_udp_data; then
         echo "ncat UDP communication failed"


With these changes applied transmission failures vanish in my setup. I
suggest you try this in your environment(s), potentially with an
increased delay.

Cheers,
Sven

-- 
GPG Fingerprint
3DF5 E8AA 43FC 9FDF D086 F195 ADF5 0EDA F8AD D585

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to