Bug 474281

Summary: kgapi gets token expired and retries indefinitely
Product: [Frameworks and Libraries] libkgapi Reporter: Luiz Angelo De Luca <luizluca>
Component: GeneralAssignee: Daniel Vrátil <dvratil>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Luiz Angelo De Luca 2023-09-08 02:25:52 UTC
SUMMARY

I noticed that my HDD was emitting a sound in at a specific rate (4/s). Checking logs, I noticed:

...
set 07 23:15:44 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
set 07 23:15:45 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
set 07 23:15:45 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
set 07 23:15:45 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
set 07 23:15:45 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
set 07 23:15:46 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
...

Besides being annoying, this type of HDD exercise might not help extend its lifetime.

After I get Gmail authenticated, it is too easy to get this error. I don't believe google actually expired the token as it might happen even in less than a day. I have already reconfigured the google account dozens of times.


STEPS TO REPRODUCE
1. Configure google account
2. Use for a couple of days
3. Check logs

OBSERVED RESULT

4. Endless sequence of the same error message

EXPECTED RESULT

4. If it is really an expired token, it should desist and ask the user for a new token. However, it might be a different type of error. I don't see google token expire as fast as this.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 23.04
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
I'm only using packages from official ubuntu repo.
Comment 1 Luiz Angelo De Luca 2023-09-08 02:36:12 UTC
The PID 13483 is:

/lib/x86_64-linux-gnu/libexec/kf5/kioslave5 /usr/lib/x86_64-linux-gnu/qt5/plugins/kf5/kio/gdrive.so gdrive  local:/run/user/1000/dolphinKfTdSY.4.kioworker.socket

It didn't stop even after I removed the account. If it helps, after I removed the account, this is the strace I got from that process (it repeates these lines):

write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\2\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd9f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\2\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
fcntl(36, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=124, l_len=1}) = 0
fcntl(36, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=124, l_len=1}) = 0
newfstatat(AT_FDCWD, "/home/luizluca/.local/share/accounts/services/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/share/plasma/accounts/services/kde/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/share/plasma/accounts/services/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/share/gnome/accounts/services/kde/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/share/gnome/accounts/services/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/share/accounts/services/kde/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/share/accounts/services/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/share/accounts/services/kde/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/share/accounts/services/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/var/lib/snapd/desktop/accounts/services/kde/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/var/lib/snapd/desktop/accounts/services/.service", 0x7fff8e8fd360, 0) = -1 ENOENT (No such file or directory)
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, -1) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\1\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x7fb998d60910, FUTEX_WAKE_PRIVATE, 1) = 1
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x7fff8e8fd000, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\3\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x558d84659f30, FUTEX_WAKE_PRIVATE, 1) = 1
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\3\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x7fff8e8fcfe0, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable)
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x7fff8e8fcfe0, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable)
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\3\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\2\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, -1) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\1\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, -1) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\2\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd7f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\5\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd9f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x7fff8e8fd510, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable)
write(13, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x7fff8e8fd4f0, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
write(11, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, 0) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\3\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd9f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(49, "\1\0\0\0\0\0\0\0", 8)        = 8
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=30, events=POLLIN}, {fd=33, events=POLLIN}], 4, -1) = 1 ([{fd=11, revents=POLLIN}])
read(11, "\6\0\0\0\0\0\0\0", 8)         = 8
read(11, 0x7fff8e8fd9f0, 8)             = -1 EAGAIN (Resource temporarily unavailable)
write(2, "org.kde.kgapi: Unauthorized. Acc"..., 69) = 69

Sorry, I didn't got it before removing the account.

After I tried to readd it, It does not pass the google login dialog that asks for my email/phone. And if I reload, I get:

set 07 23:32:46 bob com.nokia.singlesignonui[16345]: browser-request.cpp 754 initializeField Couldn't find element: "input[name=Email]"
set 07 23:32:46 bob com.nokia.singlesignonui[16345]: browser-request.cpp 754 initializeField Couldn't find element: "input[name=Passwd]"

(together with the other continuous error).

When I killed the kioslave5 process, I got:

...
set 07 23:33:54 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
set 07 23:33:54 bob plasmashell[13483]: org.kde.kgapi: Unauthorized. Access token has expired or is invalid.
set 07 23:33:54 bob plasmashell[16462]: kf5.kio.gdrive: Expired or missing access/refresh token for account "google30"
set 07 23:33:54 bob plasmashell[16462]: kf5.kio.gdrive: Expired or missing access/refresh token for account "google30"
...

With that message repeating still dozens of times until it died