Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 657794 - sys-process/systemd-cron-1.5.12-r1 problem to send email on failure of cron job
Summary: sys-process/systemd-cron-1.5.12-r1 problem to send email on failure of cron job
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Richard Freeman
URL:
Whiteboard:
Keywords:
Depends on: 685592
Blocks:
  Show dependency tree
 
Reported: 2018-06-11 07:36 UTC by Lubos Kolouch
Modified: 2019-05-11 00:31 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lubos Kolouch 2018-06-11 07:36:56 UTC
When a cron job fails, the notification email is not sent.

The fail notification sevice (ie. cron-failure@cron-lubos-lubos-0.service) fails on python errors.

eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.5
  [2]   python2.7

# emerge -pv systemd-cron

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-process/systemd-cron-1.5.12-r1::gentoo  USE="-cron-boot -etc-crontab-systemd -minutely -setgid {-test} -yearly" PYTHON_SINGLE_TARGET="python3_5 -pypy3 -python3_4 -python3_6" PYTHON_TARGETS="python3_5 -pypy3 -python3_4 -python3_6" 0 KiB


cron-failure@cron-lubos-lubos-0.service - systemd-cron OnFailure for cron-lubos-lubos-0
   Loaded: loaded (/lib/systemd/system/cron-failure@.service; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-06-08 07:50:03 CEST; 3 days ago
     Docs: man:systemd.cron(7)
 Main PID: 8098 (code=exited, status=1/FAILURE)

Jun 08 07:50:03 vhp mail_on_failure[8098]:   File "/usr/lib64/python3.5/subprocess.py", line 385, in run
Jun 08 07:50:03 vhp mail_on_failure[8098]:     stdout, stderr = process.communicate(input, timeout=timeout)
Jun 08 07:50:03 vhp mail_on_failure[8098]:   File "/usr/lib64/python3.5/subprocess.py", line 790, in communicate
Jun 08 07:50:03 vhp mail_on_failure[8098]:     stdout = self.stdout.read()
Jun 08 07:50:03 vhp mail_on_failure[8098]:   File "/usr/lib64/python3.5/encodings/ascii.py", line 26, in decode
Jun 08 07:50:03 vhp mail_on_failure[8098]:     return codecs.ascii_decode(input, self.errors)[0]
Jun 08 07:50:03 vhp mail_on_failure[8098]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal no>
Jun 08 07:50:03 vhp systemd[1]: cron-failure@cron-lubos-lubos-0.service: Main process exited, code=exited, status=1/FAILURE
Jun 08 07:50:03 vhp systemd[1]: cron-failure@cron-lubos-lubos-0.service: Failed with result 'exit-code'.
Jun 08 07:50:03 vhp systemd[1]: Failed to start systemd-cron OnFailure for cron-lubos-lubos-0.
Comment 1 Lubos Kolouch 2018-06-11 08:14:47 UTC
same error with python-3.6.5-r1
Comment 2 Lubos Kolouch 2018-06-11 17:34:09 UTC
happens with locale POSIX, with UTF it works
Comment 3 Lubos Kolouch 2018-06-12 07:48:14 UTC
OK, even more strange. When I run the code myself, ie. 

/usr/lib/systemd-cron/mail_on_failure cron-lubos-lubos-6

It runs OK.

When activated from cron, it gives the python error.
Comment 4 Lubos Kolouch 2018-06-12 11:09:02 UTC
(In reply to Lubos Kolouch from comment #3)
> OK, even more strange. When I run the code myself, ie. 
> 
> /usr/lib/systemd-cron/mail_on_failure cron-lubos-lubos-6
> 
> It runs OK.
> 
> When activated from cron, it gives the python error.

fails even with UTF8
Comment 5 Dennis Schridde 2019-05-11 00:31:29 UTC
Is this fixed in 1.5.14? The changelog mentions "Handle sending mail_on_error when the locale is not correctly set"

See-Also: https://bugs.gentoo.org/show_bug.cgi?id=685592