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

Site logo disappearing #2454

Closed
4 tasks done
kroese opened this issue May 11, 2024 · 32 comments
Closed
4 tasks done

Site logo disappearing #2454

kroese opened this issue May 11, 2024 · 32 comments
Labels
bug Something isn't working
Milestone

Comments

@kroese
Copy link
Contributor

kroese commented May 11, 2024

Requirements

  • This is a bug report, and if not, please post to https://lemmy.ml/c/lemmy_support instead.
  • Please check to see if this issue already exists.
  • It's a single bug. Do not report multiple bugs in one issue.
  • It's a frontend issue, not a backend issue; Otherwise please create an issue on the backend repo instead.

Summary

Around Lemmy 0.19.4 beta 3 and higher I run into the issue that the site logo (and profile picture for the admin) are frequently disappearing.

My guess is to what happens is that when you edit the Admin settings or the Profile settings it does not load the current picture correctly (the box stays empty) and as soon as you save your modifications, this will clear the existing logo/picture.

So currently I workaround it by everytime uploading the logo again when I edit any settings on those pages, to prevent the existing logo from disappearing.

Would be nice to see this fixed before the official 0.19.4 is released, because Im sure this will affect a lot of people.

Steps to Reproduce

  1. Edit Admin settings
  2. Hit save
  3. Check site logo
  4. Logo disappeared

Technical Details

Samsung Internet browser on Android

Lemmy Instance Version

0.19.4-beta.6

Lemmy Instance URL

No response

@kroese kroese added the bug Something isn't working label May 11, 2024
@SleeplessOne1917
Copy link
Member

I tested this locally. I was able to reproduce the issue with the site logo, but not a user profile picture. I also noticed that the user settings reload the page on save, where the site settings do not. I'll address the issue I found with the site settings.

@kroese
Copy link
Contributor Author

kroese commented May 13, 2024

@SleeplessOne1917 Strange that you dont have it with the admin user picture. I must say, in my case the site logo is identical to the profile picture of the admin user. So it could be that they are stored by their hash, and if the site logo gets removed it automaticly deletes the profile picture of the admin user (as they have an identical hash value?).

@SleeplessOne1917
Copy link
Member

What routes are you on when editing the site logo vs the admin user profile picture?

@kroese
Copy link
Contributor Author

kroese commented May 13, 2024

If you mean the URLs? They are /admin and /settings.

@SleeplessOne1917
Copy link
Member

So you are using the right routes. When you say the site logo is identical to the admin logo, do you mean that you are separately setting them to the same image, or that setting one sets the other?

@kroese
Copy link
Contributor Author

kroese commented May 13, 2024

I mean that I am separately setting them to the same image, so uploading the same file twice.

Another thing that might be different between your local testing and my situation is that I use fairly heavy caching (both in the nginx config for lemmy-ui, and Cloudflare caching on top of that). So if one of the pages in settings somehow sends the wrong headers that allow it to be cached, it will not be a problem during your tests, but will be a problem during mine.

@SleeplessOne1917
Copy link
Member

Currently, lemmy-ui doesn't set any cache related headers on requests. It does set cache control headers on responses though: https://github.com/LemmyNet/lemmy-ui/blob/main/src/server/middleware.ts#L37-L65

@kroese
Copy link
Contributor Author

kroese commented May 14, 2024

Yeah, I was only thinking in that direction because you mentioned something about "reload the page on save" so I thought maybe the caching interferes with the reload for the profile picture for example.

Anyway, if you could just fix this for the site logo it would already be great!

@SleeplessOne1917
Copy link
Member

The PR for the admin settings fix is merged. @kroese let us know if you still run into this problem once the latest release is out.

@kroese
Copy link
Contributor Author

kroese commented May 23, 2024

Today I lost the site logo again, after upgrading v0.19.4-beta.7 to v0.19.4-rc.1.

This time I am 100 percent sure that I did not modify any Administrator settings. Its possible that I viewed that page quickly, but I never hit the Save button for sure.

