[
https://issues.apache.org/jira/browse/DERBY-7059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17613791#comment-17613791
]
Richard N. Hillegas commented on DERBY-7059:
--------------------------------------------
Thanks for that stack trace. It indicates that the thread which refreshes index
statistics can't look up its execution context.
Derby context management is a tricky bit of code which I don't understand.
Contexts are thread-specific state variables. A casual glance at one of the key
classes (org.apache.derby.iapi.services.context.ContextService) suggests that
there are many routes by which context lookup can fail silently and return
null. Fortunately, bugs in this area are extremely rare. Unfortunately, your
application seems to have stumbled across one of these rare bugs.
If I were debugging this problem, I would start by instrumenting ContextService
and its sister classes so that a diagnostic trace is printed everywhere that
context lookup fails and returns null. Fine-tuning this trace code may take a
while because there may be bootstrap cases where context lookup is expected to
return a null, flagging the need to run some initialization code. The signal we
are looking for may be swamped by other diagnostic noise.
As a last resort, you may want to disable the thread which refreshes index
statistics. You should be able to do this by setting the following property on
the boot command line:
-Dderby.storage.indexStats.auto=false
If you do that, you may need to manually refresh index statistics
periodically--in order to maintain good query performance. For more
information, see the "Working with cardinality statistics" section in the Derby
Tuning Guide
(https://db.apache.org/derby/docs/10.16/tuning/ctunstats46438.html).
> NullPointerException IndexRowGenerator.getExecutionFactory
> ----------------------------------------------------------
>
> Key: DERBY-7059
> URL: https://issues.apache.org/jira/browse/DERBY-7059
> Project: Derby
> Issue Type: Bug
> Components: Store
> Affects Versions: 10.14.2.0
> Reporter: Daniel Gonzalez
> Priority: Major
>
> We have had a couple of customers which have experienced the crash show below
> in the derby.index-stat-thread.
> We can't recreate the issue locally, but what may be the cause of this? Is
> there anything in particular that may be provoking this?
>
> {{java.lang.NullPointerException}}{{at
> org.apache.derby.iapi.sql.dictionary.IndexRowGenerator.getExecutionFactory(Unknown
> Source)}}{{at
> org.apache.derby.iapi.sql.dictionary.IndexRowGenerator.getIndexRowTemplate(Unknown
> Source)}}{{at
> org.apache.derby.iapi.sql.dictionary.IndexRowGenerator.getNullIndexRow(Unknown
> Source)}}{{at
> org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.updateIndexStatsMinion(Unknown
> Source)}}{{at
> org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.generateStatistics(Unknown
> Source)}}{{at
> org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.processingLoop(Unknown
> Source)}}{{at
> org.apache.derby.impl.services.daemon.IndexStatisticsDaemonImpl.run(Unknown
> Source)}}{{at java.lang.Thread.run(Thread.java:748)}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)