|
@@ -22,6 +22,7 @@
|
|
#include "jhash.hpp"
|
|
#include "jhash.hpp"
|
|
#include "jmisc.hpp"
|
|
#include "jmisc.hpp"
|
|
#include "jexcept.hpp"
|
|
#include "jexcept.hpp"
|
|
|
|
+#include "jfile.hpp"
|
|
#include "jmutex.hpp"
|
|
#include "jmutex.hpp"
|
|
#include "jtime.hpp"
|
|
#include "jtime.hpp"
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
@@ -2456,8 +2457,10 @@ public:
|
|
fclose(netfp);
|
|
fclose(netfp);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ bool firstTime = false;
|
|
if (!columnNames.length())
|
|
if (!columnNames.length())
|
|
{
|
|
{
|
|
|
|
+ firstTime = true;
|
|
columnNames.appendList(ln, " ");
|
|
columnNames.appendList(ln, " ");
|
|
ForEachItemInRev(idx, columnNames)
|
|
ForEachItemInRev(idx, columnNames)
|
|
{
|
|
{
|
|
@@ -2510,12 +2513,14 @@ public:
|
|
}
|
|
}
|
|
if (queue > ret->rx_queue)
|
|
if (queue > ret->rx_queue)
|
|
{
|
|
{
|
|
- DBGLOG("UDP queue: new max rx_queue: port %d rx_queue=%u drops=%u", port, queue, drops);
|
|
|
|
|
|
+ if (!firstTime)
|
|
|
|
+ DBGLOG("UDP queue: new max rx_queue: port %d rx_queue=%u drops=%u", port, queue, drops);
|
|
ret->rx_queue = queue;
|
|
ret->rx_queue = queue;
|
|
}
|
|
}
|
|
if (drops > ret->drops)
|
|
if (drops > ret->drops)
|
|
{
|
|
{
|
|
- LOG(MCoperatorError, unknownJob, "DROPPED UDP PACKETS: port %d rx_queue=%u (peak %u) drops=%u (total %i)", port, queue, ret->rx_queue, drops-ret->drops, drops);
|
|
|
|
|
|
+ if (!firstTime)
|
|
|
|
+ LOG(MCoperatorError, unknownJob, "DROPPED UDP PACKETS: port %d rx_queue=%u (peak %u) drops=%u (total %i)", port, queue, ret->rx_queue, drops-ret->drops, drops);
|
|
ret->drops = drops;
|
|
ret->drops = drops;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -4019,3 +4024,74 @@ jlib_decl IUserMetric *createUserMetric(const char *name, const char *matchStrin
|
|
{
|
|
{
|
|
return new UserMetricMsgHandler(name, matchString);
|
|
return new UserMetricMsgHandler(name, matchString);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+jlib_decl bool printProcessHandles(pid_t pid)
|
|
|
|
+{
|
|
|
|
+#if defined(__linux__)
|
|
|
|
+ StringBuffer curFilePathSB("/proc/");
|
|
|
|
+ if (pid)
|
|
|
|
+ curFilePathSB.append(pid);
|
|
|
|
+ else
|
|
|
|
+ curFilePathSB.append("self");
|
|
|
|
+ curFilePathSB.append("/fd/");
|
|
|
|
+ size32_t tailPos = curFilePathSB.length();
|
|
|
|
+
|
|
|
|
+ Owned<IFile> fdDir = createIFile(curFilePathSB);
|
|
|
|
+ if (!fdDir)
|
|
|
|
+ {
|
|
|
|
+ WARNLOG("Failed to create IFile for %s", curFilePathSB.str());
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ Owned<IDirectoryIterator> dirIter = fdDir->directoryFiles();
|
|
|
|
+ StringBuffer linkedFileNameSB, curFileNameSB;
|
|
|
|
+ char *linkedFileName = linkedFileNameSB.reserveTruncate(PATH_MAX);
|
|
|
|
+ ForEach(*dirIter)
|
|
|
|
+ {
|
|
|
|
+ dirIter->getName(curFileNameSB.clear());
|
|
|
|
+ curFilePathSB.setLength(tailPos);
|
|
|
|
+ curFilePathSB.append(curFileNameSB);
|
|
|
|
+ struct stat st;
|
|
|
|
+ int err = lstat(curFilePathSB, &st);
|
|
|
|
+ if (0 == err)
|
|
|
|
+ {
|
|
|
|
+ ssize_t sz = readlink(curFilePathSB, linkedFileName, PATH_MAX-1);
|
|
|
|
+ if (-1 != sz)
|
|
|
|
+ {
|
|
|
|
+ linkedFileNameSB.setLength(sz);
|
|
|
|
+ DBGLOG("%s -> %s", curFileNameSB.str(), linkedFileNameSB.str());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Owned<IException> e = makeErrnoExceptionV(errno, "Failed: err=%d", err);
|
|
|
|
+ EXCLOG(e, nullptr);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#else
|
|
|
|
+// JCSMORE - other OS implementations
|
|
|
|
+#endif
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+jlib_decl bool printLsOf(pid_t pid)
|
|
|
|
+{
|
|
|
|
+#if defined(__linux__)
|
|
|
|
+ if (!pid)
|
|
|
|
+ pid = getpid();
|
|
|
|
+ // Use lsof to output handles of files and sockets
|
|
|
|
+ VStringBuffer cmd("lsof -n -P -d '^mem,^rtd,^txt,^cwd' -f -a -p %u", pid);
|
|
|
|
+ Owned<IPipeProcess> pipe = createPipeProcess();
|
|
|
|
+ if (!pipe->run("lsof", cmd, nullptr, false, true, false, 0, true))
|
|
|
|
+ return false;
|
|
|
|
+ Owned<ISimpleReadStream> stream = pipe->getOutputStream();
|
|
|
|
+ Owned<IStreamLineReader> lineReader = createLineReader(stream, false);
|
|
|
|
+ StringBuffer line;
|
|
|
|
+ while (!lineReader->readLine(line.clear()))
|
|
|
|
+ DBGLOG("%s", line.str());
|
|
|
|
+
|
|
|
|
+#else
|
|
|
|
+// JCSMORE - other OS implementations
|
|
|
|
+#endif
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|