mirror of
				https://github.com/minio/minio.git
				synced 2025-10-30 00:05:02 -04:00 
			
		
		
		
	Add cpuio profiling potential crash workaround (#20809)
Add profiling potential crash wourkaround Using admin traces could potentially crash the server (or handler more likely) due to upstream divide by 0: https://github.com/felixge/fgprof/pull/34 Ensure the profile always runs 100ms before stopping, so sample count isn't 0 (default sample rate ~10ms/sample, but allow for cpu starvation)
This commit is contained in:
		
							parent
							
								
									43a7402968
								
							
						
					
					
						commit
						4536ecfaa4
					
				| @ -411,7 +411,12 @@ func startProfiler(profilerType string) (minioProfiler, error) { | |||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
| 		stop := fgprof.Start(f, fgprof.FormatPprof) | 		stop := fgprof.Start(f, fgprof.FormatPprof) | ||||||
|  | 		startedAt := time.Now() | ||||||
| 		prof.stopFn = func() ([]byte, error) { | 		prof.stopFn = func() ([]byte, error) { | ||||||
|  | 			if elapsed := time.Since(startedAt); elapsed < 100*time.Millisecond { | ||||||
|  | 				// Light hack around https://github.com/felixge/fgprof/pull/34 | ||||||
|  | 				time.Sleep(100*time.Millisecond - elapsed) | ||||||
|  | 			} | ||||||
| 			err := stop() | 			err := stop() | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user