Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 18001cd1 authored by Alessio Netti's avatar Alessio Netti
Browse files

dcdbslurmjob: re-opening STDIN/STDOUT/STDERR if closed

- This prevents libuv from crashing dcdbslurmjob when the Cassandra
insertion mode is being used
parent 4f0cd26e
......@@ -37,6 +37,8 @@
#include <mosquitto.h>
#include "dcdb/version.h"
#include "version.h"
#include "fcntl.h"
#include "unistd.h"
#define SLURM_JOBSTEP_SEP "."
......@@ -54,6 +56,20 @@ void publishCallback(struct mosquitto *mosq, void *obj, int mid) {
done = true;
}
// Re-opens STDIN, STDOUT or STDERR to /dev/null if they are closed.
// Prevents libuv from making dcdbslurmjob crash when using Cassandra.
void fixFileDescriptors() {
std::string stdArr[3] = {"STDIN", "STDOUT", "STDERR"};
int fd = -1;
for(int idx=0; idx<=2; idx++) {
if(fcntl(idx, F_GETFD) < 0) {
std::cerr << "Warning: detected closed " << stdArr[idx] << " channel. Fixing..." << std::endl;
if((fd=open("/dev/null", O_RDWR)) < 0 || dup2(fd, idx) < 0) {
std::cerr << "Error: cannot re-open " << stdArr[idx] << " channel." << std::endl;
}
}
}
}
/*
* Print usage information
......@@ -347,6 +363,7 @@ int main(int argc, char** argv) {
// Initialize transport
if (cassandra) {
fixFileDescriptors();
// Allocate and initialize connection to Cassandra.
pickRandomHost(hostList, host, port);
if (port == 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