mirror of
https://github.com/lubosz/overte.git
synced 2025-04-15 19:47:38 +02:00
Use max of --max & --n for resources; other clean-up
This commit is contained in:
parent
7181c3ad48
commit
06d1602c0d
1 changed files with 6 additions and 2 deletions
|
@ -74,7 +74,7 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
|
|||
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
|
||||
packetReceiver.registerListener(PacketType::AssignmentClientStatus, this, "handleChildStatusPacket");
|
||||
|
||||
adjustOsResources(_numAssignmentClientForks);
|
||||
adjustOsResources(std::max(_numAssignmentClientForks, _maxAssignmentClientForks));
|
||||
// use QProcess to fork off a process for each of the child assignment clients
|
||||
for (unsigned int i = 0; i < _numAssignmentClientForks; i++) {
|
||||
spawnChildClient();
|
||||
|
@ -380,7 +380,8 @@ bool AssignmentClientMonitor::handleHTTPRequest(HTTPConnection* connection, cons
|
|||
void AssignmentClientMonitor::adjustOsResources(unsigned int numForks) const
|
||||
{
|
||||
#ifdef _POSIX_SOURCE
|
||||
// QProcess on Unix uses six descriptors, some temporarily, for each child proc.
|
||||
// QProcess on Unix uses six (I think) descriptors, some temporarily, for each child proc.
|
||||
// Formula based on tests with a Ubuntu 16.04 VM.
|
||||
unsigned requiredDescriptors = 30 + 6 * numForks;
|
||||
struct rlimit descLimits;
|
||||
if (getrlimit(RLIMIT_NOFILE, &descLimits) == 0) {
|
||||
|
@ -393,6 +394,9 @@ void AssignmentClientMonitor::adjustOsResources(unsigned int numForks) const
|
|||
qDebug() << "Failed to reset descriptor limit to" << requiredDescriptors << ":" << errorString;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const char *const errorString = strerror(errno);
|
||||
qDebug() << "Failed to read descriptor limit:" << errorString;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue