You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Howard W. Smith, Jr." <sm...@gmail.com> on 2013/10/29 15:47:20 UTC

Best way to recover from RuntimeException from ejbTimeout on ..., ConcurrentAccessTimeoutException: Unable to get write lock on ...

This morning, one of the endusers of my app contacted me and informed me
about an issue with the software i wrote to use @Singleton + @Lock(WRITE) +
@Schedule to retrieve emails from an email account where schedule = every 2
minutes.

This code has been running really well ever since I initially developed it
back in December 2012 after discussing this on the user list and getting
some tips from David Blevins, but this morning, the following exception,

Oct 29, 2013 1:30:00 AM
org.apache.openejb.core.timer.EjbTimerServiceImpl ejbTimeout
WARNING: RuntimeException from ejbTimeout on EmailRequestBean
javax.ejb.ConcurrentAccessTimeoutException: Unable to get write lock
on 'downloadEmailRequests' method for: utils.mail.EmailRequestBean
	at org.apache.openejb.core.singleton.SingletonContainer.aquireLock(SingletonContainer.java:298)
	at org.apache.openejb.core.singleton.SingletonContainer._invoke(SingletonContainer.java:217)
	at org.apache.openejb.core.singleton.SingletonContainer.invoke(SingletonContainer.java:197)
	at org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimerServiceImpl.java:759)
	at org.apache.openejb.core.timer.EjbTimeoutJob.execute(EjbTimeoutJob.java:39)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:207)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


was caused by one gmail-connection-timeout a little before 1:30am,

Oct 29, 2013 1:22:21 AM utils.mail.EmailHandler initialize
INFO: Exception caught:Connection timed out: connect
Oct 29, 2013 1:22:21 AM utils.mail.EmailRequestBean downloadEmailRequests
INFO: Error loading emails from Inbox; Connection timed out: connect

and then the ConcurrentAccessTimeoutException continued to occur until I
stopped tomee and (re)started tomee; please see log file[1]. I have already
made some tweaks to the software to 'prevent' or limit exceptions written
to the error log, when internet disconnection occurs. My app initiates
gmail IMAP and google-calendar API connections quite often via multiple
@Singleton + @Lock(WRITE) + @Schedule bean/methods.

Can someone advise on how best to recover from this 'domino-effect' type of
bug/issue? I know this is not a tomee bug, and i'm sure my app can recover
from this, just need a hint...please. thanks. :)


[1] https://gist.github.com/smithh032772/7215589

Re: Best way to recover from RuntimeException from ejbTimeout on ..., ConcurrentAccessTimeoutException: Unable to get write lock on ...

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
With some research[1][2], I learned that it may be necessary to set
[javamail] imap timeout,

mail.imap.connectiontimeout int Socket connection timeout value in
milliseconds. Default is infinite timeout.
mail.imap.timeout int Socket I/O timeout value in milliseconds. Default is
infinite timeout.

to resolve this issue of mine. i'll give this a try. :)


[1] https://forums.oracle.com/message/10810414

[2]
http://www.ing.iac.es/~docs/external/java/javamail/javadocs/com/sun/mail/imap/package-summary.html






On Tue, Oct 29, 2013 at 10:47 AM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> This morning, one of the endusers of my app contacted me and informed me
> about an issue with the software i wrote to use @Singleton + @Lock(WRITE) +
> @Schedule to retrieve emails from an email account where schedule = every 2
> minutes.
>
> This code has been running really well ever since I initially developed it
> back in December 2012 after discussing this on the user list and getting
> some tips from David Blevins, but this morning, the following exception,
>
>
> Oct 29, 2013 1:30:00 AM org.apache.openejb.core.timer.EjbTimerServiceImpl ejbTimeout
> WARNING: RuntimeException from ejbTimeout on EmailRequestBean
>
> javax.ejb.ConcurrentAccessTimeoutException: Unable to get write lock on 'downloadEmailRequests' method for: utils.mail.EmailRequestBean
> 	at org.apache.openejb.core.singleton.SingletonContainer.aquireLock(SingletonContainer.java:298)
> 	at org.apache.openejb.core.singleton.SingletonContainer._invoke(SingletonContainer.java:217)
> 	at org.apache.openejb.core.singleton.SingletonContainer.invoke(SingletonContainer.java:197)
> 	at org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimerServiceImpl.java:759)
> 	at org.apache.openejb.core.timer.EjbTimeoutJob.execute(EjbTimeoutJob.java:39)
> 	at org.quartz.core.JobRunShell.run(JobRunShell.java:207)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> 	at java.lang.Thread.run(Unknown Source)
>
>
> was caused by one gmail-connection-timeout a little before 1:30am,
>
> Oct 29, 2013 1:22:21 AM utils.mail.EmailHandler initialize
> INFO: Exception caught:Connection timed out: connect
> Oct 29, 2013 1:22:21 AM utils.mail.EmailRequestBean downloadEmailRequests
> INFO: Error loading emails from Inbox; Connection timed out: connect
>
> and then the ConcurrentAccessTimeoutException continued to occur until I
> stopped tomee and (re)started tomee; please see log file[1]. I have already
> made some tweaks to the software to 'prevent' or limit exceptions written
> to the error log, when internet disconnection occurs. My app initiates
> gmail IMAP and google-calendar API connections quite often via multiple
> @Singleton + @Lock(WRITE) + @Schedule bean/methods.
>
> Can someone advise on how best to recover from this 'domino-effect' type
> of bug/issue? I know this is not a tomee bug, and i'm sure my app can
> recover from this, just need a hint...please. thanks. :)
>
>
> [1] https://gist.github.com/smithh032772/7215589
>
>
>
>