So there are more ways to loose the site logo, besides hitting Save on that page.

@SleeplessOne1917
Copy link
Member

Is there a reproducible set of steps that consistently causes this bug? I'm currently at a loss as to what could be causing this problem.

@SleeplessOne1917
Copy link
Member

@kroese
Copy link
Contributor Author

kroese commented May 31, 2024

@SleeplessOne1917 Yes, thanks! Subscribed to that issue now

@kroese
Copy link
Contributor Author

kroese commented Jun 2, 2024

@SleeplessOne1917 It seems I can reproduce this issue just by restarting the lemmy/pictrs containers. So it has nothing to do with version updates, the only relation is that when doing a version upgrade, the containers gets restarted.

So I set the site logo, it works, I restart the container, site logo is gone.

I am not sure if this is even a bug in Lemmy, as it could be an issue with Pict-RS as well (Im using 0.5.14).

@SleeplessOne1917
Copy link
Member

@asonix Have you or any other users of pict-rs encounter a similar issue?

@kroese
Copy link
Contributor Author

kroese commented Jun 2, 2024

Okay, this is definitely a pict-rs issue, I get this error in my log:

update or delete on table "aliases" violates foreign key constraint "proxies_alias_fkey" on table "proxies"

The strange thing is that when uploading a picture, it is initially working fine. It just seems to get deleted when shutting down pict-rs.

@Nothing4You
Copy link

the way I read this issue previously was that the URL was just no longer in Lemmys database in the site configuration?

I've recently run into an issue on one of my test instances where suddenly, not sure what was leading up to this, pictrs started returning 404 site icon and banner, but the urls were still set in /api/v3/site, which lead lemmy-ui to return a white page just saying Server error.

since these seem to be two very different symptoms (image no longer being set in lemmy vs image being set but 404) i assumed my issue was different, but i didn't find enough time to investigate my issue properly yet.

@kroese
Copy link
Contributor Author

kroese commented Jun 2, 2024

@Nothing4You For the site logo, it seems the URL is no longer set in the database, as the Icon on the Admin Settings page is empty.

For the user profile, there is an URL set in the database, as the Icon shows a broken picture on the Settings page (because the image URL no longer exists in Pict-RS).

The issue you describe is listed here: #2211 , where a broken site logo will cause lemmy-ui to not run at all. But in my case it seems the database entry is reverted to empty.

@Nothing4You
Copy link

then I don't understand your previous #2454 (comment) here?

afaik there is no way for anything within pict-rs to be able to remove the link from lemmys db, so unless the image gets lost in pict-rs and lemmy notices the image being dead and removes it from it own db, the reference disappearing in lemmys db shouldn't possibly be originating from pict-rs?

#2211 is just for the follow-up issue in lemmy-ui, which should be addressed to reduce the impact of images not being loadable, but it doesn't explain the underlying issue of how we got to that situation in the first place. there is a possible reproduction case, although I haven't tested those steps yet, but that might be what happened in my case as well.

@dessalines dessalines added this to the 0.19.4 milestone Jun 3, 2024
@dessalines
Copy link
Member

Turns out this is likely a back-end issue, I think I know where the problem is, so I'll close this one.

@kroese
Copy link
Contributor Author

kroese commented Jun 4, 2024

@dessalines Great! But for me the issue occured under two circumstances:

  • When hitting save (which is fixed now)
  • When restarting the lemmy/pict-rs containers

And that last issue is still present, so is it possible to re-open this until this second problem is also fixed?

I am aware this might be a bug in pict-rs and not in lemmy-ui, but as pict-rs has no github repo, at least its reported somewhere then.

@dessalines
Copy link
Member

dessalines commented Jun 4, 2024

Let me try and see if I can replicate that.

What's your pictrs version?

cc @asonix

EDIT: Just tried to replicate, but couldn't by:

  • Saving a site logo.
  • Restarting all lemmy services

And the site icon is still there correctly.

