Provisioner creates transient OnmsSnmpInterface on interfaces with null ifIndex
Description
Acceptance / Success Criteria
None
Lucidchart Diagrams
Activity
Show:
Seth Leger November 25, 2013 at 10:41 AM
I've added an 'if' statement that avoids adding the blank, transient OnmsSnmpInterface if the ifIndex is null. This fixed the exception when saving the OnmsIpInterface. Marking as fixed.
commit 3ffb3c522e1355f549f7cfb6bcb9c438def574fb
Seth Leger November 25, 2013 at 10:31 AM
Here's the stack trace that occurred:
2013-11-19 10:24:14,115 DEBUG [writeExecutor-4] SyncTask$1: Exception occurred executing task org.opennms.netmgt.provision.service.NodeScan$BaseAgentScan$1@7ff6c9c4
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: org.opennms.netmgt.model.OnmsSnmpInterface; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.opennms.netmgt.model.OnmsSnmpInterface
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:654)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:881)
at org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate.flush(AbstractDaoHibernate.java:107)
at org.opennms.netmgt.provision.service.DefaultProvisionService.saveOrUpdate(DefaultProvisionService.java:951)
at org.opennms.netmgt.provision.service.DefaultProvisionService.access$400(DefaultProvisionService.java:108)
at org.opennms.netmgt.provision.service.DefaultProvisionService$1.doInsert(DefaultProvisionService.java:435)
at org.opennms.netmgt.provision.service.DefaultProvisionService$1.doInsert(DefaultProvisionService.java:401)
at org.opennms.netmgt.dao.support.UpsertTemplate.insert(UpsertTemplate.java:191)
at org.opennms.netmgt.dao.support.UpsertTemplate.doUpsert(UpsertTemplate.java:174)
at org.opennms.netmgt.dao.support.UpsertTemplate.access$000(UpsertTemplate.java:123)
at org.opennms.netmgt.dao.support.UpsertTemplate$1.doInTransaction(UpsertTemplate.java:147)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.opennms.netmgt.dao.support.UpsertTemplate.execute(UpsertTemplate.java:143)
at org.opennms.netmgt.provision.service.DefaultProvisionService.updateIpInterfaceAttributes(DefaultProvisionService.java:401)
at sun.reflect.GeneratedMethodAccessor584.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy79.updateIpInterfaceAttributes(Unknown Source)
at org.opennms.netmgt.provision.service.NodeScan$BaseAgentScan.updateIpInterface(NodeScan.java:791)
at org.opennms.netmgt.provision.service.NodeScan$BaseAgentScan$1.run(NodeScan.java:800)
at org.opennms.core.tasks.SyncTask.run(SyncTask.java:89)
at org.opennms.core.tasks.SyncTask$1.run(SyncTask.java:100)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.opennms.netmgt.model.OnmsSnmpInterface
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:242)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:265)
at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:619)
at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3151)
at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:501)
at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:227)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:150)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.springframework.orm.hibernate3.HibernateTemplate$28.doInHibernate(HibernateTemplate.java:883)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
... 42 more
Fixed
Details
Assignee
Seth LegerSeth LegerReporter
Tarus BalogTarus BalogLabels
Components
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Seth Leger
Seth LegerReporter
Tarus Balog
Tarus BalogLabels
Components
Fix versions
Affects versions
Priority
PagerDuty
PagerDuty Incident
PagerDuty
PagerDuty Incident
PagerDuty

PagerDuty Incident
Created November 25, 2013 at 10:28 AM
Updated January 27, 2017 at 4:20 PM
Resolved November 25, 2013 at 10:41 AM
We ran into a problem onsite at a customer where the provisioner was throwing a Hibernate exception when trying to update an OnmsIpInterface during scans of a particular Solaris 5.8 node. It turns out that the OnmsIpInterface had a null ifIndex but the table tracker code was adding an OnmsSnmpInterface to it anyway. During a later query, this transient object could not be looked up in the database (because of the null ifIndex) so it remained transient and when the OnmsIpInterface was saved, an exception was thrown because of the linked transient object.