Antergos / web-greeter

A modern, visually appealing greeter for LightDM.
http://antergos.github.io/web-greeter
GNU General Public License v3.0
233 stars 57 forks source link

Changing css background image freezes greeter #99

Open FallingSnow opened 7 years ago

FallingSnow commented 7 years ago

I'm using lightdm-webkit2-material2. As soon as you change the background image in css, the greeter freezes.

It doesn't output anything to the console, just freezes entirely.

/var/log/lightdm/xremote0-greeter.log:

** (process:25465): WARNING **: Failed to open CK session: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ConsoleKit was not provided by any .service files
http://localhost:8080/bundle.js:8472:14: CONSOLE LOG [HMR] Waiting for update signal from WDS...
http://localhost:8080/bundle.js:8531:15: CONSOLE DEBUG Loading Theme
http://localhost:8080/bundle.js:30795:23: CONSOLE DEBUG Main loaded. [object Object]
http://localhost:8080/bundle.js:75762:23: CONSOLE DEBUG App loaded. [object Object]
http://localhost:8080/bundle.js:87862:23: CONSOLE DEBUG Background loaded. [object Object]
http://localhost:8080/bundle.js:87911:23: CONSOLE DEBUG Updated background. image
http://localhost:8080/bundle.js:87919:23: CONSOLE DEBUG Clock Locale set to: en
http://localhost:8080/bundle.js:105888:23: CONSOLE DEBUG Login loaded. [object Object]
http://localhost:8080/bundle.js:20574:29: CONSOLE ERROR Not allowed to load local resource: file:////var/lib/AccountsService/icons/ayrton
http://localhost:8080/bundle.js:82686:23: CONSOLE DEBUG Footer loaded. [object Object]
http://localhost:8080/bundle.js:82794:26: CONSOLE WARN Hibernate not supported.
http://localhost:8080/bundle.js:19781:16: CONSOLE ERROR Not allowed to load local resource: file:////var/lib/AccountsService/Art/bg10.jpg
http://localhost:8080/bundle.js:673:22: CONSOLE LOG [WDS] Hot Module Replacement enabled.

** (lightdm-webkit2-greeter:25477): WARNING **: Error running javascript: An exception was raised in JavaScript
Gdk-Message: lightdm-webkit2-greeter: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.
lots0logs commented 7 years ago

Could you post your greeter config file here?

FallingSnow commented 7 years ago
#
# [greeter]
# debug_mode          = Greeter theme debug mode.
# detect_theme_errors = Provide an option to load a fallback theme when theme errors are detected.
# screensaver_timeout = Blank the screen after this many seconds of inactivity.
# secure_mode         = Don't allow themes to make remote http requests.
# time_format         = A moment.js format string so the greeter can generate localized time for display.
# time_language       = Language to use when displaying the time or "auto" to use the system's language.
# webkit_theme        = Webkit theme to use.
#
# NOTE: See moment.js documentation for format string options: http://momentjs.com/docs/#/displaying/format/
#

[greeter]
debug_mode          = true
detect_theme_errors = true
screensaver_timeout = 300
secure_mode         = false
time_format         = LT
time_language       = auto
webkit_theme        = material-git

#
# [branding]
# background_images = Path to directory that contains background images for use by themes.
# logo              = Path to logo image for use by greeter themes.
# user_image        = Default user image/avatar. This is used by themes for users that have no .face image.
#
# NOTE: Paths must be accessible to the lightdm system user account (so they cannot be anywhere in /home)
#

[branding]
background_images = /usr/share/backgrounds
logo              = /usr/share/lightdm-webkit/themes/antergos/img/antergos.png
user_image        = /usr/share/lightdm-webkit/themes/antergos/img/antergos-logo-user.png

I've tried it with antergos as well. As soon as you open developer tools and try to change the background image the greeter crashes.

lots0logs commented 7 years ago

The path you are attempting to access is not located anywhere that themes are allowed access. The only paths that are accessible to themes are the paths listed in the greeter config file as well as the data directory provided by lightdm. The data directory is "per-user" so themes should authenticate the user before attempting to store or access files in the data directory lightdm provides for the user. On second thought, authentication isn't necessary as no private data should ever be stored in the users' data directory. Let me know if you have any questions :smile:

FallingSnow commented 7 years ago

I don't think it's an issue of attempting to access unauthorized files, perhaps files that don't exist. I loaded the antergos theme, opened developer tools, selected the background element which had something/sandstone.jpg loaded at the moment. I clicked the end of sandstone and press backspace, wait about 300ms and the theme locks up. First the dev tools go black, then the rest of the screen.

Even if this is only the case when the requested file cannot be found, I don't think the greeter should lock up.

lots0logs commented 7 years ago

CONSOLE ERROR Not allowed to load local resource: file:////var/lib/AccountsService/Art/bg10.jpg

