MMBase

org.mmbase.module.SendMail: tries to send mail before it is properly initialized

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.0
  • Fix Version/s: 1.7.1
  • Component/s: Email
  • Description:
    Hide
    original bugid: #6525
    There is a startup-conflict in the standard SendMail module.

    Normal operation:
     - email gets inserted into database (by some mmbase install. on some machine)
     - sendmail has a probe-time, wakes up
     - checks whether there is mail, sends it

    When the server gets restarted between step 1 and 2, sendmail gets woken up before it is initialized, resulting in a empty hostname, so no mail is send (it will abort and delete the mail).

    Logfile:
     
    ----
     10:26 INFO org.mmbase.module.core.MMBase: Starting builder : email
     ...
     10:27 SERVICE org.mmbase.module.SendMail: SendMail connected to host=, port=25)
     10:27 ERROR org.mmbase.module.SendMail: SendMail cannot connect to host=, port=25).java.net.ConnectException: Connection refused
     ...
     10:27 INFO org.mmbase.util.logging.LoggerWrapper: Starting module sendmail
     10:27 DEBUG org.mmbase.module.SendMail: Module SendMail started (mailhost=mailhost.vpro.nl)
    ----

    Email does:
     sendprobe=new EmailSendProbe(this);

    EmailSendprobe:
     start() -> run() -> checkProbe():
      - tasks.removeElement(anode);
      - parent.performTask(anode);

    (parent = Email)

    Email.performTask(emailnode) ->
     - checkMailNode(node) does a
     - sendMailNode(node) {
          SendMailInterface sendmail=(SendMailInterface)Module.getModule("sendmail");
          if (to==null || ((SendMailInterface)Module.getModule("sendmail")).sendMail(mail)==false) {
          log.debug("Email -> mail failed");

       }

    Possible solution:

    A solution would be to move the mailhost=getInitParameter("mailhost") to sendMail(mail) to be sure that mailhost gets set.
    (fixed by Marcel Maatkamp)

    I've fixed and verified the following:

      sendMail(String from, String to, String data, Map headers) {
        if(mailhost==null || mailhost.equals(""))
          mailhost=getInitParameter("mailhost");
        ..
      }

    Also made the logfile more descriptive to what email gets send by sendmail-module. log.service will now print the 'from', 'to' and 'subject' to detect more easily a possible abuse or system-failure when sending mail (we seem to have another bug where email gets send twice).

    Sendmail.log.service
     print mail.'from', mail.'to', and mail.'subject'

    Sendmail.log.debug
     print connect.host, mail.from, mail.to, mail.subject and connect.status

    I've set status to 'integrated' and move it to 'closed' after a couple of days.
    Show
    original bugid: #6525 There is a startup-conflict in the standard SendMail module. Normal operation:  - email gets inserted into database (by some mmbase install. on some machine)  - sendmail has a probe-time, wakes up  - checks whether there is mail, sends it When the server gets restarted between step 1 and 2, sendmail gets woken up before it is initialized, resulting in a empty hostname, so no mail is send (it will abort and delete the mail). Logfile:   ----  10:26 INFO org.mmbase.module.core.MMBase: Starting builder : email  ...  10:27 SERVICE org.mmbase.module.SendMail: SendMail connected to host=, port=25)  10:27 ERROR org.mmbase.module.SendMail: SendMail cannot connect to host=, port=25).java.net.ConnectException: Connection refused  ...  10:27 INFO org.mmbase.util.logging.LoggerWrapper: Starting module sendmail  10:27 DEBUG org.mmbase.module.SendMail: Module SendMail started (mailhost=mailhost.vpro.nl) ---- Email does:  sendprobe=new EmailSendProbe(this); EmailSendprobe:  start() -> run() -> checkProbe():   - tasks.removeElement(anode);   - parent.performTask(anode); (parent = Email) Email.performTask(emailnode) ->  - checkMailNode(node) does a  - sendMailNode(node) {       SendMailInterface sendmail=(SendMailInterface)Module.getModule("sendmail");       if (to==null || ((SendMailInterface)Module.getModule("sendmail")).sendMail(mail)==false) {       log.debug("Email -> mail failed");    } Possible solution: A solution would be to move the mailhost=getInitParameter("mailhost") to sendMail(mail) to be sure that mailhost gets set. (fixed by Marcel Maatkamp) I've fixed and verified the following:   sendMail(String from, String to, String data, Map headers) {     if(mailhost==null || mailhost.equals(""))       mailhost=getInitParameter("mailhost");     ..   } Also made the logfile more descriptive to what email gets send by sendmail-module. log.service will now print the 'from', 'to' and 'subject' to detect more easily a possible abuse or system-failure when sending mail (we seem to have another bug where email gets send twice). Sendmail.log.service  print mail.'from', mail.'to', and mail.'subject' Sendmail.log.debug  print connect.host, mail.from, mail.to, mail.subject and connect.status I've set status to 'integrated' and move it to 'closed' after a couple of days.

Activity

Hide
Marcel Maatkamp added a comment - 2004-07-08 11:09
org.mmbase.module.SendMail: tries to send mail before it is properly initialized
There is a startup-conflict in the standard SendMail module.

Normal operation:
 - email gets inserted into database (by some mmbase install. on some machine)
 - sendmail has a probe-time, wakes up
 - checks whether there is mail, sends it

When the server gets restarted between step 1 and 2, sendmail gets woken up before it is initialized, resulting in a empty hostname, so no mail is send (it will abort and delete the mail).

Logfile:
 
----
 10:26 INFO org.mmbase.module.core.MMBase: Starting builder : email
 ...
 10:27 SERVICE org.mmbase.module.SendMail: SendMail connected to host=, port=25)
 10:27 ERROR org.mmbase.module.SendMail: SendMail cannot connect to host=, port=25).java.net.ConnectException: Connection refused
 ...
 10:27 INFO org.mmbase.util.logging.LoggerWrapper: Starting module sendmail
 10:27 DEBUG org.mmbase.module.SendMail: Module SendMail started (mailhost=mailhost.vpro.nl)
