mrvladus / Errands

Todo application for those who prefer simplicity.
MIT License
268 stars 65 forks source link

Synchronization error, always re-appearing "Errands was updated - restart" dialog and crash #275

Closed major-mayer closed 1 month ago

major-mayer commented 1 month ago

When I start Errands and capture the logs in the console, I see a couple of synchronization errors:

LANG=C errands                                                                   INT ✘  1m 7s  

(errands:32473): Gtk-WARNING **: 18:50:43.045: Unknown key gtk-button-images in /home/laurenz/.config/gtk-4.0/settings.ini

(errands:32473): Gtk-WARNING **: 18:50:43.045: Unknown key gtk-menu-images in /home/laurenz/.config/gtk-4.0/settings.ini

(errands:32473): Gtk-WARNING **: 18:50:43.045: Unknown key gtk-modules in /home/laurenz/.config/gtk-4.0/settings.ini

(errands:32473): Gtk-WARNING **: 18:50:43.045: Unknown key gtk-toolbar-style in /home/laurenz/.config/gtk-4.0/settings.ini

-------------------------------------------------
Starting Errands 46.0.6 at "2024 13 Mai 18:50:43"
-------------------------------------------------

[DEBUG] Application: Startup
[DEBUG] Data: Initialize
[DEBUG] Data: Read data
[DEBUG] GSettings: Initialize
[DEBUG] Application: Checking autostart
[DEBUG] Main Window: Load
[DEBUG] Today Page: Load
[DEBUG] Today Page: Update UI
[DEBUG] Trash Page: Load
[DEBUG] Sidebar: Load Task Lists
[DEBUG] Sidebar: Add Task List 'mein-kalendar'
[INFO] Task List mein-kalendar: Load Tasks
[DEBUG] Task List 'mein-kalendar': Update title
[DEBUG] Task List Row: Update UI 'mein-kalendar'
[DEBUG] Sidebar: Add Task List 'familienkalender'
[INFO] Task List familienkalender: Load Tasks
[DEBUG] Data: Write data
[DEBUG] Task List 'familienkalender': Update title
[DEBUG] Task List Row: Update UI 'familienkalender'
[DEBUG] Sidebar: Add Task List 'fbe9db1e-f3b8-4fd9-a4b7-e72ffd4af2eb'
[INFO] Task List fbe9db1e-f3b8-4fd9-a4b7-e72ffd4af2eb: Load Tasks
[DEBUG] Data: Write data
[DEBUG] Task List 'fbe9db1e-f3b8-4fd9-a4b7-e72ffd4af2eb': Update title
[DEBUG] Task List Row: Update UI 'fbe9db1e-f3b8-4fd9-a4b7-e72ffd4af2eb'
[DEBUG] Sidebar: Select last opened page
[INFO] Sync: Initialize sync provider
[DEBUG] Application: Activate
[INFO] Sync: Initialize 'Nextcloud' sync provider
[DEBUG] Sync: Checking credentials
[DEBUG] Sync: Checking URL
[DEBUG] Sync: URL is set to https://nc.example.com/remote.php/dav
[DEBUG] Sync: Attempting connection
[DEBUG] Sidebar: Open Today
[DEBUG] Today Page: Update UI
[INFO] Sync: Connected to Nextcloud server at 'https://nc.example.com/remote.php/dav'
[INFO] Sync: Sync tasks with remote
[DEBUG] Sidebar: Switch to list 'mein-kalendar'
[DEBUG] Sync: Getting tasks for list 'mein-kalendar'
[DEBUG] Sync: Update remote task '319909893423415050'
[ERROR] Sync: Can't update task on remote '319909893423415050'. At line 9: In transformToNative, unhandled exception on line 9: <class 'AttributeError'>: 'datetime.date' object has no attribute 'tzinfo' (<COMPLETED{'VALUE': ['DATE']}20240513>)
[DEBUG] Sync: Update remote task '208654062485186486'
[ERROR] Sync: Can't update task on remote '208654062485186486'. At line 9: In transformToNative, unhandled exception on line 9: <class 'AttributeError'>: 'datetime.date' object has no attribute 'tzinfo' (<COMPLETED{'VALUE': ['DATE']}20240513>)
[DEBUG] Sync: Update remote task '2642709390126514361'
[ERROR] Sync: Can't update task on remote '2642709390126514361'. PutError at '415 Unsupported Media Type

