[ https://issues.apache.org/jira/browse/CLOUDSTACK-7929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Anshul Gangwar resolved CLOUDSTACK-7929. ---------------------------------------- Resolution: Fixed > Unhandled exception when setting negative value for throttling rate while > creating network offering > --------------------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-7929 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7929 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Anshul Gangwar > Assignee: Anshul Gangwar > Fix For: 4.5.0 > > > Steps > ==== > Create a network offering and specify -1 for network throttling rate. > Result > ===== > Exception is not handled properly throwing a DB exception exposing the DB > column names in the Logs and UI. > Expected Result > ============= > "-1" is generally an acceptable input for signifying infinite values or not > applicable values. So we should allow -1 and translate it appropriately as > "no throttling" applied. Or if we don't, we should handle the input correctly > and throw a suitable error message for the user. > Following is the exception seen presently in the logs (or through UI): > [{"com.cloud.agent.api.AgentControlAnswer":{"result":true,"wait":0}}] } > 2014-11-13 13:58:31,414 DEBUG [c.c.a.ApiServlet] > (catalina-exec-8:ctx-ac230e40) ===START=== 10.144.7.5 – POST > command=createNetworkOffering&response=json&sessionkey=vL5F3A1A1pr98OOTv7eei > G2jvBI%3D > 2014-11-13 13:58:31,428 DEBUG [c.c.c.ConfigurationManagerImpl] > (catalina-exec-8:ctx-ac230e40 ctx-60a6474c) Adding Firewall service with > provider VirtualRouter > 2014-11-13 13:58:31,432 DEBUG [c.c.c.ConfigurationManagerImpl] > (catalina-exec-8:ctx-ac230e40 ctx-60a6474c) Adding network offering [Network > Offering [0-Guest-test] > 2014-11-13 13:58:31,435 DEBUG [c.c.u.d.T.Transaction] > (catalina-exec-8:ctx-ac230e40 ctx-60a6474c) Rolling back the transaction: > Time = 3 Name = catalina-exec-8; called by -TransactionLegac > y.rollback:902-TransactionLegacy.removeUpTo:845-TransactionLegacy.close:669-TransactionContextInterceptor.invoke:36-ReflectiveMethodInvocation.proceed:161-ExposeInvocationInterceptor.invoke > :91-ReflectiveMethodInvocation.proceed:172-JdkDynamicAopProxy.invoke:204-$Proxy79.persist:-1-ConfigurationManagerImpl$11.doInTransaction:4218-ConfigurationManagerImpl$11.doInTransaction:420 > 9-Transaction$2.doInTransaction:57 > 2014-11-13 13:58:31,442 ERROR [c.c.a.ApiServer] (catalina-exec-8:ctx-ac230e40 > ctx-60a6474c) unhandled exception executing api command: > [Ljava.lang.String;@61bc5278 > com.cloud.utils.exception.CloudRuntimeException: DB Exception on: > com.mysql.jdbc.JDBC4PreparedStatement@27a103c3: INSERT INTO network_offerings > (network_offerings.name, network_offerings.un > ique_name, network_offerings.display_text, network_offerings.nw_rate, > network_offerings.mc_rate, network_offerings.traffic_type, > network_offerings.specify_vlan, network_offerings.system_onl > y, network_offerings.service_offering_id, network_offerings.tags, > network_offerings.default, network_offerings.availability, > network_offerings.state, network_offerings.created, network_offe > rings.guest_type, network_offerings.dedicated_lb_service, > network_offerings.shared_source_nat_service, > network_offerings.specify_ip_ranges, network_offerings.sort_key, > network_offerings.uui > d, network_offerings.redundant_router_service, > network_offerings.conserve_mode, network_offerings.elastic_ip_service, > network_offerings.eip_associate_public_ip, network_offerings.elastic_lb > _service, network_offerings.inline, network_offerings.is_persistent, > network_offerings.egress_default_policy, > network_offerings.concurrent_connections, > network_offerings.keep_alive_enabled, > network_offerings.supports_streched_l2, network_offerings.internal_lb, > network_offerings.public_lb) VALUES (_binary'test', _binary'test', > _binary'test', -1, 10, 'Guest', 0, 0, null, null, > 0, 'Optional', 'Disabled', '2014-11-13 08:28:31', 'Isolated', 0, 0, 0, 0, > _binary'f8bf35f5-dd77-4fa8-83ff-af1f1e85ece3', 0, 1, 0, 0, 0, 0, 0, 1, null, > 0, 0, 0, 0) > at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1400) > at > com.cloud.offerings.dao.NetworkOfferingDaoImpl.persist(NetworkOfferingDaoImpl.java:181) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) > at > com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) > at > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) > at com.sun.proxy.$Proxy79.persist(Unknown Source) > at > com.cloud.configuration.ConfigurationManagerImpl$11.doInTransaction(ConfigurationManagerImpl.java:4218) > at > com.cloud.configuration.ConfigurationManagerImpl$11.doInTransaction(ConfigurationManagerImpl.java:4209) > at com.cloud.utils.db.Transaction$2.doInTransaction(Transaction.java:57) > at com.cloud.utils.db.Transaction.execute(Transaction.java:45) > at com.cloud.utils.db.Transaction.execute(Transaction.java:54) > at > com.cloud.configuration.ConfigurationManagerImpl.createNetworkOffering(ConfigurationManagerImpl.java:4209) > at > com.cloud.configuration.ConfigurationManagerImpl.createNetworkOffering(ConfigurationManagerImpl.java:3917) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) > at > org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:106) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) > at > com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:51) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) > at > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) > at com.sun.proxy.$Proxy105.createNetworkOffering(Unknown Source) > at > org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd.execute(CreateNetworkOfferingCmd.java:295) > at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:141) > at com.cloud.api.ApiServer.queueCommand(ApiServer.java:694) > at com.cloud.api.ApiServer.handleRequest(ApiServer.java:517) > at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:273) > at com.cloud.api.ApiServlet$1.run(ApiServlet.java:117) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53) > at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:114) > at com.cloud.api.ApiServlet.doPost(ApiServlet.java:81) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) > at > org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:889) > at > org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:721) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2274) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:744) > Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range > value for column 'nw_rate' at row 1 > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3595) > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) > at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990) > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151) > at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625) > at > com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) > at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415) > at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333) > at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318) > at > org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) > at > org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) > at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1363) > ... 64 more > 2014-11-13 13:58:31,447 DEBUG [c.c.a.ApiServlet] > (catalina-exec-8:ctx-ac230e40 ctx-60a6474c) ===END=== 10.144.7.5 – POST > command=createNetworkOffering&response=json&sessionkey=vL5F3A1A1pr98OOTv7eeiG2jvBI%3D > 2014-11-13 13:58:33,712 INFO [o.a.c.f.j.i.AsyncJobManagerImpl] > (AsyncJobMgr-Heartbeat-1:ctx-d00a0b4c) Begin cleanup expired async-jobs > 2014-11-13 13:58:33,716 INFO [o.a.c.f.j.i.AsyncJobManagerImpl] > (AsyncJobMgr-Heartbeat-1:ctx-d00a0b4c) End cleanup expired async-jobs -- This message was sent by Atlassian JIRA (v6.3.4#6332)