ITADN

[Bug]: ReferenceError: raw_email is not defined causes Emergency Shutdown in finishJob()

#949Closedfrankii91 创建于 2025-11-26
bug
F
frankii91commented
### DO NOT REPORT VULNERABILITIES HERE! - [x] By checking this box I am confirming this issue is NOT a vulnerability. ### Is there an existing issue for this? - [x] I have searched the existing issues ### What happened? A bug happened!**Title:** `ReferenceError: raw_email is not defined causes Emergency Shutdown in finishJob()` --- Hi, I’m getting a crash in Cronicle caused by `ReferenceError: raw_email is not defined` inside `finishJob()`. This leads to an **Emergency Shutdown** of the whole application. --- ### Environment - Cronicle: latest stable from GitHub (installed manually) - Node.js: 22.x - OS: FreeBSD 14.x - Install path: `/path/to/cronicle/` (local user install) --- ### Error details Stack trace: ```text ReferenceError: raw_email is not defined at constructor.finishJob (/path/to/cronicle/lib/job.js:1416:45) at /path/to/cronicle/lib/engine.js:725:15 at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) Log excerpts (hostname and URLs anonymized): text Skopiuj kod [1764158149.054][2025-11-26 12:55:49][host.example][64963][Error][error][job][Job failed: jmifmysu2br][{"params":{"method":"GET","url":"https://example.com/.../Cron.php?...","headers":"User-Agent: Cronicle/1.0","data":"","timeout":"30","follow":0,> Shutdown: ReferenceError: raw_email is not defined][] [1764158462.1][2025-11-26 13:01:02][host.example][75626][Cronicle][debug][1][Uncaught Exception: ReferenceError: raw_email is not defined][ReferenceError: raw_email is not defined at constructor.finishJob (/path/to/cronicle/lib/job.js:1416:45) at /path/to/cronicle/lib/engi] [1764158462.101][2025-11-26 13:01:02][host.example][75626][Cronicle][debug][1][Emergency Shutdown: ReferenceError: raw_email is not defined][] Job configuration / behavior Job type: HTTP request method: GET url: https://example.com/.../Cron.php?... (custom PHP endpoint) Schedule: every 1 minute Because the job runs every minute, the sequence is: Cronicle starts. The scheduled job runs. In finishJob() a ReferenceError: raw_email is not defined is thrown. This becomes an Uncaught Exception → Emergency Shutdown. The daemon restarts, after one minute the same job runs again → infinite crash loop. Side effect: there is no practical way to log into the web UI and edit this job, because Cronicle keeps crashing as soon as it tries to run it on startup. Expected vs actual behavior Expected: An error in a job, even caused by bad configuration, should: only mark that job as failed, log a normal error, optionally disable (deactivate) the problematic job automatically so it does not keep running in a loop, and send an emergency e-mail notification to the administrator about the failure, …but it should not bring down the entire application. Even if a user makes a mistake while manually editing a job, such an error should not cause an Emergency Shutdown of Cronicle. Actual: An undefined variable (raw_email) in finishJob() causes an uncaught exception and emergency shutdown of the whole app. With a job scheduled every minute the system is stuck in a crash loop and it’s effectively impossible to fix the job configuration via the UI. Suspected cause It looks like in lib/job.js in finishJob() the variable raw_email is being used, but: it’s not defined in that scope, or it’s a leftover from an earlier implementation that was only partially removed/renamed. This results in a ReferenceError instead of normal error handling. Questions / suggestions Can finishJob() (and the job lifecycle in general) be guarded so that exceptions there do not shut down Cronicle, but only fail the specific job? Should raw_email actually be used there, or is it a leftover that should be removed or replaced? Would you consider a mechanism where, if a job triggers an internal runtime error like this, Cronicle: automatically disables that job from further execution, and sends an emergency e-mail notification to the administrator (using the configured mail settings), instead of performing a global Emergency Shutdown? Would a “safe start” mode (e.g. temporarily ignoring a problematic job on startup) be possible, so that in situations like this it’s still possible to access the UI and fix the configuration instead of editing files/DB by hand? ### Operating System Freebsd 14 ### Node.js Version 22 ### Cronicle Version 0.9.100 ### Server Setup Single Server ### Storage Setup Local Filesystem ### Relevant log output ```shell ReferenceError: raw_email is not defined at constructor.finishJob (/usr/home/....../cronicle/lib/job.js:1416:45) at constructor.finishLocalJob (/usr/home/......./cronicle/lib/job.js:1133:10) at ChildProcess.<anonymous> (/usr/home/......./cronicle/lib/job.js:676:11) at ChildProcess.emit (node:events:517:28) at ChildProcess._handle.onexit (node:internal/child_process:292:12) ``` ### Code of Conduct - [x] I agree to follow this project's Code of Conduct
关闭于 2025-11-26 1 条评论