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

Andrzej Bialecki commented on SOLR-14657:
-----------------------------------------

The same issue is present in a few other components, eg. 
SolrCore.initializeMetrics, although there I opted for checking whether the 
core is closed ... how about adding this convenience method as 
{{SolrMetricsContext.safeGauge(Gauge g, Object defValue) / 
}}{{SolrMetricsContext.safeGauge(Gauge g)}} ? At least we would have one 
central place to make these decisions. For this particular gauge I would be 
tempted to return -1 instead of null, as a kind of "impossible value" that we 
already return from other numeric gauges.

The {{MetricsHandler}} (or more precisely {{MetricUtils}}) knows how to handle 
null output from Gauges, it's simply translated to a null JSON value. Whether 
that's better than a fake value is another discussion, see SOLR-14683 - some 
clients may not be prepared to deal with {{null}} JSON values. Perhaps such 
values should not appear at all in the metrics output?

Anyway, in this issue we can at least refactor the code to make that decision 
easier.

> spurious ERRORs due to race condition between SolrIndexSearcher metrics and 
> IndexReader closing
> -----------------------------------------------------------------------------------------------
>
>                 Key: SOLR-14657
>                 URL: https://issues.apache.org/jira/browse/SOLR-14657
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Chris M. Hostetter
>            Assignee: Chris M. Hostetter
>            Priority: Major
>         Attachments: SOLR-14657.patch
>
>
> I've seen situations in the wild where systems monitoring/polling metrics can 
> trigger scary looking - but otherwise benign - ERRORs due to 
> AlreadyClosedExceptions if/when the searcher/reader is in the process of 
> being re-opened and the Gauge tries to call reader.numDocs(), etc...
> We should tweak the metrics logic to just ignore these exceptions



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to