Some CSV download requests end with empty reply (curl 52)
Some CSV downloads (especially for older periods like last year and accounts with a lot of transactions) end up with cloudflare error 502 on our instance. Error appears before the cloudflare timeout which is 100 seconds.
To eliminate cloudflare being the problem I tried to replicate the request with curl directly on the server.
curl 'http://127.0.0.1:4000/transactions-csv?address_id=0x0ff...&from_period=2021-10-20&to_period=2021-11-29'
curl: (52) Empty reply from server
There is no http code, headers or anything returned. Request terminates after ~60 seconds all the time which makes me think this is some internal timeout inside blockscout or elixir that is not handled properly.
If I reduce the period to a few days and repeat the request a few times it sometimes successfuly returns the CSV, probably because something gets into hot cache or indexed.
Trying to get the same transactions through GraphQL API seems very fast so this bug and general slowness of the call seems specific to CSV code.
There is nothing in error log, I only see the incoming request in journal.
Environment
- Blockscout Version/branch: 4.1.2-beta
Steps to reproduce
Other than this appearing on older transactions and accounts with lots of them, I don't really have a good reproduction case.
curl 'https://songbird-explorer.flare.network/transactions-csv?address_id=0x96b83D3F73E44c9A96388CF1D116595551dAeB5A&from_period=2021-12-01&to_period=2021-12-31'