Commit fc091383 authored by Bernd Lietzow's avatar Bernd Lietzow 🐨

testing: add test for "empty udp packet" problem

(cherry picked from commit 668d92a272961d78e31e82b9f1b4ccf576070c51)
parent 2790927d
test_c = "send0byteUDP.c"
test_path = File.dirname(caller_locations(0, 1)[0].path)
test = test_path + "/" + test_c
on node do; tempdir do;
upload local: test
shell "g++ -std=gnu99 #{test_c}"
clientPort = node.properties["client"]["config"]["connClientPortUDP"]
shell "./a.out 127.0.0.1 #{clientPort}"
# give the thread some time to shut down
sleep 10
# the client does not terminate fully, only the datagram listener thread dies
shell "pidof beegfs_DGramLis"
wait_daemon_log(node, "helperd", "Received an empty datagram", 10)
end; end
name: "Empty UDP packet"
desc: "Check that server processes do not shut down when they receive a 0 byte UDP datagram."
xfail_msg: not yet fixed
hosts:
node:
- mgmtd
- meta
- storage
- helperd
- client:
name: client
config:
connClientPortUDP: 8504
test_c = "send0byteUDP.c"
test_path = File.dirname(caller_locations(0, 1)[0].path)
test = test_path + "/" + test_c
on node do; tempdir do;
upload local: test
shell "g++ -std=gnu99 #{test_c}"
mgmtPort = node.properties["mgmt"]["config"]["connMgmtdPortUDP"]
metaPort = node.properties["meta"]["config"]["connMetaPortUDP"]
storePort = node.properties["store"]["config"]["connStoragePortUDP"]
shell "./a.out 127.0.0.1 #{mgmtPort}"
shell "./a.out 127.0.0.1 #{metaPort}"
shell "./a.out 127.0.0.1 #{storePort}"
# give the servers some time to shut down
sleep 10
# ensure all the servers are still running
shell "pidof beegfs-mgmtd"
shell "pidof beegfs-meta"
shell "pidof beegfs-storage"
# check that they logged the empty packet
["mgmt", "meta", "store"].each do |service|
wait_daemon_log(node, service, "Received empty UDP datagram", 10)
end
end; end
name: "Empty UDP packet"
desc: "Check that server processes do not shut down when they receive a 0 byte UDP datagram."
xfail_msg: not yet fixed
hosts:
node:
- mgmtd:
name: mgmt
config:
# needs to be the standard port for the CTL to work
connMgmtdPortUDP: 8008
- meta:
name: meta
config:
connMgmtdPortUDP: 8008
connMetaPortUDP: 8505
- storage:
name: store
config:
connMgmtdPortUDP: 8008
connStoragePortUDP: 8503
- helperd
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
void die(char* s) {
perror(s);
exit(1);
}
int main(int argc, char** argv) {
struct sockaddr_in si_other;
const int slen = sizeof(si_other);
int sock;
int port;
char* host;
if (argc != 3) {
printf("Usage: %s ip port\n", argv[0]);
exit(1);
}
host = argv[1];
port = atoi(argv[2]);
if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
die("socket");
memset((char*)&si_other, 0, sizeof(si_other));
si_other.sin_family = AF_INET;
si_other.sin_port = htons(port);
if (inet_aton(host, &si_other.sin_addr) == 0) {
fprintf(stderr, "inet_aton\n");
exit(1);
}
if (sendto(sock, 0, 0, 0, (struct sockaddr*)&si_other, slen) == -1)
die("sendto");
close(sock);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment