mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Merge pull request #1543 from shapeblue/nio-fix-aggressive-cpu-use
Fix Nio/CPU issue and CI failures- Reverts ea2286 that introduced a wakeup on each connection loop run. - In SSL handshake code removes delegated tasks to be run in separate threads. /cc @kiwiflyer @swill @jburwell and others for review @kiwiflyer please help me test this fix and share if it makes the NioConnection robust now, without having the selector consume a lot of CPU. Thanks. * pr/1543: test: fix cleanup sequence for test_acl_listvolume test CLOUDSTACK-9299: Fix test failures on CI CLOUDSTACK-9348: Make NioConnectio loop less aggressive Signed-off-by: Will Stevens <williamstevens@gmail.com>
This commit is contained in:
		
						commit
						821b2da126
					
				| @ -23,13 +23,11 @@ import com.cloud.utils.concurrency.NamedThreadFactory; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import com.google.common.collect.ImmutableMap; | ||||
| import org.apache.cloudstack.outofbandmanagement.OutOfBandManagement; | ||||
| import org.apache.cloudstack.outofbandmanagement.driver.OutOfBandManagementDriverResponse; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
| import java.util.concurrent.ExecutorService; | ||||
| import java.util.concurrent.Executors; | ||||
| @ -105,11 +103,4 @@ public class IpmitoolWrapperTest { | ||||
|         Assert.assertEquals(IPMITOOL.findIpmiUser(usersList, "operator"), "2"); | ||||
|         Assert.assertEquals(IPMITOOL.findIpmiUser(usersList, "user"), "3"); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testExecuteCommands() { | ||||
|         OutOfBandManagementDriverResponse r = IPMITOOL.executeCommands(Arrays.asList("ls", "/tmp")); | ||||
|         Assert.assertTrue(r.isSuccess()); | ||||
|         Assert.assertTrue(r.getResult().length() > 0); | ||||
|     } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -357,9 +357,9 @@ class TestVolumeList(cloudstackTestCase): | ||||
|         cls.apiclient = super(TestVolumeList, cls).getClsTestClient().getApiClient() | ||||
|         cls.apiclient.connection.apiKey = cls.default_apikey | ||||
|         cls.apiclient.connection.securityKey = cls.default_secretkey | ||||
|         cleanup_resources(cls.apiclient, cls.cleanup) | ||||
|         cls.domain_1.delete(cls.apiclient,cleanup="true") | ||||
|         cls.domain_2.delete(cls.apiclient,cleanup="true") | ||||
|         cleanup_resources(cls.apiclient, cls.cleanup) | ||||
|         return | ||||
| 
 | ||||
|     def setUp(cls): | ||||
|  | ||||
| @ -557,8 +557,13 @@ class TestOutOfBandManagement(cloudstackTestCase): | ||||
|         cmd = changeOutOfBandManagementPassword.changeOutOfBandManagementPasswordCmd() | ||||
|         cmd.hostid = self.getHost().id | ||||
|         cmd.password = "Password12345" | ||||
|         response = self.apiclient.changeOutOfBandManagementPassword(cmd) | ||||
|         self.assertEqual(response.status, True) | ||||
|         try: | ||||
|             response = self.apiclient.changeOutOfBandManagementPassword(cmd) | ||||
|             self.assertEqual(response.status, True) | ||||
|         except Exception as e: | ||||
|             if "packet session id 0x0 does not match active session" in str(e): | ||||
|                 raise self.skipTest("Known ipmitool issue hit, skipping test") | ||||
|             raise e | ||||
| 
 | ||||
|         bmc = IpmiServerContext().bmc | ||||
|         bmc.powerstate = 'on' | ||||
|  | ||||
| @ -615,7 +615,10 @@ public class Link { | ||||
|                 case NEED_TASK: | ||||
|                     Runnable task; | ||||
|                     while ((task = sslEngine.getDelegatedTask()) != null) { | ||||
|                         new Thread(task).run(); | ||||
|                         if (s_logger.isTraceEnabled()) { | ||||
|                             s_logger.trace("SSL: Running delegated task!"); | ||||
|                         } | ||||
|                         task.run(); | ||||
|                     } | ||||
|                     break; | ||||
|                 case FINISHED: | ||||
|  | ||||
| @ -171,8 +171,6 @@ public abstract class NioConnection implements Callable<Boolean> { | ||||
|             } catch (final IOException e) { | ||||
|                 s_logger.error("Agent will die due to this IOException!", e); | ||||
|                 throw new NioConnectionException(e.getMessage(), e); | ||||
|             } finally { | ||||
|                 _selector.wakeup(); | ||||
|             } | ||||
|         } | ||||
|         _isStartup = false; | ||||
|  | ||||
| @ -39,10 +39,9 @@ public class ProcessTest { | ||||
| 
 | ||||
|     @Test | ||||
|     public void testProcessRunner() { | ||||
|         ProcessResult result = RUNNER.executeCommands(Arrays.asList("ls", "/tmp")); | ||||
|         ProcessResult result = RUNNER.executeCommands(Arrays.asList("sleep", "0")); | ||||
|         Assert.assertEquals(result.getReturnCode(), 0); | ||||
|         Assert.assertTrue(Strings.isNullOrEmpty(result.getStdError())); | ||||
|         Assert.assertTrue(result.getStdOutput().length() > 0); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user