[
https://issues.apache.org/jira/browse/SOLR-7381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Shalin Shekhar Mangar updated SOLR-7381:
----------------------------------------
Attachment: SOLR-7381-thread-names.patch
This patch takes us a step further in improving debuggability by exposing MDC
values in thread names so that a thread dump can give us a better idea of what
was happening at the time.
For example, here is a stack trace showing a CloudSolrClient update thread
which has the URL of the remote host in its name:
{code}
"CloudSolrClient
ThreadPool-6-thread-1-processing-{CloudSolrClient.url=http:/127.0.0.1:53410/ollection1/"
#185 prio=5 os_prio=0 tid=0x00007f7778097000 nid=0x218a runnable
[0x00007f77415d7000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
{code}
Here's another stack trace showing the update executor thread running on
core=collection1, replica=core_node2, node_name=127.0.0.1:53410_ and making a
call to http://127.0.0.1:57515/collection1:
{code}
"updateExecutor-11-thread-1-processing-{core=collection1, replica=core_node2,
node_name=127.0.0.1:53410_,
ConcurrentUpdateSolrClient.baseUrl=http:/127.0.0.1:57515/ollection1,
shard=shard3, collection=collection1}" #177 prio=5 os_prio=0
tid=0x00007f775400a000 nid=0x2182 runnable [0x00007f7741ddf000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
{code}
Interestingly, the java thread names seem to use the forward slash character as
a special one and ignore the character following it so e.g. a url added to the
name has "http:/127.0.0.1:57515/ollection1" (notice 'ollection1'!)
All you need to do to take advantage of this feature is to set (any) MDC values
before you submit a task to the thread pool and everything else is taken care
for you.
I should probably add some upper limit to the thread names.
> Improve logging by adding MDC context in more places
> ----------------------------------------------------
>
> Key: SOLR-7381
> URL: https://issues.apache.org/jira/browse/SOLR-7381
> Project: Solr
> Issue Type: Improvement
> Components: SolrCloud
> Reporter: Shalin Shekhar Mangar
> Assignee: Shalin Shekhar Mangar
> Priority: Critical
> Fix For: 5.2
>
> Attachments: SOLR-7381-thread-names.patch, SOLR-7381.patch,
> SOLR-7381.patch
>
>
> SOLR-6673 added MDC based logging in a few places but we have a lot of ground
> to cover. Threads created via thread pool executors do not inherit MDC values
> and those are some of the most interesting places to log MDC context. This is
> critical to help debug SolrCloud failures.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]