You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Gerald Bonfiglio (JIRA)" <ji...@apache.org> on 2019/02/26 20:51:00 UTC

[jira] [Comment Edited] (SOLR-8536) MDC handling in MDCAwareThreadPoolExecutor uses even non-solr MDC parameters

    [ https://issues.apache.org/jira/browse/SOLR-8536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16778562#comment-16778562 ] 

Gerald Bonfiglio edited comment on SOLR-8536 at 2/26/19 8:50 PM:
-----------------------------------------------------------------

I have run into the same issue with SolrJ 7.7.  In my case, it's causing all updates to fail, since the code also assumes that all values in MDC are Strings, and the application we're using is also storing Integers in the MDC (it's not using the MDC via slf4j, whose put method defines values as strings, but is using it directly from log4j, which allows any object).  As a result, I get the following exception:

Caused by: org.apache.solr.client.solrj.SolrServerException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
 at org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:1002)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:817)
 at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:194)
 at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:177)
 at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:138)
 at com.nastel.jkool.db.store.solr.SolrConnection.sendSolrUpdateRequest(SolrConnection.java:770)
 ... 22 more
 Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
 at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.execute(ExecutorUtil.java:174)
 at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.directUpdate(CloudSolrClient.java:528)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1019)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:884)
 ... 27 more


was (Author: jbnas):
I have run into the same issue with SolrJ 7.7.  In my case, it's causing all updates to fail, since the code also assumes that all values in MDC are Strings, and the application we're using is also storing Integers in the MDC.  As a result, I get the following exception:

Caused by: org.apache.solr.client.solrj.SolrServerException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
 at org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:1002)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:817)
 at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:194)
 at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:177)
 at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:138)
 at com.nastel.jkool.db.store.solr.SolrConnection.sendSolrUpdateRequest(SolrConnection.java:770)
 ... 22 more
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
 at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.execute(ExecutorUtil.java:174)
 at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.directUpdate(CloudSolrClient.java:528)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1019)
 at org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:884)
 ... 27 more

> MDC handling in MDCAwareThreadPoolExecutor uses even non-solr MDC parameters
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-8536
>                 URL: https://issues.apache.org/jira/browse/SOLR-8536
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrJ
>    Affects Versions: 5.4
>         Environment: JSF-Based App with WebSphrere 8.5, Solr 5.3.0, slf4j-1.7.12,
> all jars are in WEB-INF/lib.
>            Reporter: Konstantin Hollerith
>            Priority: Major
>
> I'm using SLF4J MDC to log additional Information in my WebApp. Some of my
> MDC-Parameters even include Line-Breaks.
> It seems, that Solr takes _all_ MDC parameters and puts them into the
> Thread-Name, see
> org.apache.solr.common.util.ExecutorUtil.MDCAwareThreadPoolExecutor.execute(Runnable).
> When there is some logging of Solr, the log gets cluttered:
> {noformat}
> [11.01.16 09:14:19:170 CET] 000002a3 SystemOut     O 09:14:19,169
> [zkCallback-14-thread-1-processing-My
> Custom
> MDC
> Parameter ROraqiFWaoXqP21gu4uLpMh SANDHO] WARN
> common.cloud.ConnectionManager [session=ROraqiFWaoXqP21gu4uLpMh]
> [user=SANDHO]: zkClient received AuthFailed
> {noformat}
> (some of my MDC-Parameters are only active in Email-Logs and are not
> included in the file-log)
> Solr should only put its own MDC-Parameter into the
> Thread-Name.
> Possible Solution: Since all (as far as i can check) invocations in Solr of
> MDC.put uses a Prefix like "ConcurrentUpdateSolrClient" or
> "CloudSolrClient" etc., it would be possible to put a check into
> MDCAwareThreadPoolExecutor.execute(Runnable) that process only those
> Prefixes.
> See also discussion on mailing list:
> Topic:Possible Bug - MDC handling in org.apache.solr.common.util.ExecutorUtil.MDCAwareThreadPoolExecutor.execute(Runnable)
> Date: Mon, 11 Jan 2016 09:00:43 GMT



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org