title: java.net.SocketException: Broken pipe with SMTP
body: <p>I got strange behavior when my application tries to send an email.</p>
  
  <pre><code>20:59:08,926 ERROR [release.com.mycompany.mail.GenericMail] (EJB default - 5) [MY_EJB INBOUND] Sending message failed!: javax.mail.MessagingException: Can't send command to SMTP host;
    nested exception is:
      java.net.SocketException: Broken pipe
      at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2106) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
      at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2093) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
      at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1184) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
      at javax.mail.Transport.send0(Transport.java:197) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
      at javax.mail.Transport.send(Transport.java:124) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
      at com.mycompany.MailUtils.sendMail(MailUtils.java:258) [classes:]
  </code></pre>
  
  <p>Before this exception some timeout exception has been thrown:</p>
  
  <pre><code>    20:57:50,291 ERROR [org.jboss.as.ejb3] (EJB default - 9) [ ] JBAS014122: Error during
  retrying timeout for timer: [id=6be904b5-c1ef-4f0e-a277-d4c9f93e21b3 timedObjectId=SOME_EJB 
  auto-timer?:false persistent?:false timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@99fdab1 initialExpiration=/* date */ 00:00:00 UTC 2015 intervalDuration(in milli sec)=0 nextExpiration=/* other date */ 21:00:00 UTC 2015 
  timerState=RETRY_TIMEOUT: javax.ejb.EJBTransactionRolledbackException: JBAS014373: 
  EJB 3.1 PFD2 4.8.5.5.1 concurrent access timeout on org.jboss.invocation.InterceptorContext$Invocation@66668127 - could not obtain lock within 5000MILLISECONDS
  </code></pre>
  
  <p>To be honest i don't know whats happened. I got these kind of exception for 5 hours. 
  I want to know whats happened and be able to avoid exceptions in future.</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p><code>SOME_EJB</code> is an ejb with works with timerService. Runs every 3 minutes, when the conditions are met sends an email. </p>
  
  <p>My only idea is that there was some network/database issue and it caused that single execution of task took more than 3 minutes. </p>
  
  <p><code>MailUtils</code> is a <code>@Stateless</code> ejb </p>