You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Arkadiusz Robiński (Jira)" <ji...@apache.org> on 2022/01/03 10:35:00 UTC

[jira] [Commented] (SOLR-15883) OpenExchangeRatesOrgProvider downloads currencies during a search request and can cause a request timeout

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

Arkadiusz Robiński commented on SOLR-15883:
-------------------------------------------

Pull request with a potential fix: https://github.com/apache/solr/pull/488

> OpenExchangeRatesOrgProvider downloads currencies during a search request and can cause a request timeout
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-15883
>                 URL: https://issues.apache.org/jira/browse/SOLR-15883
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Arkadiusz Robiński
>            Priority: Minor
>
> In OpenExchangeRatesOrgProvider.java there is a method getExchangeRate which is called during a search request, when a currency convertion is needed (eg. when filtering or sorting by a field of type solr.CurrencyFieldType). Before it returns the exchange rate, it calls reloadIfExpired(), which checks if the configured amount of time passed since the last reload and then fetches data from openexchangerates.org. If there is any delay (eg. the openexchangerates.org server takes long to respond), it will just wait for the response and block the thread. Maybe there is a timeout, but still, it will block a search thread until it timeouts. If timeAllowed is used in the search request, the request will end with an error when timeAllowed passes.
> Also, I don't see any locks or any synchronization there, so I think it tries to download the exchange rates in every search thread that uses a currency field. If there is an outage of openexchangerates.org, all search requests are blocked until openexchangerates.org is available again.
> There should be an option to have the currency rates downloaded in a thread that is not related to a search request.
> One idea for a fix is to have an option to reload exchange rates when a new searcher is opened, similarly to ExternalFileFieldReloader.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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