haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.11k stars 660 forks source link

bug: daemon dies unexpectedly - Error: read ECONNRESET #3398

Closed unplugged216 closed 2 months ago

unplugged216 commented 2 months ago

Describe the bug

While running Haraka in daemon mode, after some time, hours, the daemon dies with a very short message.

Expected behavior

The expected behavior would be to not die... However, more clearly would be to log the issue and move along as in a daemon environment no human eyes are babysitting it to ensure it does stop.

Observed behavior

While the daemon is running, the daemon will die and post to the log the following output.

[CRIT] [-] [core] Error: read ECONNRESET
[CRIT] [-] [core]     at TCP.onStreamRead (node:internal/stream_base_commons:218:20)
[NOTICE] [-] [core] Shutting down
[NOTICE] [-] [core] Shutting down

Steps To Reproduce

Frankly, I enabled demonize in smtp.ini and ran it. I let it run over night and sometime in the evening it dies. This happens during the day as well. So far, every 6 hours or so.

System Info

Haraka | Haraka.js — Version: 3.0.4
 --- | :--- 
Node | v20.17.0
OS | Linux haraka 5.15.0-119-generic #129-Ubuntu SMP Fri Aug 2 19:25:20 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
openssl | OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

Additional context

I would not be trying to run this as a daemon indefinitely if I could get the service to work. There is a whole lot of documentation missing from hark.service to drop it in and go lol. I am trying to work through it but omg this one is rough. Im likely missing something obvious but yeah.

msimerson commented 2 months ago

In smtp.ini, make sure to set nodes > 1, so that Haraka has a supervisory process that restarts workers after a crash / failure:

nodes=2
unplugged216 commented 2 months ago

Ah!

I'll give that a whack. Did I miss that in the documentation?

unplugged216 commented 2 months ago

In smtp.ini, make sure to set nodes > 1, so that Haraka has a supervisory process that restarts workers after a crash / failure:

nodes=2

Well,

that certainly made the logs barf out a ton of grit messages and then shut down lol. Troubleshooting that now.

unplugged216 commented 2 months ago

In smtp.ini, make sure to set nodes > 1, so that Haraka has a supervisory process that restarts workers after a crash / failure:

nodes=2

Well,

that certainly made the logs barf out a ton of grit messages and then shut down lol. Troubleshooting that now.

Ok, up and running. I keep forgetting with the daemon you have to remove the PID file. Maybe I'll write a wrapper to handle this.

Anyway, it's running, I'll report back what happens. Thank you for pointing me in this direction!

msimerson commented 2 months ago

Did I miss that in the documentation?

I added a note in smtp.ini pointing to https://github.com/haraka/Haraka/wiki/Performance-Tuning, where this is documented.

Thank you for pointing me in this direction!

You're welcome.

unplugged216 commented 2 months ago

Did I miss that in the documentation?

I added a note in smtp.ini pointing to https://github.com/haraka/Haraka/wiki/Performance-Tuning, where this is documented.

Thank you for pointing me in this direction!

You're welcome.

Hello,

This did not solve the issue. Same exact error and notes in the log. Still monitoring to see if we can find out what's up.