I think its locking up b/c of an infinite recursion that occurs when the above error is output to the log. I'll look into it asap.

lots0logs commented 7 years ago

In case its something else, could you check to see if anything shows up in your systemd journal that looks like it could be related?

FallingSnow commented 7 years ago

CONSOLE ERROR Not allowed to load local resource: file:////var/lib/AccountsService/Art/bg10.jpg

I think this is actually happening because the host is http://localhost:8080 but I imagine it would happen if the theme was built too.

Oh man, there is a huge dump in journalctl. http://pastebin.com/9DCW1K5V

BTW, I didn't mean to bother you on Christmas eve, please enjoy your night instead of worrying about this.

lots0logs commented 7 years ago

No worries, you aren't keeping me. I'm just checking emails periodically. I probably won't have time to really look into this until Monday.

I think this is actually happening because the host is http://localhost:8080 but I imagine it would happen if the theme was built too.

Hmm..so you arent loading the greeter normally? Does the issue happen if you load the greeter normally (aka reboot and let lightdm start it)

FallingSnow commented 7 years ago

Yes, it does happen if I use the greeter normally. (I did dm-tool lock)

lots0logs commented 7 years ago

Could you test the latest version and let me know if the issue persists?

FallingSnow commented 7 years ago

lightdm-webkit2-greeter 2.2.1-1 gives the same result. Restarted lightdm and used it in an actual login, still locked up.

lots0logs commented 7 years ago

Could you post the bg image here so I can test it locally?

FallingSnow commented 7 years ago

background-image: url(file:///var/lib/AccountsService/A), url(file:///usr/share/lightdm-webkit/themes/build/7e1eca6dd7f6935f8058845ed05cbff2.jpg);

Since the first one failed (it is neither a image nor a directory and as you stated earlier, not in a directory accessible by lightdm-webkit2-greeter) the second image displays. This all happens flawlessly. The issue arises when you try to change the background image. For example you would expect that by removing the A at the end from file:///var/lib/AccountsService/A that it would fail again and the fallback image would remain. But instead the greeter locks up and crashes.

So to answer your question lol, there is no image I am trying to load.

lots0logs commented 7 years ago

Hmm..I dont think this is a bug in the greeter. I think its an issue in webkitgtk :thinking:

FallingSnow commented 7 years ago

:disappointed: Can you point me in the right direction to report the bug please?

lots0logs commented 7 years ago

Reporting bugs to webkitgtk requires some effort. You have to create a test case that they can use to reproduce the issue consistently. I'm not so sure its worth the effort in this case. I mean unless I'm misunderstanding the issue, it only occurs when you try to manipulate the HTML using the dev console (which is not really a high priority feature IMO). There are other ways by which to change the background image of an element that don't involve using the dev console :wink:

FallingSnow commented 7 years ago

Well it first arose while I was using my theme. My theme has an input box that allows you to change the background image location on the fly. But when you change the input and it in turn updates the url to the background image, it locks up. So it seems that it is not only related to the dev console.

I even went through the source code of the antergos theme and saw you were using jquery. So I tried to change the background using a button with an onClick event to update the background css via pure javascript, still locked up. :cry:

I still don't understand how the antergos theme is able to do it and I am not.

lots0logs commented 7 years ago

Hmm..It could be related to React. I've hit a few weird bugs using React with webkitgtk in the development of our installer. Though all of them were magically resolved when webkitgtk 2.14 was released. I'll try to take a look at what you have as soon as I have some time. If you could point me to the file that contains the related code that would be great :smiley:

FallingSnow commented 7 years ago

https://github.com/FallingSnow/lightdm-webkit2-material2/blob/master/src/components/Background.jsx#L89

lots0logs commented 7 years ago

About this:

My theme has an input box that allows you to change the background image location on the fly.

That won't really be possible as themes access to the filesystem is limited.

lots0logs commented 7 years ago

Thanks, I'll look more into it tonight. One thing I noticed already (but I doubt its a problem) is that you have one too many / characters here

FallingSnow commented 7 years ago

I know. But shouldn't it just fail if they attempt to access something they can't. The image should only load if the greeter is actually able to find it and can load it. So technically, as long as the enter the correct location it should work.

I realized the one to many slashes when I was giving you the background-image line above lol. I even tested to see if it was the issue before replying. But thanks anyway.

lots0logs commented 7 years ago

Yes you're right. Its definitely bugged behavior. I'm just not sure where its coming from. The core dump you posted doesnt include any helpful info. All the last calls leading up to the crash were optimized out by the compiler (they show as N/A). Might be a good idea to try running the greeter in-session with gdb to try and capture something useful.

FallingSnow commented 7 years ago

Thanks for confirming this, it's good to know I haven't just been missing a semicolon for the last day. Might approach a webkit2gtk dev with this later and ask if it's worth submitting a bug report.