Our pictrs tag is 0.5

@dessalines dessalines reopened this Jun 4, 2024
@kroese
Copy link
Contributor Author

kroese commented Jun 4, 2024

@dessalines 0.5.14 (the latest).

But as I see also this message in the logs of pict-rs:

update or delete on table "aliases" violates foreign key constraint "proxies_alias_fkey" on table "proxies"

im not sure if its related to the issue, but it looks like some Postgres migration went wrong.

The whole strange thing is that I can upload a new site logo / user profile picture just fine, and the images stay for a while. But if I restart the containers, the images are suddenly gone.

This are exactly the same symptoms as I had when hitting the "Save" button, but I can reproduce them without ever hitting "Save" or visiting the settings page, just by restarting the stack.

@asonix
Copy link

asonix commented Jun 4, 2024

@kroese if you just restart pictrs or just restart lemmy rather than restarting both do you see the image disappear? also I am working on a fix for that proxies foreign key issue (which is likely not related)

@dessalines
Copy link
Member

Its likely the failed migration (even if that table is unrelated, it means that the rest of the migration probably didn't continue).

@asonix
Copy link

asonix commented Jun 4, 2024

The migration didn't fail, proxy cleanup isn't happening in the correct order. I will get a fix out today.

proxy cleanup is unrelated to site icons, though, and if anything, this bug would prevent image deletion :p

@kroese
Copy link
Contributor Author

kroese commented Jun 4, 2024

@dessalines I lost the logo after updating the container from v0.19.4-rc.3 to v0.19.4-rc.4, then I lost it again after updating v0.19.4-rc.4 to v0.19.4-rc.5, all without visiting the Admin settings page. I also lost it by just restarting the container stack, so it does not seem related to the updating process, but just because it involves restarting.

The reason why I suspect Lemmy, and not Pict-RS is that the site logo field was actually cleared. If you try to start Lemmy-UI with a broken logo link, it will not even start (seperate issue). So it looked more like Lemmy forgot the link, instead of Pict-RS deleting the actual image.

@asonix I just tried it with restarting the containers individually (lemmy-ui, lemmy, pict-rs all seperate). But I was unable to reproduce it. But I have seem this issue so many times now in the past weeks, that Im sure I will run into it again, and then I will pay good attention which of the 3 is responsible.

@dessalines
Copy link
Member

The fix that closed this issue is in the new rc, 0.19.4-rc.6

@asonix
Copy link

asonix commented Jun 4, 2024

@kroese here's an idea: stop pict-rs, then restart lemmy, then start pict-rs. I wonder if it's checking if the logo image exists and failing due to pict-rs not being online yet

@dessalines
Copy link
Member

Anyways this isn't a lemmy-ui issue anymore, its a dupe of a back-end one: LemmyNet/lemmy#4763

@kroese
Copy link
Contributor Author

kroese commented Jun 4, 2024

I debugged this some more. I created a script to dump the value of icon every second via:

select icon,name from site where name='myinstance';

and it returned the URL to the site icon.

Then I immediately upgraded from rc.5 to rc.6 and as soon as it started, that database query started to return a blank field for icon.

When visiting the image URL that was previously there, it was still available. So this is definately not a pict-rs issue, there is just something that resets the icon field in the database, even though the picture is still available in pict-rs.

The difficulty here is that I when start/stop individual containers at random (lemmy/postgres/pictrs) I am not able to reproduce it. Only when they are restarted as a group (what typically happens when I do version updates in Portainer and have to edit the compose file of the group) it seems to occur.

Or maybe switching versions triggers some migration to be executed, that accidently clears the icon field?

@dessalines
Copy link
Member

This is not a lemmy-ui issue, use the other issue, or open up a new one on the lemmy repo, with specific steps using only rc.6 or main to recreate. I've tried setting an icon, and restarting voyager.lemmy.ml several times, and can't replicate this.

A restart or upgrade should not be clearing that site icon, or something is seriously wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants