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

Clightd service does not stop #58

Closed
tduboys opened this issue Jan 17, 2021 · 8 comments
Closed

Clightd service does not stop #58

tduboys opened this issue Jan 17, 2021 · 8 comments

Comments

@tduboys
Copy link

tduboys commented Jan 17, 2021

Hi,
I just installed a new Arch on a new hardware, and got an issue with clightd service. It does not stop…

Every time I shutdown my desktop, the service does not stop, even after 5 minutes…
If I manually restart the service, it's the same. Even if I send kill -9 signal, process does not stop

There is the journalctl log during a normal start and manual restart

janv. 17 22:35:33 minsk systemd[1]: Starting Bus service to manage various screen related properties (gamma, dpms, backlight)...
janv. 17 22:35:35 minsk systemd[1]: Started Bus service to manage various screen related properties (gamma, dpms, backlight).
janv. 17 22:35:37 minsk clightd[444]: Registered 'Als' sensor plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Camera' sensor plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Custom' sensor plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'YoctoLight' sensor plugin.
janv. 17 22:35:37 minsk clightd[444]:    No drm class cards found in /sys/class/drm
janv. 17 22:35:37 minsk clightd[444]: Registered 'Drm' gamma plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Wl' gamma plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Xorg' gamma plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Drm' dpms plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Wl' dpms plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Xorg' dpms plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Fb' screen plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Wl' screen plugin.
janv. 17 22:35:37 minsk clightd[444]: Registered 'Xorg' screen plugin.
janv. 17 22:35:37 minsk clightd[444]: (check_displays                ) Displays changed!
janv. 17 22:35:37 minsk clightd[444]: [63B blob data]
janv. 17 22:35:37 minsk clightd[444]: (check_displays                ) Current  connected displays: card0-DP-2
janv. 17 22:35:37 minsk clightd[444]: (dummy_display_change_handler  ) changes = Changed_Added
janv. 17 22:35:37 minsk clightd[444]: (dummy_display_change_handler  ) Added displays: card0-DP-2
janv. 17 22:35:38 minsk clightd[444]: Device does not support neither GREY nor YUYV nor MJPEG pixelformats.: Invalid argument
janv. 17 22:41:53 minsk systemd[1]: Stopping Bus service to manage various screen related properties (gamma, dpms, backlight)...
janv. 17 22:43:23 minsk systemd[1]: clightd.service: State 'stop-sigterm' timed out. Killing.
janv. 17 22:43:23 minsk systemd[1]: clightd.service: Killing process 444 (clightd) with signal SIGKILL.
janv. 17 22:44:53 minsk systemd[1]: clightd.service: Processes still around after SIGKILL. Ignoring.
janv. 17 22:46:23 minsk systemd[1]: clightd.service: State 'final-sigterm' timed out. Killing.
janv. 17 22:46:23 minsk systemd[1]: clightd.service: Killing process 444 (clightd) with signal SIGKILL.
janv. 17 22:47:53 minsk systemd[1]: clightd.service: Processes still around after final SIGKILL. Entering failed mode.
janv. 17 22:47:53 minsk systemd[1]: clightd.service: Failed with result 'timeout'.
janv. 17 22:47:53 minsk systemd[1]: clightd.service: Unit process 444 (clightd) remains running after unit stopped.
janv. 17 22:47:53 minsk systemd[1]: Stopped Bus service to manage various screen related properties (gamma, dpms, backlight).
janv. 17 22:47:53 minsk systemd[1]: clightd.service: Found left-over process 444 (clightd) in control group while starting unit. Ignoring.
janv. 17 22:47:53 minsk systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.

After time, the old process (PID 444 in this example) is still running.

I also have the CPU-load issue on clight but it's another topic : FedeDP/Clight#106

If someone have an idea about… It's unusual that SIGKILL cant stop a process
Thanks

@tduboys
Copy link
Author

tduboys commented Jan 19, 2021

I seen that my fresh system had 2 v4l devices detected (video0 and video1) for only one webcam (Logitech C270).
If I force the sensor plugin to use only video0, I dont have the stop issue again.
I also have a 3rd v4l device called media0, and I dont know what it is…

Edit: not all the time…
some times, I dont have CPU-load issue and non-stopping clightd issue, some times, I have both.
During my last shutdown, I got this message on the console and service failed to stop :

uvcvideo: Failed to query (SET_CUR) UVC control 4 on unit 1: -32 (exp. 4).
uvcvideo 1-9.4:1.0: reset_resume error -22

@FedeDP
Copy link
Owner

FedeDP commented Jan 19, 2021

Hi! Thanks for opening this issue!
It seems weird that clightd does not respond to sigkill (well it should work even with a normal sigterm/sigstop).
Honestly, i never heard about this issue; both of my laptops have "/dev/video0" and "/dev/video1" but i couldn't notice this issue.

