nix-store --serve: Implement log size limit
This commit is contained in:
		
							parent
							
								
									9ffc4f4363
								
							
						
					
					
						commit
						1abda8e173
					
				
					 4 changed files with 8 additions and 4 deletions
				
			
		|  | @ -2854,7 +2854,8 @@ void DerivationGoal::handleChildOutput(int fd, const string & data) | ||||||
|             printMsg(lvlError, |             printMsg(lvlError, | ||||||
|                 format("%1% killed after writing more than %2% bytes of log output") |                 format("%1% killed after writing more than %2% bytes of log output") | ||||||
|                 % getName() % settings.maxLogSize); |                 % getName() % settings.maxLogSize); | ||||||
|             timedOut(); // not really a timeout, but close enough
 |             killChild(); | ||||||
|  |             done(BuildResult::LogLimitExceeded); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         if (verbosity >= settings.buildVerbosity) |         if (verbosity >= settings.buildVerbosity) | ||||||
|  |  | ||||||
|  | @ -112,7 +112,8 @@ struct BuildResult | ||||||
|         CachedFailure, |         CachedFailure, | ||||||
|         TimedOut, |         TimedOut, | ||||||
|         MiscFailure, |         MiscFailure, | ||||||
|         DependencyFailed |         DependencyFailed, | ||||||
|  |         LogLimitExceeded, | ||||||
|     } status = MiscFailure; |     } status = MiscFailure; | ||||||
|     std::string errorMsg; |     std::string errorMsg; | ||||||
|     //time_t startTime = 0, stopTime = 0;
 |     //time_t startTime = 0, stopTime = 0;
 | ||||||
|  |  | ||||||
|  | @ -853,7 +853,7 @@ static void opServe(Strings opFlags, Strings opArgs) | ||||||
|     if (magic != SERVE_MAGIC_1) throw Error("protocol mismatch"); |     if (magic != SERVE_MAGIC_1) throw Error("protocol mismatch"); | ||||||
|     out << SERVE_MAGIC_2 << SERVE_PROTOCOL_VERSION; |     out << SERVE_MAGIC_2 << SERVE_PROTOCOL_VERSION; | ||||||
|     out.flush(); |     out.flush(); | ||||||
|     readInt(in); // Client version, unused for now
 |     unsigned int clientVersion = readInt(in); | ||||||
| 
 | 
 | ||||||
|     auto getBuildSettings = [&]() { |     auto getBuildSettings = [&]() { | ||||||
|         // FIXME: changing options here doesn't work if we're
 |         // FIXME: changing options here doesn't work if we're
 | ||||||
|  | @ -863,6 +863,8 @@ static void opServe(Strings opFlags, Strings opArgs) | ||||||
|         settings.useSubstitutes = false; |         settings.useSubstitutes = false; | ||||||
|         settings.maxSilentTime = readInt(in); |         settings.maxSilentTime = readInt(in); | ||||||
|         settings.buildTimeout = readInt(in); |         settings.buildTimeout = readInt(in); | ||||||
|  |         if (GET_PROTOCOL_MINOR(clientVersion) >= 2) | ||||||
|  |             settings.maxLogSize = readInt(in); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     while (true) { |     while (true) { | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ namespace nix { | ||||||
| #define SERVE_MAGIC_1 0x390c9deb | #define SERVE_MAGIC_1 0x390c9deb | ||||||
| #define SERVE_MAGIC_2 0x5452eecb | #define SERVE_MAGIC_2 0x5452eecb | ||||||
| 
 | 
 | ||||||
| #define SERVE_PROTOCOL_VERSION 0x201 | #define SERVE_PROTOCOL_VERSION 0x202 | ||||||
| #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00) | #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00) | ||||||
| #define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff) | #define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue