Giter Site home page Giter Site logo

Comments (4)

prahal avatar prahal commented on June 27, 2024

I found out I was not building "develop" branch from this git repository but I was testing the master branch.

I have this issue on master fixed locally by adding code to set the delay to wait until the next wall clock hour is reached if the "rate limit reached" exception has its rateLimitDuration attribute not set (as I sorted out that as of now Evernote API reset the API limit reached every new hour of the day).

My workaround for the master branch missing rateLimtDurataoin on the RATE_LIMIT_REACHED exception, which is not required because/if develop is merged to master:

From 17a9838d391231bbe54ea3705981ce76173c398e Mon Sep 17 00:00:00 2001
From: Alban Browaeys <[email protected]>
Date: Tue, 26 Sep 2023 01:34:16 +0200
Subject: [PATCH] Emulate rateLimitDuration when not set

I sorted out that currently the rate limit reached is reset hourly
on wall clock hour change, that is on every new hour of the day.

So when the rate limit reached exception triggers and the
rateLimitDuration attribute is not set, defaults to delay
until the next hour.

Fixes #210
---
 src/communication/communicationmanager.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/communication/communicationmanager.cpp b/src/communication/communicationmanager.cpp
index 69132c5f..f47abc2a 100644
--- a/src/communication/communicationmanager.cpp
+++ b/src/communication/communicationmanager.cpp
@@ -1066,8 +1066,10 @@ void CommunicationManager::handleEDAMSystemException(EDAMSystemException e, QStr
     }
 
     if (e.errorCode == EDAMErrorCode::RATE_LIMIT_REACHED) {
-        this->minutesToNextSync = e.rateLimitDuration / 60 + 1;
-
+        // Delay until the end of the current wall clock hour, if rateLimitDuration
+        //  for the rate limit raeched exception is not set.
+        int secondsUntilNextWallClockHour = (60 - QTime::currentTime().minute()) * 60;
+        this->minutesToNextSync = e.rateLimitDuration.value(secondsUntilNextWallClockHour) / 60 + 1;
 
         string endOfText = "minute";
         if (this->minutesToNextSync > 1)
-- 
2.40.1

You might want to close this issue as it is not reproducible on the develop branch (probably due to an upgraded fixed qevercloud).
Except if you do not intend to merge develop in master anytime soon in which case adding this workaround temporarily to the master branch and reverting it later on would help downstream.

from nixnote2.

prahal avatar prahal commented on June 27, 2024

@boo-yee I cannot see your comment on this issue, still answering.
The exception is not the same as in baumgarr#484 (comment) .
That is I do not get a handled error telling the sync will be retried later on. But an unhandled exception that prevents any further sync attempt.

Also, the fix for the linked issue is to upgrade from nixnote2 2.0 to 2.1 in the latest PPA when this issue was reported (2019).
I was already running 2.1.9+dfsg1-1 from Debian and 2.1.9-f9cbad25 .

Likely my issue has to do with qevercloud API changes. The non-handled exception triggered in the code to handle this rate limit exception, only the time to wait until the next attempt was not initialized.

Running 2.1.10 (develop branch) 9c02e8a5 with a newer embedded qevercloud code fixes this bug (but the code is not in master yet).

If the develop branch is not meant to be pushed to master soon, maybe it would be good for me to make a PR from the above patch I gave to emulate the time to wait until the next sync attempt, instead of the sync getting stuck in this unhandled exception forever (was stuck for days until I killed nixnote2 2.1.9 on my side).

Note that with Debian nixnote2 2.1.9+dfsg1-1 I get a different backtrace because someway the rate limit reached exception code is not detected at all (while if I rebuild the master branch,ie 2.1.9-f9cbad25, I get the error I reported initially, after the same amount of time and the same load. So likely the same server error is triggering the issue.

The Debian error I get is:

oct. 03 17:52:58 cyclope systemd[1921355]: Started app-gnome-nixnote2-1943211.scope - Application launched by gnome-shell.
oct. 03 17:52:58 cyclope nixnote2.desktop[1943211]: QSocketNotifier: Can only be used with threads started with QThread
oct. 03 17:52:58 cyclope nixnote2.desktop[1943211]: INFO  2023-10-03 17:52:58.471 src/utilities/crossmemorymapper.cpp:62 Shared memory segment allocated, instance key: "aad568d5-4e26-4182-9023-f553cba703552"
oct. 03 17:52:58 cyclope nixnote2.desktop[1943211]: INFO  2023-10-03 17:52:58.472 src/main.cpp:313 NixNote 2.1.9+dfsg1-1, build at Jun 13 2023 at 15:32:35, with Qt 5.15.8 running on 5.15.10
oct. 03 17:52:58 cyclope nixnote2.desktop[1943211]: INFO  2023-10-03 17:52:58.472 src/main.cpp:316 To get more detailed startup logging use --logLevel=1
oct. 03 17:58:22 cyclope nixnote2.desktop[1943211]: QPainter::setBackgroundMode: Painter not active
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: ERROR 2023-10-03 18:10:00.418 src/communication/communicationmanager.cpp:537 Exception stacktrace:
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /usr/bin/nixnote2(_ZN20CommunicationManager11reportErrorEN18CommunicationError22CommunicationErrorTypeEiRK7QStringS4_+0x5e)[0x55947b68c85e]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /usr/bin/nixnote2(_ZN20CommunicationManager25handleEDAMSystemExceptionEN10qevercloud19EDAMSystemExceptionE7QString+0xfc)[0x55947b68e21c]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /usr/bin/nixnote2(+0xf26c0)[0x55947b5d96c0]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /usr/bin/nixnote2(_ZN10SyncRunner17syncRemoteToLocalEi+0x573)[0x55947b8f91d3]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /usr/bin/nixnote2(_ZN10SyncRunner12evernoteSyncEv+0x69d)[0x55947b8fc8fd]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /usr/bin/nixnote2(_ZN10SyncRunner11synchronizeEv+0x44e)[0x55947b8fcf9e]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN7QObject5eventEP6QEvent+0x290)[0x7f87632ef400]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Widgets.so.5(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x7e)[0x7f8767562d2e]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /usr/bin/nixnote2(_ZN11Application6notifyEP7QObjectP6QEvent+0x2c)[0x55947b636c4c]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent+0x118)[0x7f87632c30d8]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData+0x191)[0x7f87632c66d1]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(+0x31d1e3)[0x7f876331d1e3]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x571b4)[0x7f8760a371b4]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x5a2d7)[0x7f8760a3a2d7]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x30)[0x7f8760a3a8f0]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x66)[0x7f876331c8d6]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0x12b)[0x7f87632c1b7b]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN7QThread4execEv+0x5e)[0x7f87630d8dde]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libQt5Core.so.5(+0xd9ffd)[0x7f87630d9ffd]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libc.so.6(+0x883ec)[0x7f8762aa63ec]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: /lib/x86_64-linux-gnu/libc.so.6(+0x108a2c)[0x7f8762b26a2c]
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: ERROR 2023-10-03 18:10:00.421 src/communication/communicationerror.cpp:88 "EDAMSystemException[code=1664849920]: EDAMSystemException: UNRECOGNIZED_ERROR_CODE"
oct. 03 18:10:00 cyclope nixnote2.desktop[1943211]: ERROR 2023-10-03 18:10:00.421 src/threads/syncrunner.cpp:278 Error retrieving chunk

from nixnote2.

robert7 avatar robert7 commented on June 27, 2024

just merged develop to master

from nixnote2.

prahal avatar prahal commented on June 27, 2024

Thanks. Closing.
The fix has reached Debian testing.

from nixnote2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.