You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@solr.apache.org by Alex Deparvu <st...@apache.org> on 2023/02/16 16:20:10 UTC

Http2SolrClient loss of MDC context when running an async request

Hi,
Wanted to raise a minor regression in Solr 9.x, the Http2SolrClient loses
MDC context information when running an async request.
The issue is the 'Request#send' [0] call is actually async itself and by
the time the response listener kicks in to push the response processing to
the executor the MDC context is already lost, so the executor will no
longer have access to the original MDC in order to push it forward onto the
thread that will process the response.

This is very difficult to capture on a running system, there are no logs
during this window. I only saw it because I was specifically looking at
thread names for a different reason.
This is how it is reflected in the thread names:
 - how it should be (Solr 8 style):
httpShardExecutor-5-thread-19-processing-gettingstarted_shard2_replica_n2
core_node5 localhost:8983_solr gettingstarted shard2 localhost-4
 - how it is in Solr 9 (due to no MDC context) httpShardExecutor-5-thread-10

I can't tell if there is anything breaking due to this.

[0]
https://github.com/apache/solr/blob/7eee7a8ad3c43db0dc26c663dd16764d1fb3dbf4/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java#L458


best,
alex

Re: Http2SolrClient loss of MDC context when running an async request

Posted by Alex Deparvu <st...@apache.org>.
Thank you Eric and Jason. created
https://issues.apache.org/jira/browse/SOLR-16676

On Tue, Feb 21, 2023 at 4:25 AM Jason Gerlowski <ge...@gmail.com>
wrote:

> Go ahead and create a JIRA Alex, if you're up for it.  Sounds like no
> one here has additional context, but what you're describing definitely
> sounds like an unintentional regression.
>
> On Sun, Feb 19, 2023 at 3:05 PM Eric Pugh
> <ep...@opensourceconnections.com> wrote:
> >
> > This is all pretty opaque area to me….  Your thinking does make sense to
> me ;-)
> >
> >
> > > On Feb 19, 2023, at 1:21 PM, Alex Deparvu <st...@apache.org>
> wrote:
> > >
> > > Hi.
> > > Does anyone have any thoughts on this?
> > > Unless there are any objections, I will create a Jira for copying the
> MDC
> > > context to the new thread, as it was in Solr 8.
> > >
> > > best,
> > > alex
> > >
> > >
> > >
> > >
> > >
> > > On Thu, Feb 16, 2023 at 8:20 AM Alex Deparvu <st...@apache.org>
> wrote:
> > >
> > >> Hi,
> > >> Wanted to raise a minor regression in Solr 9.x, the Http2SolrClient
> loses
> > >> MDC context information when running an async request.
> > >> The issue is the 'Request#send' [0] call is actually async itself and
> by
> > >> the time the response listener kicks in to push the response
> processing to
> > >> the executor the MDC context is already lost, so the executor will no
> > >> longer have access to the original MDC in order to push it forward
> onto the
> > >> thread that will process the response.
> > >>
> > >> This is very difficult to capture on a running system, there are no
> logs
> > >> during this window. I only saw it because I was specifically looking
> at
> > >> thread names for a different reason.
> > >> This is how it is reflected in the thread names:
> > >> - how it should be (Solr 8 style):
> > >>
> httpShardExecutor-5-thread-19-processing-gettingstarted_shard2_replica_n2
> > >> core_node5 localhost:8983_solr gettingstarted shard2 localhost-4
> > >> - how it is in Solr 9 (due to no MDC context)
> > >> httpShardExecutor-5-thread-10
> > >>
> > >> I can't tell if there is anything breaking due to this.
> > >>
> > >> [0]
> > >>
> https://github.com/apache/solr/blob/7eee7a8ad3c43db0dc26c663dd16764d1fb3dbf4/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java#L458
> > >>
> > >>
> > >> best,
> > >> alex
> > >>
> >
> > _______________________
> > Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 |
> http://www.opensourceconnections.com <
> http://www.opensourceconnections.com/> | My Free/Busy <
> http://tinyurl.com/eric-cal>
> > Co-Author: Apache Solr Enterprise Search Server, 3rd Ed <
> https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw
> >
> > This e-mail and all contents, including attachments, is considered to be
> Company Confidential unless explicitly stated otherwise, regardless of
> whether attachments are marked as such.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@solr.apache.org
> For additional commands, e-mail: dev-help@solr.apache.org
>
>

Re: Http2SolrClient loss of MDC context when running an async request

Posted by Jason Gerlowski <ge...@gmail.com>.
Go ahead and create a JIRA Alex, if you're up for it.  Sounds like no
one here has additional context, but what you're describing definitely
sounds like an unintentional regression.

On Sun, Feb 19, 2023 at 3:05 PM Eric Pugh
<ep...@opensourceconnections.com> wrote:
>
> This is all pretty opaque area to me….  Your thinking does make sense to me ;-)
>
>
> > On Feb 19, 2023, at 1:21 PM, Alex Deparvu <st...@apache.org> wrote:
> >
> > Hi.
> > Does anyone have any thoughts on this?
> > Unless there are any objections, I will create a Jira for copying the MDC
> > context to the new thread, as it was in Solr 8.
> >
> > best,
> > alex
> >
> >
> >
> >
> >
> > On Thu, Feb 16, 2023 at 8:20 AM Alex Deparvu <st...@apache.org> wrote:
> >
> >> Hi,
> >> Wanted to raise a minor regression in Solr 9.x, the Http2SolrClient loses
> >> MDC context information when running an async request.
> >> The issue is the 'Request#send' [0] call is actually async itself and by
> >> the time the response listener kicks in to push the response processing to
> >> the executor the MDC context is already lost, so the executor will no
> >> longer have access to the original MDC in order to push it forward onto the
> >> thread that will process the response.
> >>
> >> This is very difficult to capture on a running system, there are no logs
> >> during this window. I only saw it because I was specifically looking at
> >> thread names for a different reason.
> >> This is how it is reflected in the thread names:
> >> - how it should be (Solr 8 style):
> >> httpShardExecutor-5-thread-19-processing-gettingstarted_shard2_replica_n2
> >> core_node5 localhost:8983_solr gettingstarted shard2 localhost-4
> >> - how it is in Solr 9 (due to no MDC context)
> >> httpShardExecutor-5-thread-10
> >>
> >> I can't tell if there is anything breaking due to this.
> >>
> >> [0]
> >> https://github.com/apache/solr/blob/7eee7a8ad3c43db0dc26c663dd16764d1fb3dbf4/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java#L458
> >>
> >>
> >> best,
> >> alex
> >>
>
> _______________________
> Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 | http://www.opensourceconnections.com <http://www.opensourceconnections.com/> | My Free/Busy <http://tinyurl.com/eric-cal>
> Co-Author: Apache Solr Enterprise Search Server, 3rd Ed <https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw>
> This e-mail and all contents, including attachments, is considered to be Company Confidential unless explicitly stated otherwise, regardless of whether attachments are marked as such.
>

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


Re: Http2SolrClient loss of MDC context when running an async request

Posted by Eric Pugh <ep...@opensourceconnections.com>.
This is all pretty opaque area to me….  Your thinking does make sense to me ;-)


> On Feb 19, 2023, at 1:21 PM, Alex Deparvu <st...@apache.org> wrote:
> 
> Hi.
> Does anyone have any thoughts on this?
> Unless there are any objections, I will create a Jira for copying the MDC
> context to the new thread, as it was in Solr 8.
> 
> best,
> alex
> 
> 
> 
> 
> 
> On Thu, Feb 16, 2023 at 8:20 AM Alex Deparvu <st...@apache.org> wrote:
> 
>> Hi,
>> Wanted to raise a minor regression in Solr 9.x, the Http2SolrClient loses
>> MDC context information when running an async request.
>> The issue is the 'Request#send' [0] call is actually async itself and by
>> the time the response listener kicks in to push the response processing to
>> the executor the MDC context is already lost, so the executor will no
>> longer have access to the original MDC in order to push it forward onto the
>> thread that will process the response.
>> 
>> This is very difficult to capture on a running system, there are no logs
>> during this window. I only saw it because I was specifically looking at
>> thread names for a different reason.
>> This is how it is reflected in the thread names:
>> - how it should be (Solr 8 style):
>> httpShardExecutor-5-thread-19-processing-gettingstarted_shard2_replica_n2
>> core_node5 localhost:8983_solr gettingstarted shard2 localhost-4
>> - how it is in Solr 9 (due to no MDC context)
>> httpShardExecutor-5-thread-10
>> 
>> I can't tell if there is anything breaking due to this.
>> 
>> [0]
>> https://github.com/apache/solr/blob/7eee7a8ad3c43db0dc26c663dd16764d1fb3dbf4/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java#L458
>> 
>> 
>> best,
>> alex
>> 

_______________________
Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 | http://www.opensourceconnections.com <http://www.opensourceconnections.com/> | My Free/Busy <http://tinyurl.com/eric-cal>  
Co-Author: Apache Solr Enterprise Search Server, 3rd Ed <https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw>	
This e-mail and all contents, including attachments, is considered to be Company Confidential unless explicitly stated otherwise, regardless of whether attachments are marked as such.


Re: Http2SolrClient loss of MDC context when running an async request

Posted by Alex Deparvu <st...@apache.org>.
Hi.
Does anyone have any thoughts on this?
Unless there are any objections, I will create a Jira for copying the MDC
context to the new thread, as it was in Solr 8.

best,
alex





On Thu, Feb 16, 2023 at 8:20 AM Alex Deparvu <st...@apache.org> wrote:

> Hi,
> Wanted to raise a minor regression in Solr 9.x, the Http2SolrClient loses
> MDC context information when running an async request.
> The issue is the 'Request#send' [0] call is actually async itself and by
> the time the response listener kicks in to push the response processing to
> the executor the MDC context is already lost, so the executor will no
> longer have access to the original MDC in order to push it forward onto the
> thread that will process the response.
>
> This is very difficult to capture on a running system, there are no logs
> during this window. I only saw it because I was specifically looking at
> thread names for a different reason.
> This is how it is reflected in the thread names:
>  - how it should be (Solr 8 style):
> httpShardExecutor-5-thread-19-processing-gettingstarted_shard2_replica_n2
> core_node5 localhost:8983_solr gettingstarted shard2 localhost-4
>  - how it is in Solr 9 (due to no MDC context)
> httpShardExecutor-5-thread-10
>
> I can't tell if there is anything breaking due to this.
>
> [0]
> https://github.com/apache/solr/blob/7eee7a8ad3c43db0dc26c663dd16764d1fb3dbf4/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java#L458
>
>
> best,
> alex
>