opencaching / opencaching-pl

The source code of Opencaching.PL (and some other domains)
https://opencaching.pl/
GNU General Public License v3.0
22 stars 33 forks source link

c:geo not refresh the geocache due to limits introduced to OCPL endpoints #2405

Closed pawelko-g closed 5 months ago

pawelko-g commented 5 months ago

The c:geo program does not refresh the geocache in a given number, but only a few at a time. Screenshot_20240624_193135_cgeo Screenshot_20240626_185038_cgeo Screenshot_20240624_194509_cgeo

deg-pl commented 5 months ago

It isn't OC PL code related problem, but site/user related.

mzylowski commented 5 months ago

@deg-pl I'm so surprised by your answer from above, and also I just read the Facebook discussion with @pawelko-g about this issue. This is so technically incorrect from so many points of view that I'm shocked you're still pushing for this approach.

The rate limits you introduced to the OC server are an undocumented breaking change for OKAPI. @pawelko-g was using c:geo before your changes, but now you blame him for making too much traffic to the OCPL server. He is just an end-user of the opencaching site, and he sends his requests via the C: Geo app that he downloaded from Google Play. Why are you expecting the end user to stick to those limits just by using the app?

The 'actor' responsible for the violation of those rate limits is not pawelko, but the application (in this ticket it is c:geo, but there are a lot of others app affected by your change now). If you @deg-pl want to still keep these rate limits, you need to at least communicate about them to all OKAPI developers and at least add info about them to OKAPI documentation. However, the effort that needs to be made on the apps developer side to make possible use of opencaching data is so extreamlly huge (moving calling okapi to separate threads, some sleeps to avoid your limits etc), that I believe they need some time before those rate limits will be introduced. For now, you should do the rollback of those changes.

My proposal to mitigate the issue:

Short-term solutions if you still want to keep those ridiculous limits:

As long as OCPL end users are banned due to those limits, this is a high-priority issue caused by a misconfiguration of the OCPL server.

P.S: my other personal applications that using OKAPI are also broken now :( P.S2, EDIT: How small those limits are that c:geo is not able even to download 8 geocaches?

deg-pl commented 5 months ago

@pawelko-g is the only user I know who has such a problem with c:geo. If the problem is actually related to limiting the number of queries, it is still not a problem related to the OC PL code.

Added later: The current limit is 200/second and this causes a soft ban of only 2 seconds The limit is the result of a DOS attacks on the server and has been in effect for many months.

mzylowski commented 5 months ago

@pawelko-g is the only user who reported this issue. The other users don't know what to do, and blame c:geo for hanging the update procedure.

deg-pl commented 5 months ago

@pawelko-g started a discussion on Facebook in the OC group, but no one else confirmed the problem.

mzylowski commented 5 months ago

There is reproduction from my side Screenshot_2024-06-27-07-57-27-775_cgeo.geocaching.jpg

Now you will take responsibility for your changes?

deg-pl commented 5 months ago

@mzylowski Please provide steps to reproduce the problem

mzylowski commented 5 months ago
  1. Download GPX for GeoPath (50 caches will be enough for sure) -> https://opencaching.pl/powerTrail.php?ptAction=showSerie&ptrail=912
  2. Import downloaded GPX to c:geo
  3. Refresh list of geocaches

'Odwiez wszystkie' menu option Screenshot_2024-06-27-08-06-06-928_cgeo.geocaching.jpg

stefopl commented 5 months ago

A quick test: I'm using the map to download caches in my area. I have 200 caches to download offline, in my case it looked like this:

When downloading, I can select the option in c:geo to do nothing with the downloaded caches and continue downloading more.

deg-pl commented 5 months ago

Thanks @mzylowski. Now I can reproduce problem. This makes it much easier to find a solution.

Server logs indicate that, in addition to OKAPI queries, images are being downloaded to caches. The logs also indicate that the real limits are lower than those I configured (both the number of queries and the time unit in which it is tracked).

deg-pl commented 5 months ago

@pawelko-g @mzylowski @stefopl Could you please check again? Now the limiter seems to behave in accordance with the assumed configuration.

stefopl commented 5 months ago

@deg-pl I intentionally chose more. Download completed successfully 264/264. Thanks

mzylowski commented 5 months ago

After your intervention I was able to successfully refresh entire 'Rowerowe Pomorze' geopath (the biggest GP in our service)

Screenshot_2024-06-27-09-22-16-685_cgeo.geocaching.jpg

Screenshot_2024-06-27-09-27-13-027_com.synology.projectkailash.jpg

Thanks!

How the limits are set currently?

deg-pl commented 5 months ago

There are two limits:

The first limiter did not work properly and took the default value (5) instead of the one I set.

pawelko-g commented 5 months ago

@deg-pl @mzylowski @stefopl Thank you for your help. It also works fine for me now.

andrixnet commented 5 months ago

There are two limits:

* "single page" limit (number of views of a single page/single OKAPI endpoint calls per second): 150/s

* "entire site" limit: 200 views/s

The first limiter did not work properly and took the default value (5) instead of the one I set.

Where/how are these limits configurable per OC site?

deg-pl commented 5 months ago

@andrixnet These limits are not OC PL code related. We use "evasive" as additional Apache2 module.