I tried forcing same logical path as

Device does not support neither GREY nor YUYV nor MJPEG pixelformats.: Invalid argument

but again, i had no issue.
Maybe your "/dev/video1" device is somewhat faulty and freezes up clightd?
You can eg read here: https://unix.stackexchange.com/questions/541493/one-physical-device-mounts-two-dev-video-devices-which-will-cause-fswebcam-to
or here: https://unix.stackexchange.com/questions/512759/multiple-dev-video-for-one-physical-device
To find the correct device to use, clightd does some checks on both devices; maybe your faulty driver dies when /dev/video1 is checked...

Note also that Clightd does check that the devices has the VIDEO_CAPTURE cap (and, following this answer on SO, should be missing from second device (the metadata' one).
This is indeed the case on my laptop.

@tduboys
Copy link
Author

tduboys commented Jan 19, 2021

Hi, Thanks for your answer
I also seen that both vide0 and video1 are for the same webcam, I checked on a laptop and seen the same. Both devices have Video and Metadata Captures features.
At this moment, forcing video0 made Clight working.

The message Device does not support neither GREY nor YUYV nor MJPEG pixelformats.: Invalid argument appears on systemd logs for clightd service, before I'm log in on the session (and launching clight), but on the clight side, I see that the captor /dev/video0 is available and all seems to work.

Another error message I seen on clightd logs is No drm class cards found in /sys/class/drm, but I can see my videocard on /sys/class/drm/card0, but it's a new AMD card, and maybe the amdgpu drivers are not fully compatible on the drm side.

Is there a way to disable some plugins on clightd side ? Just to restrict to the minimal.

Edit: I've a new idea. I seen that clightd uses ddcutil, but if I launch ddcutil using sudo, the command did not respond, and a kill -9 command did not stop the process…
Maybe clightd is blocked on a call to ddcutil ? Seems related to rockowitz/ddcutil#159

@FedeDP
Copy link
Owner

FedeDP commented Jan 19, 2021

Hi!

Edit: I've a new idea. I seen that clightd uses ddcutil, but if I launch ddcutil using sudo, the command did not respond, and a kill -9 command did not stop the process…
Maybe clightd is blocked on a call to ddcutil ?

Yep, it seems an issue with ddcutil!
The following lines, from your log, show ddcutil's output:

janv. 17 22:35:37 minsk clightd[444]: No drm class cards found in /sys/class/drm
...
janv. 17 22:35:37 minsk clightd[444]: (check_displays ) Displays changed!
janv. 17 22:35:37 minsk clightd[444]: [63B blob data]
janv. 17 22:35:37 minsk clightd[444]: (check_displays ) Current connected displays: card0-DP-2
janv. 17 22:35:37 minsk clightd[444]: (dummy_display_change_handler ) changes = Changed_Added
janv. 17 22:35:37 minsk clightd[444]: (dummy_display_change_handler ) Added displays: card0-DP-2

This is the only ddcutil output i see in clightd's output.

May be you can open a bug report on ddcutil? I am pretty sure rockowitz will track this bug ;)

Btw great to hear that clight works fine when forcing video0!
And once more, let me thank you for writing this bug report and for taking the time to test various workarounds before giving up and throwing clight out of the window!

@tduboys
Copy link
Author

tduboys commented Jan 19, 2021

Hi,
Seems that is a bug on amdgpu driver that causes some calls made by ddcutil are stuck… I'm looking on this side and answered on an already-opened bug report on ddcutil.

Thanks to take times for my issue :) I'm using clight on all my setups for months, it's a cool project !

@FedeDP
Copy link
Owner

FedeDP commented Jan 19, 2021

It's a pleasure to hear that!

@FedeDP FedeDP closed this as completed Jan 19, 2021
@tduboys
Copy link
Author

tduboys commented Mar 27, 2021

Hi,
Just to report that the same issue on my setup have a different impact on my system on last clightd 5.3 (on an updated archlinux system)

The precedent issue was that clightd was unkillable. But now, the process is sopping well but when shutting down or restarting my computer did not work with different symptoms : all the system is halted, graphic card is powered down (screen does not receive signal anymore) but the motherboard is not powering off.

I do the same fix that last time : building clightd without DDC support and it solves my issue.
DDC and AMD RDNA2 graphic cards is still having troubles…

Thanks

@FedeDP
Copy link
Owner

FedeDP commented Mar 27, 2021

Hi! That is very unfortunate :(

DDC and AMD RDNA2 graphic cards is still having troubles…

It can be an issue while unloading i2c-dev kernel module, maybe?
Can you try to manually load it and unload it?
sudo modprobe i2c-dev
sudo rmmod i2c-dev

If clightd stops fine, the only thing remaining from DDC integration is that kernel module being loaded!

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

No branches or pull requests

2 participants