b'<?xml version="1.0" encoding="utf-8"?>\n<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">\n  <s:exception>Sabre\\DAV\\Exception\\UnsupportedMediaType</s:exception>\n  <s:message>Validation error in iCalendar: The supplied value (20240427T000000\\) is not a correct DATE-TIME</s:message>\n</d:error>\n'', reason no reason
[DEBUG] Sync: Update remote task '494771547503334086'
[ERROR] Sync: Can't update task on remote '494771547503334086'. At line 9: In transformToNative, unhandled exception on line 9: <class 'AttributeError'>: 'datetime.date' object has no attribute 'tzinfo' (<COMPLETED{'VALUE': ['DATE']}20240513>)
[DEBUG] Sync: Getting tasks for list 'familienkalender'
[DEBUG] Sync: Getting tasks for list 'fbe9db1e-f3b8-4fd9-a4b7-e72ffd4af2eb'
[DEBUG] Data: Clean deleted
[DEBUG] Sync: Update UI
[DEBUG] Data: Write data
[DEBUG] Data: Write data
[DEBUG] Task List 'fbe9db1e-f3b8-4fd9-a4b7-e72ffd4af2eb': Update title
[DEBUG] Task List 'mein-kalendar': Update title
[DEBUG] Task List 'familienkalender': Update title
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
[DEBUG] Notifications: Check
Failed to register: Timeout was reached

I am syncing my tasks to a Nextcloud instance.

This wouldn't bother me much, since everything else seems to be working, but for some reason this dialog always appears after a few minutes: grafik The app freezes and I can't click on the restart button. Eventually it will crash anyway.

If there's anything you could need for debugging, feel free to tell me.

32GBRat commented 1 month ago

As far as I can tell this dialog means that there is newer version of Errands installed than you are currently running. This should be resolved by hard closing the application using system monitor or any alternative method (just closing the window won't work since the app is still running in the background).

Regarding the crash, it is hard to tell what is the cause. The logs don't show much and I'm not able to reproduce on the latest build. I was able to reproduce similar symptoms only by purposefully setting the command that should restart the app (application.py:51) to something that does not exit (eg. the yes command) and runs forever.

mrvladus commented 1 month ago

I disabled update message here 9d5943a479e1dd6347959eb0c597b48dec35a8b7 for now. About sync error, I can't replicate it, maybe python-caldav bug. I wanted to just write ical data directly instead of relying on caldav library for types conversion anyway, so maybe it will fix it.

major-mayer commented 1 month ago

Weird... So I checked if the message appears again when i forcefully close the app using the tasks manager and it's still the case. However, I noticed that when i click the restart button, it actually spawns a second instance of Errands, but still the original application freezes and the new instance never appears. Maybe the original application doesn't really crash (I also can't find any core dumps or so) but just exists after a while when this timeout, mentioned in the logs, is reached? Could it be that the command to launch another instance of the app needs to be modified so that the new process gets detached?

And thanks for the information about the caldav error. Let me know when you made the change, so I can test it.

Edit: Yeah, it really seems like the use of os.system() could cause issues when restarting the app, since it waits on some platforms for the return value: https://stackoverflow.com/questions/8246520/does-pythons-os-system-wait-for-an-end-of-the-process

mrvladus commented 1 month ago

I'll change it to use subprocess module tomorrow and make new release. Should fix the issue.

major-mayer commented 1 month ago

Sounds great. Thanks for the fast response.

AlexanderShad commented 1 month ago

Hello. This error is reproduced on ALT Regular Sisyphus (ALT Linux) DE: GNOME 46.1

mrvladus commented 1 month ago

I've pushed new update to flathub.

7system7 commented 1 month ago

Omg. This issue is so frustrating. And sadly, it occurs in every ~1 minute. :cry: In the last 5-10 days there are a lot of error, before that it was an awesome app...

Another issue is that, I had a test task what has a due date. After a while I checked it out, after I deleted it, but it notifies me absolute randomly since then. (Today, I emptied the trash bin, so I hope...)

Sorry for the attitude, I really loved this app until now.

major-mayer commented 1 month ago

I've pushed new update to flathub.

All right, I will wait until the update is also on the AUR and let you know if it fixed my issue then.

32GBRat commented 1 month ago

@7system7 You should probably open a new issue so it can get resolved.

Another issue is that, I had a test task what has a due date. After a while I checked it out, after I deleted it, but it notifies me absolute randomly since then. (Today, I emptied the trash bin, so I hope...)

mrvladus commented 1 month ago

@32GBRat it's already opened: #276. And I fixed it in 344ac1763a95b0c1edeb0c2e43257960328cb9a3. Will be in 46.1.1

32GBRat commented 1 month ago

Sorry, missed that. Thanks for notifying me.