----

Email does:
 sendprobe=new EmailSendProbe(this);

EmailSendprobe:
 start() -> run() -> checkProbe():
  - tasks.removeElement(anode);
  - parent.performTask(anode);

(parent = Email)

Email.performTask(emailnode) ->
 - checkMailNode(node) does a
 - sendMailNode(node) {
      SendMailInterface sendmail=(SendMailInterface)Module.getModule("sendmail");
      if (to==null || ((SendMailInterface)Module.getModule("sendmail")).sendMail(mail)==false) {
      log.debug("Email -> mail failed");

   }

Possible solutions:

Maybe a boolean 'isInited' can be set to true from init(). When sendMail(mail) is called and boolean isInited is false, init() gets called beforehand. This will solve the hostname-part.

Another solution would be to move the mailhost=getInitParameter("mailhost") to sendMail(mail) to be sure that mailhost gets set.
Show
Marcel Maatkamp added a comment - 2004-07-08 11:09 org.mmbase.module.SendMail: tries to send mail before it is properly initialized There is a startup-conflict in the standard SendMail module. Normal operation:  - email gets inserted into database (by some mmbase install. on some machine)  - sendmail has a probe-time, wakes up  - checks whether there is mail, sends it When the server gets restarted between step 1 and 2, sendmail gets woken up before it is initialized, resulting in a empty hostname, so no mail is send (it will abort and delete the mail). Logfile:   ----  10:26 INFO org.mmbase.module.core.MMBase: Starting builder : email  ...  10:27 SERVICE org.mmbase.module.SendMail: SendMail connected to host=, port=25)  10:27 ERROR org.mmbase.module.SendMail: SendMail cannot connect to host=, port=25).java.net.ConnectException: Connection refused  ...  10:27 INFO org.mmbase.util.logging.LoggerWrapper: Starting module sendmail  10:27 DEBUG org.mmbase.module.SendMail: Module SendMail started (mailhost=mailhost.vpro.nl) ---- Email does:  sendprobe=new EmailSendProbe(this); EmailSendprobe:  start() -> run() -> checkProbe():   - tasks.removeElement(anode);   - parent.performTask(anode); (parent = Email) Email.performTask(emailnode) ->  - checkMailNode(node) does a  - sendMailNode(node) {       SendMailInterface sendmail=(SendMailInterface)Module.getModule("sendmail");       if (to==null || ((SendMailInterface)Module.getModule("sendmail")).sendMail(mail)==false) {       log.debug("Email -> mail failed");    } Possible solutions: Maybe a boolean 'isInited' can be set to true from init(). When sendMail(mail) is called and boolean isInited is false, init() gets called beforehand. This will solve the hostname-part. Another solution would be to move the mailhost=getInitParameter("mailhost") to sendMail(mail) to be sure that mailhost gets set.
Hide
Marcel Maatkamp added a comment - 2004-07-08 11:51
org.mmbase.module.SendMail: tries to send mail before it is properly initialized
There is a startup-conflict in the standard SendMail module.

Normal operation:
 - email gets inserted into database (by some mmbase install. on some machine)
 - sendmail has a probe-time, wakes up
 - checks whether there is mail, sends it

When the server gets restarted between step 1 and 2, sendmail gets woken up before it is initialized, resulting in a empty hostname, so no mail is send (it will abort and delete the mail).

Logfile:
 
----
 10:26 INFO org.mmbase.module.core.MMBase: Starting builder : email
 ...
 10:27 SERVICE org.mmbase.module.SendMail: SendMail connected to host=, port=25)
 10:27 ERROR org.mmbase.module.SendMail: SendMail cannot connect to host=, port=25).java.net.ConnectException: Connection refused
 ...
 10:27 INFO org.mmbase.util.logging.LoggerWrapper: Starting module sendmail
 10:27 DEBUG org.mmbase.module.SendMail: Module SendMail started (mailhost=mailhost.vpro.nl)
