Arkadiusz Robiński created SOLR-15883:
-----------------------------------------

             Summary: 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


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-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to