APMDB insert Exception in Introscope MOM log

book

Article ID: 197441

calendar_today

Updated On:

Products

CA Application Performance Management Agent (APM / Wily / Introscope) CA Application Performance Management (APM / Wily / Introscope) INTROSCOPE DX Application Performance Management

Issue/Introduction

We identified the error below in the MOM EM log, and while researching on the Broadcom website, we see the following TechDoc:

https://knowledge.broadcom.com/external/article/142775/error-insert-or-update-on-table-atstorie.html
 
ERROR in MOM EM log:
[ERROR] [ReporterExecutor-5] [Manager.AT] Exception handling event context through reporters: PreparedStatementCallback; SQL [insert into at_stories(story_id, start_time, end_time, fork, latest, statements) values(?, ?, ?, ?, ?, ?)]; ERROR: insert or update on table "at_stories" violates foreign key constraint "at_stories_story_id_fkey"
  Detail: Key (story_id)=(41) is not present in table "at_stories_pivot".; nested exception is org.postgresql.util.PSQLException: ERROR: insert or update on table "at_stories" violates foreign key constraint "at_stories_story_id_fkey"
  Detail: Key (story_id)=(41) is not present in table "at_stories_pivot".
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [insert into at_stories(story_id, start_time, end_time, fork, latest, statements) values(?, ?, ?, ?, ?, ?)]; ERROR: insert or update on table "at_stories" violates foreign key constraint "at_stories_story_id_fkey"
  Detail: Key (story_id)=(41) is not present in table "at_stories_pivot".; nested exception is org.postgresql.util.PSQLException: ERROR: insert or update on table "at_stories" violates foreign key constraint "at_stories_story_id_fkey"
  Detail: Key (story_id)=(41) is not present in table "at_stories_pivot".
 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243)
 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:655)
 at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:876)
 at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:900)
 at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:287)
 at com.wily.introscope.appmap.em.model.dao.impl.gmt.GMTNamedParameterJdbcTemplate.update(GMTNamedParameterJdbcTemplate.java:250)
 at com.wily.introscope.appmap.triage.dao.impl.StoriesDaoImpl.createStory(StoriesDaoImpl.java:145)
 at com.wily.introscope.appmap.triage.entity.service.impl.StoryServiceImpl.recordStory(StoryServiceImpl.java:253)
 at com.wily.introscope.appmap.triage.analyst.core.Editor.handleEventContext(Editor.java:289)
 at com.wily.introscope.appmap.triage.analyst.core.Editor$$FastClassBySpringCGLIB$$28f2a185.invoke(<generated>)
 at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
 at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
 at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "at_stories" violates foreign key constraint "at_stories_story_id_fkey"
  Detail: Key (story_id)=(41) is not present in table "at_stories_pivot".
 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
 at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
 at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
 at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
 at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
 at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
 at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:883)
 at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:876)
 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:639)
 ... 16 more

Cause

We find that sometime this error may occur when EM cache went out of sync with APMDB.

Environment

Release : 10.7.0

Component : Introscope

Resolution

Can you please take the following steps and see if this helps.

1- Stop WebView and MOM Enterprise Manager processes 

2- Delete the entire content [all files and directories] of [EM-Home]/work and [WV-Home]/work folders 

3- Delete the entire content [all files and directories] of /configuration folder except file config.ini (DO NOT delete config.ini file) 

[EM-Home]/product/enterprisemanager/configuration 
[WV-Home]/product/webview/configuration 

4- Delete the entire content of <EM-Home>/logs and <WV-Home>/logs

5- start MOM Enterprise Manager and WebView processes 

Note: If Enterprise Manager and WebView are installed under same directory, then [EM-Home] and [WV-Home] are the same.