----

Email does:
 sendprobe=new EmailSendProbe(this);

EmailSendprobe:
 start() -> run() -> checkProbe():
  - tasks.removeElement(anode);
  - parent.performTask(anode);

(parent = Email)

Email.performTask(emailnode) ->
 - checkMailNode(node) does a
 - sendMailNode(node) {
      SendMailInterface sendmail=(SendMailInterface)Module.getModule("sendmail");
      if (to==null || ((SendMailInterface)Module.getModule("sendmail")).sendMail(mail)==false) {
      log.debug("Email -> mail failed");

   }

Possible solutions:

Maybe a boolean 'isInited' can be set to true from init(). When sendMail(mail) is called and boolean isInited is false, init() gets called beforehand. This will solve the hostname-part.

Another solution would be to move the mailhost=getInitParameter("mailhost") to sendMail(mail) to be sure that mailhost gets set.
I've fixed and verified the following:

  sendMail(String from, String to, String data, Map headers) {
    if(mailhost==null || mailhost.equals(""))
      mailhost=getInitParameter("mailhost");
    ..
  }

Also made the logfile more descriptive to what email gets send by sendmail-module. log.service will now print the 'from', 'to' and 'subject' to detect more easily a possible abuse or system-failure when sending mail (we seem to have another bug where email gets send twice).

Sendmail.log.service
 print mail.'from', mail.'to', and mail.'subject'

Sendmail.log.debug
 print connect.host, mail.from, mail.to, mail.subject and connect.status
Show
Marcel Maatkamp added a comment - 2004-07-08 11:51 org.mmbase.module.SendMail: tries to send mail before it is properly initialized There is a startup-conflict in the standard SendMail module. Normal operation:  - email gets inserted into database (by some mmbase install. on some machine)  - sendmail has a probe-time, wakes up  - checks whether there is mail, sends it When the server gets restarted between step 1 and 2, sendmail gets woken up before it is initialized, resulting in a empty hostname, so no mail is send (it will abort and delete the mail). Logfile:   ----  10:26 INFO org.mmbase.module.core.MMBase: Starting builder : email  ...  10:27 SERVICE org.mmbase.module.SendMail: SendMail connected to host=, port=25)  10:27 ERROR org.mmbase.module.SendMail: SendMail cannot connect to host=, port=25).java.net.ConnectException: Connection refused  ...  10:27 INFO org.mmbase.util.logging.LoggerWrapper: Starting module sendmail  10:27 DEBUG org.mmbase.module.SendMail: Module SendMail started (mailhost=mailhost.vpro.nl) ---- Email does:  sendprobe=new EmailSendProbe(this); EmailSendprobe:  start() -> run() -> checkProbe():   - tasks.removeElement(anode);   - parent.performTask(anode); (parent = Email) Email.performTask(emailnode) ->  - checkMailNode(node) does a  - sendMailNode(node) {       SendMailInterface sendmail=(SendMailInterface)Module.getModule("sendmail");       if (to==null || ((SendMailInterface)Module.getModule("sendmail")).sendMail(mail)==false) {       log.debug("Email -> mail failed");    } Possible solutions: Maybe a boolean 'isInited' can be set to true from init(). When sendMail(mail) is called and boolean isInited is false, init() gets called beforehand. This will solve the hostname-part. Another solution would be to move the mailhost=getInitParameter("mailhost") to sendMail(mail) to be sure that mailhost gets set. I've fixed and verified the following:   sendMail(String from, String to, String data, Map headers) {     if(mailhost==null || mailhost.equals(""))       mailhost=getInitParameter("mailhost");     ..   } Also made the logfile more descriptive to what email gets send by sendmail-module. log.service will now print the 'from', 'to' and 'subject' to detect more easily a possible abuse or system-failure when sending mail (we seem to have another bug where email gets send twice). Sendmail.log.service  print mail.'from', mail.'to', and mail.'subject' Sendmail.log.debug  print connect.host, mail.from, mail.to, mail.subject and connect.status

People

Dates

  • Created:
    2004-07-08 12:00
    Updated:
    2006-12-27 17:55
    Resolved:
    2006-11-24 13:42