Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-Second Incremental Input Lag in Information Fields #1788

Closed
3 tasks done
valtapaz opened this issue Aug 9, 2024 · 15 comments · Fixed by #1803
Closed
3 tasks done

Multi-Second Incremental Input Lag in Information Fields #1788

valtapaz opened this issue Aug 9, 2024 · 15 comments · Fixed by #1803
Assignees
Milestone

Comments

@valtapaz
Copy link

valtapaz commented Aug 9, 2024

Describe the bug
When editing information on a scraped movie, the "Information" and "Streamdetails" sections experience a dramatic slowdown, taking around 2 seconds per character, during which the app cannot be visually interacted with (one can click other fields, edit them, and click other movies, but this does not reflect visually until the writing is finished.

To Reproduce
Steps to reproduce the behavior:

  1. Click on a scraped movie
  2. Click a text field, such as "Sort Title"
  3. Type anything from a single character to multiple words

Expected behavior
The text field's contents would update more or less in real time to my typing.

MediaElch Version:

  • 2.10.6 (stable)
  • 2.10.7-dev (nightly, but a version a few weeks)

Operating System:

  • Linux (Fedora 40)

Additional context

  • This isn't an issue for text fields in the "Extended" or "Actors" sections, nor in the actual scraper window when searching for a movie.
  • This appears to be linked to keystrokes rather than the number of characters entered, as pasting even multiple words of text will take only 2 seconds.
  • Selecting a poster and other images also takes 2 seconds to process, which is most likely the same issue.
@bugwelle
Copy link
Collaborator

Thanks for reporting this issue! I have yet to figure out what the root cause is. It's as if something is written to disk synchronously.

@mihawk90
Copy link

mihawk90 commented Sep 7, 2024

Also experiencing this in the Plot and Outline fields by the way.

Tried straceing it but honestly I don't really know what I'm looking at (not strictly a programmer).

What I do notice is this whenever this happens:

write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
writev(4, [{iov_base="\22\0\7\0\6\0 \10x\1\0\0\6\0\0\0 \0\0\0\1\0\0\0\311\244\6\5", iov_len=28}], 1) = 28
[freezing here]
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
read(7, "m\0\0\0\0\0\0\0", 16)          = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
write(7, "\1\0\0\0\0\0\0\0", 8)         = 8
writev(4, [{iov_base="+\0\1\0", iov_len=4}], 1) = 4
[unfreeze]

This was selecting 3 characters, then hitting delete.

There are also hundreds of newfstatat events a second and a poll event every second or so but I filtered those out.

@bugwelle
Copy link
Collaborator

bugwelle commented Sep 8, 2024

Hi all,

I'm back from my vacation and tried looking into this issue. I was able to reproduce it using the AppImage only.

It's really strange. I have no idea why the AppImage is as slow as it is. The CPU spikes up to 100% while typing. Even if I extract the binary from the AppImage and then start it, the issue persists.

The only workaround at the moment is to build MediaElch yourself.
See https://mediaelch.github.io/mediaelch-doc/contributing/build/index.html

Regards,
Andre

@bugwelle
Copy link
Collaborator

bugwelle commented Sep 8, 2024

What's even stranger: if I try to start the binary using gdb, everything works as expected.
My assumption: it's the libraries that are shipped with the AppImage.

@ColetteDiskette
Copy link

ColetteDiskette commented Sep 16, 2024

I'm having this issue using mediaelch from Arch's extra repo. I'm in the middle of a bunch of work on my library that I want to finish first, but I will check back in once I try compiling via mediaelch-git from the AUR.

EDIT: So far, compiling it via the AUR is working smoother. I'll leave this instance open and see if the performance degrades as I continue to work on my library.

EDIT 2: A full day later with the same MediaElch instance open and actively using it and it's still just as snappy all around. Compiling locally seems to have fixed it. I don't know if this helps at all. I'll post again if it starts acting up.

@valtapaz
Copy link
Author

So, sometimes I'm finding the AppImage works fine now (same version), particularly if I open it for the first time in a few days (first startup after a reboot, perhaps?); there's still some delay, but a mere quarter second at most, so certainly manageable.

This has happened twice: the first time, I closed and reopened it to find the new version had the lag again, and today I decided to open a second instance at the same time and found that version also lagging, with the original instance remaining fine. Journalctl doesn't appear to say anything. Feels like a library/dependency issue of some kind, but not sure.

It's a stretch, but possibly related?: AppImage/AppImageKit#1351
If so, the next thing for me to test would be X11 or a non-KDE Wayland DE.

@mihawk90
Copy link

next thing for me to test would be X11

I'm on X11 KDE and getting this so it's not Wayland related.

@ColetteDiskette
Copy link

I'm on AwesomeWM (X11). I thought I had said that in my above post but apparently I neglected to.

@valtapaz
Copy link
Author

valtapaz commented Sep 30, 2024

Particularly if I open it for the first time in a few days (first startup after a reboot, perhaps?)

Just to follow up, a freeze happened the first time I opened it after rebooting, so bootup alone isn't the sole factor

@bugwelle
Copy link
Collaborator

bugwelle commented Oct 6, 2024

I tried different older "linuxdeployqt" versions, but was not successfull. However, v2.10.0 worked fine. I'll try to figure out the commit that made it so slow.

@bugwelle
Copy link
Collaborator

bugwelle commented Oct 6, 2024

Seems to be 516c8a5

516c8a5#diff-f2c7c599ccef7d34ec5477a9109f459dd0cfb02423120386e305b307fb8c997eL52

 auto movieIndex = qsizetype_to_int(m_movies.indexOf(movie));

This is a linear search... No idea why this slipped past me. Probably because it was "fast enough". Reverting the change makes the AppImage fast again.

Ah, no. It was a linear search before as well...
But it has to do with the model indices.

I'm working on a fix.

@bugwelle
Copy link
Collaborator

bugwelle commented Oct 6, 2024

I think to have fixed it with #1803

New nightly versions will be available shortly. It would be great, if you could test them.
If the performance bug is fixed, I'll finally release v2.12.0

@valtapaz
Copy link
Author

valtapaz commented Oct 7, 2024

Started the latest AppImage up a couple ways and it works perfectly for me; even the quarter-second delay I'd get when the previous one was at its best is gone, as is the 2s delay when selecting images. Thanks for the fix!

@bugwelle
Copy link
Collaborator

bugwelle commented Oct 7, 2024

Thanks for confirming!

@mihawk90
Copy link

mihawk90 commented Oct 7, 2024

Works for me as well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants